Skip to content

Commit

Permalink
retain artifacts from test runs including test timing
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Nov 26, 2024
1 parent 1f29a95 commit acdd210
Showing 1 changed file with 48 additions and 4 deletions.
52 changes: 48 additions & 4 deletions .github/workflows/test-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: test-ui
on:
pull_request:
paths:
- 'ui/**'
- "ui/**"
push:
branches:
- main
- release/**
- test-ui
paths:
- 'ui/**'
- "ui/**"

jobs:
pre-test:
Expand Down Expand Up @@ -44,6 +44,8 @@ jobs:
matrix:
partition: [1, 2, 3, 4]
split: [4]
# Note: If we ever change the number of partitions, we'll need to update the
# finalize.combine step to match
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./.github/actions/setup-js
Expand All @@ -63,8 +65,16 @@ jobs:
env:
PERCY_TOKEN: ${{ env.PERCY_TOKEN || secrets.PERCY_TOKEN }}
PERCY_PARALLEL_NONCE: ${{ needs.pre-test.outputs.nonce }}
run: yarn exam:parallel --split=${{ matrix.split }} --partition=${{ matrix.partition }}

# run: yarn exam:parallel --split=${{ matrix.split }} --partition=${{ matrix.partition }}
run: |
yarn exam:parallel --split=${{ matrix.split }} --partition=${{ matrix.partition }} --json-report=test-results-${{ matrix.partition }}.json
- name: Upload partition test results
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4

Check warning

Code scanning / GitHub Actions Scanner

Missing pinned commit hash for GitHub Actions configuration Warning test

found external action "actions/upload-artifact@v4" without pinned version hash
with:
name: test-results-partition-${{ matrix.partition }}
path: ui/test-results-${{ matrix.partition }}.json
retention-days: 90
finalize:
needs:
- pre-test
Expand All @@ -88,6 +98,40 @@ jobs:
jwtGithubAudience: ${{ vars.CI_VAULT_AUD }}
secrets: |-
kv/data/teams/nomad/ui PERCY_TOKEN ;
- name: Download all test results
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/download-artifact@v4

Check warning

Code scanning / GitHub Actions Scanner

Missing pinned commit hash for GitHub Actions configuration Warning test

found external action "actions/download-artifact@v4" without pinned version hash
with:
pattern: test-results-partition-*
path: test-results

- name: Combine test results for comparison
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# Note: iterator is hardcoded to 4 to match matrix partitions
run: |
node -e "
const fs = require('fs');
const results = [];
for (let i = 1; i <= 4; i++) {
const filePath = 'test-results/test-results-partition-' + i + '/test-results-' + i + '.json';
const data = JSON.parse(fs.readFileSync(filePath));
results.push(...data.testResults);
}
fs.writeFileSync('combined-test-results.json', JSON.stringify({
timestamp: new Date().toISOString(),
sha: process.env.GITHUB_SHA,
testResults: results
}, null, 2));
"
- name: Upload combined results for comparison
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4

Check warning

Code scanning / GitHub Actions Scanner

Missing pinned commit hash for GitHub Actions configuration Warning test

found external action "actions/upload-artifact@v4" without pinned version hash
with:
name: test-results-${{ github.sha }}
path: combined-test-results.json
retention-days: 90

- name: finalize
env:
PERCY_TOKEN: ${{ env.PERCY_TOKEN || secrets.PERCY_TOKEN }}
Expand Down

0 comments on commit acdd210

Please sign in to comment.