diff --git a/.github/workflows/uffizzi-build.yml b/.github/workflows/uffizzi-build.yml index 55d0c63145..5a68ad9568 100644 --- a/.github/workflows/uffizzi-build.yml +++ b/.github/workflows/uffizzi-build.yml @@ -28,7 +28,7 @@ jobs: - name: backstage create-app | delete if already exists run: | rm -rf ./example-app - npx @backstage/create-app + node ./packages/e2e-test/.bin/e2e-test create -o ./example-app env: BACKSTAGE_APP_NAME: example-app diff --git a/packages/e2e-test/src/commands/index.ts b/packages/e2e-test/src/commands/index.ts index 95d311427c..db9ea225a3 100644 --- a/packages/e2e-test/src/commands/index.ts +++ b/packages/e2e-test/src/commands/index.ts @@ -15,8 +15,9 @@ */ import { Command } from 'commander'; -import { run } from './run'; +import { run, create } from './run'; export function registerCommands(program: Command) { program.command('run').description('Run e2e tests').action(run); + program.command('create').option('-o, --output ').action(create); } diff --git a/packages/e2e-test/src/commands/run.ts b/packages/e2e-test/src/commands/run.ts index 3eedb90b21..b022862c8c 100644 --- a/packages/e2e-test/src/commands/run.ts +++ b/packages/e2e-test/src/commands/run.ts @@ -43,6 +43,24 @@ const templatePackagePaths = [ 'packages/create-app/templates/default-app/packages/backend/package.json.hbs', ]; +export async function create({ output }: { output: string }) { + const outputDir = resolvePath(process.cwd(), output); + + const rootDir = await fs.mkdtemp(resolvePath(os.tmpdir(), 'backstage-e2e-')); + print(`CLI E2E test root: ${rootDir}\n`); + + print('Building dist workspace'); + const workspaceDir = await buildDistWorkspace('workspace', rootDir); + + // // Otherwise yarn will refuse to install with CI=true + process.env.YARN_ENABLE_IMMUTABLE_INSTALLS = 'false'; + + print('Creating a Backstage App'); + const appDir = await createApp('test-app', workspaceDir, rootDir); + + await fs.move(appDir, outputDir, { overwrite: true }); +} + export async function run() { const rootDir = await fs.mkdtemp(resolvePath(os.tmpdir(), 'backstage-e2e-')); print(`CLI E2E test root: ${rootDir}\n`);