Skip to content

Commit

Permalink
fix(ci): moving several tasks from yarn to bun, improve tests (#1566)
Browse files Browse the repository at this point in the history
  • Loading branch information
IbrahimCSAE authored Nov 8, 2024
1 parent ed3bf87 commit ebfd52f
Show file tree
Hide file tree
Showing 32 changed files with 115 additions and 411 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ jobs:
shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
shardTotal: [15]
steps:
- name: Install unzip
run: apt-get update && apt-get install -y unzip
- uses: oven-sh/setup-bun@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: yarn install --frozen-lockfile
run: bun install --frozen-lockfile
- name: Run Playwright tests
run:
export NODE_OPTIONS="--max_old_space_size=8192" && npx playwright test --shard=${{
matrix.shardIndex }}/${{ matrix.shardTotal }}

run: |
export NODE_OPTIONS="--max_old_space_size=8192"
bun x playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- name: Upload blob report to GitHub Actions Artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
Expand All @@ -40,23 +42,21 @@ jobs:
needs: [playwright-tests]
runs-on: ubuntu-latest
steps:
- uses: oven-sh/setup-bun@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: yarn install --frozen-lockfile

run: bun install --frozen-lockfile
- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
path: all-blob-reports
pattern: blob-report-*
merge-multiple: true

- name: Merge into HTML Report
run: npx playwright merge-reports --reporter html ./all-blob-reports

run: bun x playwright merge-reports --reporter html ./all-blob-reports
- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@
"example": "node ./utils/ExampleRunner/example-runner-cli.js",
"all-examples": "node ./utils/ExampleRunner/build-all-examples-cli.js --fromRoot",
"build-all-examples": "cross-env NODE_OPTIONS=--max_old_space_size=32896 node ./utils/ExampleRunner/build-all-examples-cli.js --build --fromRoot || (echo 'Build failed - likely due to memory constraints' && exit 1)",
"build-all-examples-legacy": "cross-env NODE_OPTIONS=--max_old_space_size=32896 node ./utils/ExampleRunner/build-all-examples-cli-legacy.js --build --fromRoot || (echo 'Build failed - likely due to memory constraints' && exit 1)",
"serve-static-examples": "npx serve .static-examples",
"build-and-serve-static-examples": "cross-env NODE_OPTIONS=--max_old_space_size=32896 yarn run build-all-examples && yarn run serve-static-examples",
"build-and-serve-static-examples-legacy": "cross-env NODE_OPTIONS=--max_old_space_size=32896 yarn run build-all-examples-legacy && yarn run serve-static-examples",
"build-for-playwright": "cross-env NODE_OPTIONS=--max_old_space_size=32896 node ./utils/ExampleRunner/build-playwright-examples-cli.js --build --fromRoot && npx serve .static-examples-playwright",
"build:all": "npx lerna run build:all",
"dev": "yarn run all-examples",
"docs": "npx lerna run docs",
Expand Down
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default defineConfig({
},
],
webServer: {
command: 'yarn build-and-serve-static-examples-legacy',
command: 'yarn build-and-serve-static-examples',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
timeout: 500 * 1000,
Expand Down
32 changes: 14 additions & 18 deletions tests/labelmapRendering.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,39 @@ import {
checkForScreenshot,
visitExample,
screenShotPaths,
reduceViewportsSize,
attemptAction,
} from './utils/index';

test.beforeEach(async ({ page }) => {
await visitExample(page, 'labelmapRendering');
await visitExample(page, 'labelmapRendering', 0, false, false);
});

test.describe('Labelmap Rendering', async () => {
test('should render the labelmap in axial orientation', async ({ page }) => {
const canvas = await page.locator('canvas').nth(0);
test('should render the labelmap in axial/coronal/sagittal orientations', async ({
page,
}) => {
await attemptAction(() => reduceViewportsSize(page), 1000, 10);

const axial = await page.locator('canvas').nth(0);
const coronal = await page.locator('canvas').nth(1);
const sagittal = await page.locator('canvas').nth(2);

await checkForScreenshot(
page,
canvas,
axial,
screenShotPaths.labelmapRendering.axial
);
});

test('should render the labelmap in coronal orientation', async ({
page,
}) => {
const canvas = await page.locator('canvas').nth(1);

await checkForScreenshot(
page,
canvas,
coronal,
screenShotPaths.labelmapRendering.coronal
);
});

test('should render the labelmap in sagittal orientation', async ({
page,
}) => {
const canvas = await page.locator('canvas').nth(2);

await checkForScreenshot(
page,
canvas,
sagittal,
screenShotPaths.labelmapRendering.sagittal
);
});
Expand Down
Loading

0 comments on commit ebfd52f

Please sign in to comment.