Skip to content

Commit

Permalink
Revert "uses shard to get the perf report"
Browse files Browse the repository at this point in the history
This reverts commit f8f7b45.
  • Loading branch information
mohanrajpac committed Mar 14, 2024
1 parent 069e1d3 commit 9d354a9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 40 deletions.
78 changes: 39 additions & 39 deletions .github/workflows/perf-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ jobs:
performance-tests:
name: 'Performance Tests'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [ 1/4, 2/4, 3/4, 4/4 ]
env:
WP_BASE_URL: 'http://localhost:8888'
WP_USERNAME: 'admin'
Expand Down Expand Up @@ -55,45 +51,49 @@ jobs:

- name: Run tests
run: |
yarn test:performance --shard ${{ matrix.shard }}
yarn test:performance
mv ${{ env.WP_ARTIFACTS_PATH }}/performance-results.json ${{ runner.temp }}/results_after.json
- name: Upload blob report to GitHub Actions Artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: all-blob-reports
path: blob-report
retention-days: 1

merge-reports:
# Merge reports after playwright-tests, even if some shards have failed
if: always()
needs: [ performance-tests ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: yarn
- name: Check out base commit
run: |
if [[ -z "$BASE_REF" ]]; then
git fetch -n origin $BASE_SHA
git reset --hard $BASE_SHA
else
git fetch -n origin $BASE_REF
git reset --hard $BASE_SHA
fi
env:
BASE_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || '' }}
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}

# Run tests without causing job to fail if they don't pass (e.g. because of env issues).
- name: Run tests for base
run: |
npm run test:performance || true
if [ -f "{{ env.WP_ARTIFACTS_PATH }}/performance-results.json" ]; then
mv ${{ env.WP_ARTIFACTS_PATH }}/performance-results.json ${{ runner.temp }}/results_before.json
fi;
- name: Install dependencies
run: yarn install --immutable
- name: Reset to original commit
run: |
git reset --hard $GITHUB_SHA
- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
name: all-blob-reports
path: all-blob-reports
- name: Compare results with base
run: |
if [ -f "${{ runner.temp }}/results_before.json" ]; then
yarn test:performance:results ${{ runner.temp }}/results_after.json ${{ runner.temp }}/results_before.json
else
yarn test:performance:results ${{ runner.temp }}/results_after.json
fi;
- name: Merge into single performance report
run: yarn test:performance:merge-reports
- name: Add workflow summary
run: |
cat ${{ env.WP_ARTIFACTS_PATH }}/performance-results.md >> $GITHUB_STEP_SUMMARY
- name: Upload performance report
- name: Upload performance results
if: success()
uses: actions/upload-artifact@v4
with:
name: performance-report-${{ github.run_attempt }}
path: artifacts/performance-results.json
retention-days: 14
name: performance-results
path: ${{ env.WP_ARTIFACTS_PATH }}/performance-results.json
2 changes: 1 addition & 1 deletion tests/performance/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ process.env.STORAGE_STATE_PATH ??= join(
process.env.WP_ARTIFACTS_PATH,
authStoragePath
);
process.env.TEST_ITERATIONS ??= '20';
process.env.TEST_ITERATIONS ??= '4';

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

0 comments on commit 9d354a9

Please sign in to comment.