From 3e7915e19ab0f3d0eda3bbecd196732bc8a8f543 Mon Sep 17 00:00:00 2001 From: dtfiedler Date: Wed, 25 Sep 2024 09:46:33 -0600 Subject: [PATCH] chore(git): speed up tests by executing in parallel --- .github/workflows/build.yml | 15 ++++++++++++--- package.json | 8 ++++---- tests/e2e/web/src/App.test.tsx | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6da736f9..0bef9268 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,9 @@ jobs: - run: yarn ${{ matrix.command }} test: + strategy: + matrix: + suite: [unit, web, esm, cjs] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -48,16 +51,22 @@ jobs: run: yarn --immutable --immutable-cache - name: Run tests - run: yarn test + run: yarn test:${{ matrix.suite }} - name: Upload coverage + if: matrix.suite == 'unit' uses: codecov/codecov-action@v4.0.1 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + notify: + needs: [build, test] + if: success() + runs-on: ubuntu-latest + steps: - name: Send Slack notification uses: rtCamp/action-slack-notify@v2 env: - SLACK_TITLE: ${{ job.status == 'success' && 'Build / E2E tests succeeded!' || 'Build / E2E tests failed!' }} - SLACK_COLOR: ${{ job.status == 'success' && 'good' || 'danger' }} + SLACK_TITLE: 'Build / E2E tests succeeded!' + SLACK_COLOR: 'good' SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} diff --git a/package.json b/package.json index efbe7dfc..a50f949e 100644 --- a/package.json +++ b/package.json @@ -66,12 +66,12 @@ "format": "prettier --check .", "format:fix": "prettier --write .", "test": "yarn test:unit && yarn test:e2e", - "test:cjs": "cd ./tests/e2e/cjs && yarn && yarn test", - "test:esm": "cd ./tests/e2e/esm && yarn && yarn test", - "test:web": "cd ./tests/e2e/web && yarn && yarn test", + "test:cjs": "yarn test:link && cd ./tests/e2e/cjs && yarn && yarn test", + "test:esm": "yarn test:link && cd ./tests/e2e/esm && yarn && yarn test", + "test:web": "yarn test:link && cd ./tests/e2e/web && yarn && yarn test", "test:unit": "NODE_OPTIONS=\"--import=./register.mjs\" node --test tests/unit/**.test.ts", "test:link": "yarn build && yarn link", - "test:e2e": "yarn test:link && yarn test:cjs && yarn test:esm && yarn test:web", + "test:e2e": "yarn test:cjs && yarn test:esm && yarn test:web", "prepare": "husky install", "example:esm": "cd examples/esm && yarn && node index.mjs", "example:cjs": "yarn test:link && cd examples/cjs && yarn && node index.cjs", diff --git a/tests/e2e/web/src/App.test.tsx b/tests/e2e/web/src/App.test.tsx index 63c92de0..241211bd 100644 --- a/tests/e2e/web/src/App.test.tsx +++ b/tests/e2e/web/src/App.test.tsx @@ -18,7 +18,7 @@ describe('ESM browser validation', () => { .withBuild() .withWaitStrategy('ao-cu-1', Wait.forHttp('/', 6363)) .up(['ao-cu']); - }); + }, 120_000); it('should load the app and SDK', async () => { await act(async () => render());