|
1 | 1 | name: Browser Performance Tests |
2 | 2 |
|
3 | 3 | on: |
4 | | - pull_request: |
5 | | - types: [opened, synchronize, reopened] |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, reopened] |
6 | 6 |
|
7 | 7 | permissions: |
8 | | - contents: read |
9 | | - pull-requests: write |
| 8 | + contents: read |
| 9 | + pull-requests: write |
10 | 10 |
|
11 | 11 | jobs: |
12 | | - test-changed-packages: |
13 | | - strategy: |
14 | | - matrix: |
15 | | - browser: [firefox, chrome] |
16 | | - name: Compare performance to latest release on ${{ matrix.browser }} |
17 | | - |
18 | | - # The job will only run if the pull request is from the same repository. |
19 | | - # Benchmarks can't run on PRs from forked repos due to comment posting restrictions without a GitHub token. |
20 | | - if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} |
21 | | - runs-on: ubuntu-22.04 |
22 | | - steps: |
23 | | - - name: Checkout main |
24 | | - uses: actions/checkout@v4 |
25 | | - with: |
26 | | - ref: main |
27 | | - |
28 | | - - name: Checkout PR branch |
29 | | - uses: actions/checkout@v4 |
30 | | - with: |
31 | | - fetch-depth: 0 # Get full history |
32 | | - |
33 | | - - name: Fetch main branch |
34 | | - run: | |
35 | | - git fetch origin main:main |
36 | | -
|
37 | | - - name: Setup Job and Install Dependencies |
38 | | - uses: ./.github/actions/setup-job |
39 | | - |
40 | | - - name: Check ChromeDriver Version |
41 | | - if: matrix.browser == 'chrome' |
42 | | - run: | |
43 | | - echo "Checking ChromeDriver version..." |
44 | | - npx chromedriver --version |
45 | | - echo "Checking Chrome version..." |
46 | | - google-chrome --version |
47 | | - echo "Checking tachometer chromedriver version..." |
48 | | - yarn tachometer --version |
49 | | -
|
50 | | - - name: Tachometer the changed packages |
51 | | - run: yarn test:changed --browser=${{ matrix.browser }} |
52 | | - |
53 | | - - name: Create a dummy file to ensure at least one results file exists |
54 | | - run: touch tachometer.${{ matrix.browser }}-ran.txt |
55 | | - |
56 | | - - name: Archive ${{ matrix.browser }} tachometer results |
57 | | - id: upload-artifact |
58 | | - uses: actions/upload-artifact@v4 |
59 | | - with: |
60 | | - name: tachometer-results-${{ matrix.browser }} |
61 | | - path: | |
62 | | - tach-results.${{ matrix.browser }}.*.json |
63 | | - tachometer.${{ matrix.browser }}-ran.txt |
64 | | -
|
65 | | - comment-performance: |
66 | | - name: Comment tachometer performance results |
67 | | - needs: [test-changed-packages] |
68 | | - |
69 | | - # The job will only run if the pull request is from the same repository. |
70 | | - # Benchmarks can't run on PRs from forked repos due to comment posting restrictions without a GitHub token. |
71 | | - if: ${{ github.event.pull_request == null || github.event.pull_request.head.repo.full_name == github.repository }} |
72 | | - runs-on: ubuntu-latest |
73 | | - steps: |
74 | | - - name: Checkout main |
75 | | - uses: actions/checkout@v4 |
76 | | - with: |
77 | | - ref: main |
78 | | - |
79 | | - - name: Checkout PR branch |
80 | | - uses: actions/checkout@v4 |
81 | | - with: |
82 | | - fetch-depth: 2 |
83 | | - |
84 | | - - name: Setup Job and Install Dependencies |
85 | | - uses: ./.github/actions/setup-job |
86 | | - |
87 | | - - uses: actions/download-artifact@v4 |
88 | | - with: |
89 | | - pattern: tachometer-results-* |
90 | | - merge-multiple: true |
91 | | - |
92 | | - - name: Post Tachometer Performance Comment |
93 | | - uses: actions/github-script@v7 |
94 | | - with: |
95 | | - script: | |
96 | | - const { buildTachometerComment } = await import('${{ github.workspace }}/.github/scripts/build-tachometer-comment.js'); |
97 | | - const { commentOrUpdate } = await import('${{ github.workspace }}/.github/scripts/comment-or-update.js'); |
98 | | - const body = buildTachometerComment(); |
99 | | - commentOrUpdate(github, context, '## Tachometer results', body); |
| 12 | + test-changed-packages: |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + browser: [firefox, chrome] |
| 16 | + name: Compare performance to latest release on ${{ matrix.browser }} |
| 17 | + |
| 18 | + # The job will only run if the pull request is from the same repository. |
| 19 | + # Benchmarks can't run on PRs from forked repos due to comment posting restrictions without a GitHub token. |
| 20 | + if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} |
| 21 | + runs-on: ubuntu-22.04 |
| 22 | + steps: |
| 23 | + - name: Checkout main |
| 24 | + uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + ref: main |
| 27 | + |
| 28 | + - name: Checkout PR branch |
| 29 | + uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + fetch-depth: 0 # Get full history |
| 32 | + |
| 33 | + - name: Fetch main branch |
| 34 | + run: | |
| 35 | + git fetch origin main:main |
| 36 | +
|
| 37 | + - name: Setup Job and Install Dependencies |
| 38 | + uses: ./.github/actions/setup-job |
| 39 | + |
| 40 | + - name: Check ChromeDriver Version |
| 41 | + if: matrix.browser == 'chrome' |
| 42 | + run: | |
| 43 | + echo "Checking ChromeDriver version..." |
| 44 | + npx chromedriver --version |
| 45 | + echo "Checking Chrome version..." |
| 46 | + google-chrome --version |
| 47 | + echo "Checking tachometer chromedriver version..." |
| 48 | + cd 1st-gen && yarn tachometer --version |
| 49 | +
|
| 50 | + - name: Tachometer the changed packages |
| 51 | + run: cd 1st-gen && yarn test:changed --browser=${{ matrix.browser }} |
| 52 | + |
| 53 | + - name: Create a dummy file to ensure at least one results file exists |
| 54 | + run: touch 1st-gen/tachometer.${{ matrix.browser }}-ran.txt |
| 55 | + |
| 56 | + - name: Archive ${{ matrix.browser }} tachometer results |
| 57 | + id: upload-artifact |
| 58 | + uses: actions/upload-artifact@v4 |
| 59 | + with: |
| 60 | + name: tachometer-results-${{ matrix.browser }} |
| 61 | + path: | |
| 62 | + 1st-gen/tach-results.${{ matrix.browser }}.*.json |
| 63 | + 1st-gen/tachometer.${{ matrix.browser }}-ran.txt |
| 64 | +
|
| 65 | + comment-performance: |
| 66 | + name: Comment tachometer performance results |
| 67 | + needs: [test-changed-packages] |
| 68 | + |
| 69 | + # The job will only run if the pull request is from the same repository. |
| 70 | + # Benchmarks can't run on PRs from forked repos due to comment posting restrictions without a GitHub token. |
| 71 | + if: ${{ github.event.pull_request == null || github.event.pull_request.head.repo.full_name == github.repository }} |
| 72 | + runs-on: ubuntu-latest |
| 73 | + steps: |
| 74 | + - name: Checkout main |
| 75 | + uses: actions/checkout@v4 |
| 76 | + with: |
| 77 | + ref: main |
| 78 | + |
| 79 | + - name: Checkout PR branch |
| 80 | + uses: actions/checkout@v4 |
| 81 | + with: |
| 82 | + fetch-depth: 2 |
| 83 | + |
| 84 | + - name: Setup Job and Install Dependencies |
| 85 | + uses: ./.github/actions/setup-job |
| 86 | + |
| 87 | + - uses: actions/download-artifact@v4 |
| 88 | + with: |
| 89 | + pattern: tachometer-results-* |
| 90 | + merge-multiple: true |
| 91 | + |
| 92 | + - name: Post Tachometer Performance Comment |
| 93 | + uses: actions/github-script@v7 |
| 94 | + with: |
| 95 | + script: | |
| 96 | + const { buildTachometerComment } = await import('${{ github.workspace }}/.github/scripts/build-tachometer-comment.js'); |
| 97 | + const { commentOrUpdate } = await import('${{ github.workspace }}/.github/scripts/comment-or-update.js'); |
| 98 | + const body = buildTachometerComment(); |
| 99 | + commentOrUpdate(github, context, '## Tachometer results', body); |
0 commit comments