Skip to content

Commit 9d354a9

Browse files
committed
Revert "uses shard to get the perf report"
This reverts commit f8f7b45.
1 parent 069e1d3 commit 9d354a9

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

.github/workflows/perf-tests.yml

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ jobs:
99
performance-tests:
1010
name: 'Performance Tests'
1111
runs-on: ubuntu-latest
12-
strategy:
13-
fail-fast: false
14-
matrix:
15-
shard: [ 1/4, 2/4, 3/4, 4/4 ]
1612
env:
1713
WP_BASE_URL: 'http://localhost:8888'
1814
WP_USERNAME: 'admin'
@@ -55,45 +51,49 @@ jobs:
5551

5652
- name: Run tests
5753
run: |
58-
yarn test:performance --shard ${{ matrix.shard }}
54+
yarn test:performance
55+
mv ${{ env.WP_ARTIFACTS_PATH }}/performance-results.json ${{ runner.temp }}/results_after.json
5956
60-
- name: Upload blob report to GitHub Actions Artifacts
61-
if: always()
62-
uses: actions/upload-artifact@v4
63-
with:
64-
name: all-blob-reports
65-
path: blob-report
66-
retention-days: 1
67-
68-
merge-reports:
69-
# Merge reports after playwright-tests, even if some shards have failed
70-
if: always()
71-
needs: [ performance-tests ]
72-
runs-on: ubuntu-latest
73-
steps:
74-
- uses: actions/checkout@v4
75-
76-
- name: Setup Node
77-
uses: actions/setup-node@v4
78-
with:
79-
node-version-file: '.nvmrc'
80-
cache: yarn
57+
- name: Check out base commit
58+
run: |
59+
if [[ -z "$BASE_REF" ]]; then
60+
git fetch -n origin $BASE_SHA
61+
git reset --hard $BASE_SHA
62+
else
63+
git fetch -n origin $BASE_REF
64+
git reset --hard $BASE_SHA
65+
fi
66+
env:
67+
BASE_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || '' }}
68+
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
69+
70+
# Run tests without causing job to fail if they don't pass (e.g. because of env issues).
71+
- name: Run tests for base
72+
run: |
73+
npm run test:performance || true
74+
if [ -f "{{ env.WP_ARTIFACTS_PATH }}/performance-results.json" ]; then
75+
mv ${{ env.WP_ARTIFACTS_PATH }}/performance-results.json ${{ runner.temp }}/results_before.json
76+
fi;
8177
82-
- name: Install dependencies
83-
run: yarn install --immutable
78+
- name: Reset to original commit
79+
run: |
80+
git reset --hard $GITHUB_SHA
8481
85-
- name: Download blob reports from GitHub Actions Artifacts
86-
uses: actions/download-artifact@v4
87-
with:
88-
name: all-blob-reports
89-
path: all-blob-reports
82+
- name: Compare results with base
83+
run: |
84+
if [ -f "${{ runner.temp }}/results_before.json" ]; then
85+
yarn test:performance:results ${{ runner.temp }}/results_after.json ${{ runner.temp }}/results_before.json
86+
else
87+
yarn test:performance:results ${{ runner.temp }}/results_after.json
88+
fi;
9089
91-
- name: Merge into single performance report
92-
run: yarn test:performance:merge-reports
90+
- name: Add workflow summary
91+
run: |
92+
cat ${{ env.WP_ARTIFACTS_PATH }}/performance-results.md >> $GITHUB_STEP_SUMMARY
9393
94-
- name: Upload performance report
94+
- name: Upload performance results
95+
if: success()
9596
uses: actions/upload-artifact@v4
9697
with:
97-
name: performance-report-${{ github.run_attempt }}
98-
path: artifacts/performance-results.json
99-
retention-days: 14
98+
name: performance-results
99+
path: ${{ env.WP_ARTIFACTS_PATH }}/performance-results.json

tests/performance/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ process.env.STORAGE_STATE_PATH ??= join(
1313
process.env.WP_ARTIFACTS_PATH,
1414
authStoragePath
1515
);
16-
process.env.TEST_ITERATIONS ??= '20';
16+
process.env.TEST_ITERATIONS ??= '4';
1717

1818
const config = defineConfig({
1919
globalSetup: require.resolve('../e2e/global-setup.ts'),

0 commit comments

Comments
 (0)