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