From 50229bda9a6fab00146ce61ef3b1ebdb4ac742a9 Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Sat, 15 Jun 2024 16:47:55 -0600 Subject: [PATCH] ci(all-packages): split tests according to AVA recipe https://github.com/avajs/ava/blob/main/docs/recipes/splitting-tests-ci.md#splitting-tests-on-github-actions --- .github/workflows/test-all-packages.yml | 168 +++++++----------------- 1 file changed, 45 insertions(+), 123 deletions(-) diff --git a/.github/workflows/test-all-packages.yml b/.github/workflows/test-all-packages.yml index f88455570dc..330c9332ab2 100644 --- a/.github/workflows/test-all-packages.yml +++ b/.github/workflows/test-all-packages.yml @@ -164,9 +164,6 @@ jobs: - name: yarn test (ERTP) if: (success() || failure()) run: cd packages/ERTP && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT - - name: yarn test (governance) - if: (success() || failure()) - run: cd packages/governance && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT - name: yarn test (import-manager) if: (success() || failure()) run: cd packages/import-manager && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT @@ -197,6 +194,12 @@ jobs: - name: yarn test (vow) if: (success() || failure()) run: cd packages/vow && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT + - name: yarn test (xsnap-lockdown) + if: (success() || failure()) + run: cd packages/xsnap-lockdown && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT + - name: yarn test (xsnap) + if: (success() || failure()) + run: cd packages/xsnap && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT - name: notify on failure if: failure() && github.event_name != 'pull_request' uses: ./.github/actions/notify-status @@ -334,14 +337,14 @@ jobs: ############## # Long-running tests are executed individually. - test-solo: + test-governance: # BEGIN-TEST-BOILERPLATE timeout-minutes: 30 needs: build runs-on: ubuntu-latest strategy: matrix: - # test:xs is noop in solo/package.json + # test:xs is noop in governance/package.json engine: ['18.x', '20.x'] steps: - name: set vars @@ -356,9 +359,9 @@ jobs: with: node-version: ${{ steps.vars.outputs.node-version }} # END-TEST-BOILERPLATE - - name: yarn test (solo) + - name: yarn test (governance) if: (success() || failure()) - run: cd packages/solo && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT + run: cd packages/governance && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT - name: notify on failure if: failure() && github.event_name != 'pull_request' uses: ./.github/actions/notify-status @@ -375,15 +378,15 @@ jobs: datadog-token: ${{ secrets.DATADOG_API_KEY }} codecov-token: ${{ secrets.CODECOV_TOKEN }} - test-cosmic-swingset: + test-solo: # BEGIN-TEST-BOILERPLATE timeout-minutes: 30 needs: build runs-on: ubuntu-latest strategy: matrix: - # test:xs is noop in cosmic-swingset/package.json - engine: ['18.x', '20.x', 'xs'] + # test:xs is noop in solo/package.json + engine: ['18.x', '20.x'] steps: - name: set vars id: vars @@ -397,12 +400,9 @@ jobs: with: node-version: ${{ steps.vars.outputs.node-version }} # END-TEST-BOILERPLATE - - uses: ./.github/actions/restore-golang - with: - go-version: '1.20' - - name: yarn test (cosmic-swingset) + - name: yarn test (solo) if: (success() || failure()) - run: cd packages/cosmic-swingset && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT + run: cd packages/solo && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT - name: notify on failure if: failure() && github.event_name != 'pull_request' uses: ./.github/actions/notify-status @@ -419,15 +419,15 @@ jobs: datadog-token: ${{ secrets.DATADOG_API_KEY }} codecov-token: ${{ secrets.CODECOV_TOKEN }} - test-inter-protocol: + test-cosmic-swingset: # BEGIN-TEST-BOILERPLATE timeout-minutes: 30 needs: build runs-on: ubuntu-latest strategy: matrix: - # test:xs is noop in inter-protocol/package.json - engine: ['18.x', '20.x'] + # test:xs is noop in cosmic-swingset/package.json + engine: ['18.x', '20.x', 'xs'] steps: - name: set vars id: vars @@ -441,9 +441,12 @@ jobs: with: node-version: ${{ steps.vars.outputs.node-version }} # END-TEST-BOILERPLATE - - name: yarn test (inter-protocol) + - uses: ./.github/actions/restore-golang + with: + go-version: '1.20' + - name: yarn test (cosmic-swingset) if: (success() || failure()) - run: cd packages/inter-protocol && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT + run: cd packages/cosmic-swingset && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT - name: notify on failure if: failure() && github.event_name != 'pull_request' uses: ./.github/actions/notify-status @@ -460,14 +463,15 @@ jobs: datadog-token: ${{ secrets.DATADOG_API_KEY }} codecov-token: ${{ secrets.CODECOV_TOKEN }} - test-boot: + test-inter-protocol: # BEGIN-TEST-BOILERPLATE - timeout-minutes: 40 + timeout-minutes: 30 needs: build runs-on: ubuntu-latest strategy: matrix: - engine: ['18.x', '20.x', 'xs'] + # test:xs is noop in inter-protocol/package.json + engine: ['18.x', '20.x'] steps: - name: set vars id: vars @@ -481,9 +485,9 @@ jobs: with: node-version: ${{ steps.vars.outputs.node-version }} # END-TEST-BOILERPLATE - - name: yarn test (boot) + - name: yarn test (inter-protocol) if: (success() || failure()) - run: cd packages/boot && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT + run: cd packages/inter-protocol && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT - name: notify on failure if: failure() && github.event_name != 'pull_request' uses: ./.github/actions/notify-status @@ -500,15 +504,17 @@ jobs: datadog-token: ${{ secrets.DATADOG_API_KEY }} codecov-token: ${{ secrets.CODECOV_TOKEN }} - # The test-swingset* tests are split by alphabetical test name. - test-swingset: + test-boot: # BEGIN-TEST-BOILERPLATE - timeout-minutes: 30 + timeout-minutes: 40 needs: build runs-on: ubuntu-latest strategy: matrix: engine: ['18.x', '20.x', 'xs'] + # Run parallel testing jobs, each executing a subset. + node_index: [0, 1, 2, 3] + total_nodes: [4] # the total number of nodes steps: - name: set vars id: vars @@ -516,17 +522,17 @@ jobs: echo "node-version=${{ matrix.engine == 'xs' && '18.x' || matrix.engine }}" >> $GITHUB_OUTPUT echo "test=${{ matrix.engine == 'xs' && 'test:xs' || 'test' }}" >> $GITHUB_OUTPUT echo "GH_ENGINE=${{ matrix.engine }}" >> $GITHUB_ENV + echo "CI_NODE_INDEX=${{ matrix.node_index }}" >> $GITHUB_ENV + echo "CI_NODE_TOTAL=${{ matrix.total_nodes }}" >> $GITHUB_ENV - uses: actions/checkout@v4 - uses: ./.github/actions/restore-node with: node-version: ${{ steps.vars.outputs.node-version }} - id: restore-node - - run: echo "ENDO_BRANCH=${{ steps.restore-node.outputs.endo-branch }}" >> $GITHUB_ENV # END-TEST-BOILERPLATE - - name: yarn test (SwingSet) + - name: yarn test (boot) if: (success() || failure()) - run: cd packages/SwingSet && yarn ${{ steps.vars.outputs.test }} 'test/**/[A-Da-d]*' | $TEST_COLLECT + run: cd packages/boot && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT - name: notify on failure if: failure() && github.event_name != 'pull_request' uses: ./.github/actions/notify-status @@ -543,7 +549,7 @@ jobs: datadog-token: ${{ secrets.DATADOG_API_KEY }} codecov-token: ${{ secrets.CODECOV_TOKEN }} - test-swingset2: + test-swingset: # BEGIN-TEST-BOILERPLATE timeout-minutes: 30 needs: build @@ -551,6 +557,9 @@ jobs: strategy: matrix: engine: ['18.x', '20.x', 'xs'] + # Run parallel testing jobs, each executing a subset. + node_index: [0, 1, 2, 3, 4] + total_nodes: [5] # the total number of nodes steps: - name: set vars id: vars @@ -558,6 +567,8 @@ jobs: echo "node-version=${{ matrix.engine == 'xs' && '18.x' || matrix.engine }}" >> $GITHUB_OUTPUT echo "test=${{ matrix.engine == 'xs' && 'test:xs' || 'test' }}" >> $GITHUB_OUTPUT echo "GH_ENGINE=${{ matrix.engine }}" >> $GITHUB_ENV + echo "CI_NODE_INDEX=${{ matrix.node_index }}" >> $GITHUB_ENV + echo "CI_NODE_TOTAL=${{ matrix.total_nodes }}" >> $GITHUB_ENV - uses: actions/checkout@v4 - uses: ./.github/actions/restore-node @@ -568,13 +579,7 @@ jobs: # END-TEST-BOILERPLATE - name: yarn test (SwingSet) if: (success() || failure()) - run: cd packages/SwingSet && yarn ${{ steps.vars.outputs.test }} 'test/**/[E-Ie-i]*' | $TEST_COLLECT - - name: yarn test (xsnap-lockdown) - if: (success() || failure()) - run: cd packages/xsnap-lockdown && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT - - name: yarn test (xsnap) - if: (success() || failure()) - run: cd packages/xsnap && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT + run: cd packages/SwingSet && yarn ${{ steps.vars.outputs.test }} | $TEST_COLLECT # explicitly test the XS worker, for visibility - name: yarn test (SwingSet XS Worker) if: (success() || failure()) && matrix.engine != 'xs' @@ -595,89 +600,6 @@ jobs: datadog-token: ${{ secrets.DATADOG_API_KEY }} codecov-token: ${{ secrets.CODECOV_TOKEN }} - test-swingset3: - # BEGIN-TEST-BOILERPLATE - timeout-minutes: 30 - needs: build - runs-on: ubuntu-latest - strategy: - matrix: - engine: ['18.x', '20.x', 'xs'] - steps: - - name: set vars - id: vars - run: | - echo "node-version=${{ matrix.engine == 'xs' && '18.x' || matrix.engine }}" >> $GITHUB_OUTPUT - echo "test=${{ matrix.engine == 'xs' && 'test:xs' || 'test' }}" >> $GITHUB_OUTPUT - echo "GH_ENGINE=${{ matrix.engine }}" >> $GITHUB_ENV - - uses: actions/checkout@v4 - - uses: ./.github/actions/restore-node - with: - node-version: ${{ steps.vars.outputs.node-version }} - id: restore-node - - run: echo "ENDO_BRANCH=${{ steps.restore-node.outputs.endo-branch }}" >> $GITHUB_ENV - # END-TEST-BOILERPLATE - - name: yarn test (SwingSet) - if: (success() || failure()) - run: cd packages/SwingSet && yarn ${{ steps.vars.outputs.test }} 'test/**/[J-Rj-r]*' | $TEST_COLLECT - - name: notify on failure - if: failure() && github.event_name != 'pull_request' - uses: ./.github/actions/notify-status - with: - webhook: ${{ secrets.SLACK_WEBHOOK_URL }} - from: ${{ secrets.NOTIFY_EMAIL_FROM }} - to: ${{ secrets.NOTIFY_EMAIL_TO }} - password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }} - - uses: ./.github/actions/post-test - if: (success() || failure()) - continue-on-error: true - timeout-minutes: 4 - with: - datadog-token: ${{ secrets.DATADOG_API_KEY }} - codecov-token: ${{ secrets.CODECOV_TOKEN }} - - test-swingset4: - # BEGIN-TEST-BOILERPLATE - timeout-minutes: 30 - needs: build - runs-on: ubuntu-latest - strategy: - matrix: - engine: ['18.x', '20.x', 'xs'] - steps: - - name: set vars - id: vars - run: | - echo "node-version=${{ matrix.engine == 'xs' && '18.x' || matrix.engine }}" >> $GITHUB_OUTPUT - echo "test=${{ matrix.engine == 'xs' && 'test:xs' || 'test' }}" >> $GITHUB_OUTPUT - echo "GH_ENGINE=${{ matrix.engine }}" >> $GITHUB_ENV - - uses: actions/checkout@v4 - - uses: ./.github/actions/restore-node - with: - node-version: ${{ steps.vars.outputs.node-version }} - id: restore-node - - run: echo "ENDO_BRANCH=${{ steps.restore-node.outputs.endo-branch }}" >> $GITHUB_ENV - # END-TEST-BOILERPLATE - - - name: yarn test (SwingSet) - if: (success() || failure()) - run: cd packages/SwingSet && yarn ${{ steps.vars.outputs.test }} 'test/**/[S-Zs-z0-9.test]*.js' | $TEST_COLLECT - - name: notify on failure - if: failure() && github.event_name != 'pull_request' - uses: ./.github/actions/notify-status - with: - webhook: ${{ secrets.SLACK_WEBHOOK_URL }} - from: ${{ secrets.NOTIFY_EMAIL_FROM }} - to: ${{ secrets.NOTIFY_EMAIL_TO }} - password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }} - - uses: ./.github/actions/post-test - if: (success() || failure()) - continue-on-error: true - timeout-minutes: 4 - with: - datadog-token: ${{ secrets.DATADOG_API_KEY }} - codecov-token: ${{ secrets.CODECOV_TOKEN }} - test-zoe-unit: # BEGIN-TEST-BOILERPLATE timeout-minutes: 30