Skip to content

Commit

Permalink
Add artifacts upload for the performance tests (#48243)
Browse files Browse the repository at this point in the history
  • Loading branch information
WunderBart authored Mar 2, 2023
1 parent 9f09b41 commit 3da0e84
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 13 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ jobs:
WP_MAJOR="${WP_VERSION_ARRAY[0]}.${WP_VERSION_ARRAY[1]}"
./bin/plugin/cli.js perf $GITHUB_SHA debd225d007f4e441ceec80fbd6fa96653f94737 --tests-branch $GITHUB_SHA --wp-version "$WP_MAJOR"
- uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
if: github.event_name == 'push'
id: commit-timestamp
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const commit_details = await github.rest.git.getCommit({owner: context.repo.owner, repo: context.repo.repo, commit_sha: context.sha});
return parseInt((new Date( commit_details.data.author.date ).getTime() / 1000).toFixed(0))
- name: Compare performance with custom branches
if: github.event_name == 'workflow_dispatch'
env:
Expand All @@ -103,9 +94,27 @@ jobs:
run: |
./bin/plugin/cli.js perf $(echo $BRANCHES | tr ',' ' ') --tests-branch $GITHUB_SHA --wp-version "$WP_VERSION"
- name: Get commit timestamp
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
if: github.event_name == 'push'
id: commit-timestamp
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const commit_details = await github.rest.git.getCommit({owner: context.repo.owner, repo: context.repo.repo, commit_sha: context.sha});
return parseInt((new Date( commit_details.data.author.date ).getTime() / 1000).toFixed(0))
- name: Publish performance results
if: github.event_name == 'push'
env:
COMMITTED_AT: ${{ steps.commit-timestamp.outputs.result }}
CODEHEALTH_PROJECT_TOKEN: ${{ secrets.CODEHEALTH_PROJECT_TOKEN }}
run: ./bin/log-performance-results.js $CODEHEALTH_PROJECT_TOKEN trunk $GITHUB_SHA debd225d007f4e441ceec80fbd6fa96653f94737 $COMMITTED_AT

- name: Archive debug artifacts (screenshots, HTML snapshots)
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: always()
with:
name: failures-artifacts
path: ./__test-results/artifacts
if-no-files-found: ignore
23 changes: 19 additions & 4 deletions bin/plugin/commands/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,24 @@ function curateResults( testSuite, results ) {
* @return {Promise<WPPerformanceResults>} Performance results for the branch.
*/
async function runTestSuite( testSuite, performanceTestDirectory, runKey ) {
await runShellScript(
`npm run test:performance -- packages/e2e-tests/specs/performance/${ testSuite }.test.js`,
performanceTestDirectory
);
try {
await runShellScript(
`npm run test:performance -- packages/e2e-tests/specs/performance/${ testSuite }.test.js`,
performanceTestDirectory
);
} catch ( error ) {
fs.mkdirSync( './__test-results/artifacts', { recursive: true } );
const artifactsFolder = path.join(
performanceTestDirectory,
'artifacts/'
);
await runShellScript(
'cp -Rv ' + artifactsFolder + ' ' + './__test-results/artifacts/'
);

throw error;
}

const resultsFile = path.join(
performanceTestDirectory,
`packages/e2e-tests/specs/performance/${ testSuite }.test.results.json`
Expand All @@ -198,6 +212,7 @@ async function runTestSuite( testSuite, performanceTestDirectory, runKey ) {
`packages/e2e-tests/specs/performance/${ testSuite }.test.results.json`
)
);

return curateResults( testSuite, rawResults );
}

Expand Down

1 comment on commit 3da0e84

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 3da0e84.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4312745081
📝 Reported issues:

Please sign in to comment.