diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index 27ea1c00..7ec7868d 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -74,7 +74,7 @@ jobs: run: yarn format:check - name: Run tests - run: yarn test:unit + run: yarn test - name: Run typecheck run: yarn typecheck diff --git a/README.md b/README.md index 502a3aa6..7d031bc4 100644 --- a/README.md +++ b/README.md @@ -226,3 +226,27 @@ git clone https://github.com/containers/podman-desktop-extension-bootc cd podman-desktop yarn watch --extension-folder ../podman-desktop-extension-bootc/packages/backend ``` + +### Testing & Developing + +Workflow for developing would be the following: + +```sh +# Bootc root folder: +yarn watch + +# In a separate terminal in the Podman Desktop folder: +yarn watch --extension-folder ../podman-desktop-extension-bootc/packages/backend +``` + +Workflow for testing and validation checking before PR submission: + +```sh +# Tests +yarn test + +# Formatting, linting and typecheck +yarn format:fix +yarn lint:fix +yarn typecheck +``` \ No newline at end of file diff --git a/package.json b/package.json index 9bb1ffb0..7a903a5b 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "test:backend": "vitest run -r packages/backend --passWithNoTests --coverage", "test:frontend": "vitest run -r packages/frontend --passWithNoTests --coverage", "test:shared": "vitest run -r packages/shared --passWithNoTests --coverage", - "test:unit": "npm run test:backend && npm run test:shared && npm run test:frontend", + "test": "npm run test:backend && npm run test:shared && npm run test:frontend", "test:e2e": "cd tests/playwright && npm run test:e2e", "typecheck:shared": "tsc --noEmit --project packages/shared", "typecheck:frontend": "tsc --noEmit --project packages/frontend", diff --git a/packages/backend/src/build-disk-image.spec.ts b/packages/backend/src/build-disk-image.spec.ts index 86722e85..e096f263 100644 --- a/packages/backend/src/build-disk-image.spec.ts +++ b/packages/backend/src/build-disk-image.spec.ts @@ -40,7 +40,7 @@ beforeEach(() => { test('check image builder options', async () => { const image = 'test-image'; - const type = 'iso'; + const type = 'raw'; const arch = 'amd'; const name = 'my-image'; const outputFolder = '/output-folder'; @@ -59,7 +59,7 @@ test('check image builder options', async () => { test('check image builder with multiple types', async () => { const image = 'test-image'; - const type: BuildType[] = ['iso', 'vmdk']; + const type: BuildType[] = ['raw', 'vmdk']; const arch = 'amd'; const name = 'my-image'; const outputFolder = '/output-folder'; @@ -89,7 +89,7 @@ test('check image builder with multiple types', async () => { test('check image builder does not include target arch', async () => { const image = 'test-image'; - const type = 'iso'; + const type = 'vmdk'; const name = 'my-image'; const outputFolder = '/output-folder'; const options = createBuilderImageOptions(name, image, [type], undefined, outputFolder); @@ -98,6 +98,19 @@ test('check image builder does not include target arch', async () => { expect(options.Cmd).not.toContain('--target-arch'); }); +// temporary test, see createBuilderImageOptions +test('temporarily check image builder does not include target arch for iso', async () => { + const image = 'test-image'; + const type = 'iso'; + const arch = 'amd'; + const name = 'my-image'; + const outputFolder = '/output-folder'; + const options = createBuilderImageOptions(name, image, [type], arch, outputFolder); + + expect(options).toBeDefined(); + expect(options.Cmd).not.toContain('--target-arch'); +}); + test('check we pick unused container name', async () => { const basename = 'test'; let name = await getUnusedName(basename); diff --git a/packages/backend/src/build-disk-image.ts b/packages/backend/src/build-disk-image.ts index 663c2213..7553f242 100644 --- a/packages/backend/src/build-disk-image.ts +++ b/packages/backend/src/build-disk-image.ts @@ -326,7 +326,13 @@ export function createBuilderImageOptions( const cmd = [image, '--output', '/output/', '--local']; type.forEach(t => cmd.push('--type', t)); - if (arch) { + + // bootc image builder does not currently support specifying a target arch + // (even the current/default one) when building an iso. Enough people are + // hitting this that we are putting in a temporary workaround until the + // following issue is resolved: + // https://github.com/osbuild/bootc-image-builder/issues/316 + if (arch && !type.find(buildType => buildType === 'iso')) { cmd.push('--target-arch', arch); }