Skip to content

Commit

Permalink
Debugging run
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Dec 4, 2024
1 parent 65fe72a commit a7b089e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 9 deletions.
42 changes: 37 additions & 5 deletions .github/workflows/test-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,48 @@ jobs:
run: yarn percy build:finalize

analyze-times:
needs: [tests, finalize]
# TODO: temporary comment-out with hardcoded sha
# needs: [tests, finalize]
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
defaults:
run:
working-directory: ui

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8

# Debug step to show environment
- name: Debug environment
run: |
echo "GITHUB_SHA: ${{ github.sha }}"
echo "GITHUB_EVENT_NAME: ${{ github.event_name }}"
echo "GITHUB_REF: ${{ github.ref }}"
echo "RUN_ID: ${{ github.run_id }}"
# Try to list available artifacts first
- name: List artifacts
uses: actions/github-script@v7

Check warning

Code scanning / GitHub Actions Scanner

Missing pinned commit hash for GitHub Actions configuration Warning test

found external action "actions/github-script@v7" without pinned version hash
with:
name: test-results-${{ github.sha }}
script: |
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
// run_id: context.runId
run_id: 12163157778
});
console.log('Available artifacts:');
console.log(JSON.stringify(artifacts.data, null, 2));
- name: Download current PR results
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
# name: test-results-${{ github.sha }}
name: pr-test-results-fe7ca11e9afc42bc98d79fe521155a37634bd232 # TODO: temporary hardcoded sha from previous run
path: ui

run-id: 12163157778
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Download historical results
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
Expand All @@ -161,7 +193,7 @@ jobs:
merge-multiple: true

- name: Analyze test times
run: node scripts/analyze-test-times.js
run: node ../scripts/analyze-ui-test-times.js

- name: Comment PR
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
Expand Down
8 changes: 4 additions & 4 deletions scripts/analyze-ui-test-times.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const fs = require('fs');

async function analyzeTestTimes() {
const currentResults = JSON.parse(
fs.readFileSync('../ui/combined-test-results.json')
fs.readFileSync('combined-test-results.json')
);

// Create a map of test names to their durations
Expand All @@ -25,11 +25,11 @@ async function analyzeTestTimes() {

// Read each historical result file
console.log('[analyze-test-times] Reading historical results directory...\n');
const historicalFiles = fs.readdirSync('../historical-results');
const historicalFiles = fs.readdirSync('historical-results');
historicalFiles.forEach((file, index) => {
console.log(`[analyze-test-times] Reading ${file} (${index + 1} of ${historicalFiles.length})...`);
const historical = JSON.parse(
fs.readFileSync(`../historical-results/${file}`)
fs.readFileSync(`historical-results/${file}`)
);

if (historical.summary.failed === 0) {
Expand Down Expand Up @@ -86,7 +86,7 @@ async function analyzeTestTimes() {

// Write analysis results
fs.writeFileSync(
'../ui/test-time-analysis.json',
'test-time-analysis.json',
JSON.stringify(analysis, null, 2)
);

Expand Down

0 comments on commit a7b089e

Please sign in to comment.