[ci] Add devtools regression workflow
More or less a straight copy from the circleci config. I spotted some inefficiencies but will fix those later to make reviewing this easier. ghstack-source-id: cb3456c602bf0bd3cb6ef5862ecac6b8d6e99e0b Pull Request resolved: https://github.com/facebook/react/pull/30406
Lauren Tan committed
Jul 25, 2024 at 17:20 UTC
fe225e3a1fc3aefc97d5bc535aeae8ebae0666fb
1 file changed
+171
.github/workflows/devtools_regression_tests.yml
new
+171
@@ -0,0 +1,171 @@
1
+name: (DevTools) Regression Tests
2
+
3
+on:
4
+ schedule:
5
+ - cron: 0 0 * * *
6
+ workflow_dispatch:
7
+ inputs:
8
+ prerelease_commit_sha:
9
+ required: false
10
+
11
+env:
12
+ TZ: /usr/share/zoneinfo/America/Los_Angeles
13
+
14
+jobs:
15
+ download_build:
16
+ if: inputs.prerelease_commit_sha == ''
17
+ name: Download base build
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: actions/setup-node@v4
22
+ with:
23
+ node-version: 18.20.1
24
+ cache: yarn
25
+ cache-dependency-path: yarn.lock
26
+ - name: Restore cached node_modules
27
+ uses: actions/cache@v4
28
+ id: node_modules
29
+ with:
30
+ path: "**/node_modules"
31
+ key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock', 'scripts/release/yarn.lock') }}
32
+ - run: yarn install --frozen-lockfile
33
+ - run: yarn install --frozen-lockfile
34
+ working-directory: scripts/release
35
+ - name: Download react-devtools artifacts for base revision
36
+ run: |
37
+ git fetch origin main
38
+ GH_TOKEN=${{ github.token }} scripts/release/download-experimental-build-ghaction.js --commit=$(git rev-parse origin/main)
39
+ - name: Display structure of build
40
+ run: ls -R build
41
+ - name: Archive build
42
+ uses: actions/upload-artifact@v4
43
+ with:
44
+ name: build
45
+ path: build
46
+
47
+ build_devtools_and_process_artifacts:
48
+ name: Build DevTools and process artifacts
49
+ needs: download_build
50
+ runs-on: ubuntu-latest
51
+ steps:
52
+ - uses: actions/checkout@v4
53
+ - uses: actions/setup-node@v4
54
+ with:
55
+ node-version: 18.20.1
56
+ cache: yarn
57
+ cache-dependency-path: yarn.lock
58
+ - name: Restore cached node_modules
59
+ uses: actions/cache@v4
60
+ id: node_modules
61
+ with:
62
+ path: "**/node_modules"
63
+ key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
64
+ - run: yarn install --frozen-lockfile
65
+ - name: Restore archived build
66
+ uses: actions/download-artifact@v4
67
+ with:
68
+ name: build
69
+ path: build
70
+ - run: ./scripts/circleci/pack_and_store_devtools_artifacts.sh
71
+ env:
72
+ RELEASE_CHANNEL: experimental
73
+ - name: Display structure of build
74
+ run: ls -R build
75
+ - name: Archive devtools build
76
+ uses: actions/upload-artifact@v4
77
+ with:
78
+ name: react-devtools
79
+ path: build/devtools.tgz
80
+ # Simplifies getting the extension for local testing
81
+ - name: Archive chrome extension
82
+ uses: actions/upload-artifact@v4
83
+ with:
84
+ name: react-devtools-chrome-extension
85
+ path: build/devtools/chrome-extension.zip
86
+ - name: Archive firefox extension
87
+ uses: actions/upload-artifact@v4
88
+ with:
89
+ name: react-devtools-firefox-extension
90
+ path: build/devtools/firefox-extension.zip
91
+
92
+ run_devtools_tests_for_versions:
93
+ name: Run DevTools tests for versions
94
+ needs: build_devtools_and_process_artifacts
95
+ runs-on: ubuntu-latest
96
+ strategy:
97
+ matrix:
98
+ version:
99
+ - "16.0"
100
+ - "16.5" # schedule package
101
+ - "16.8" # hooks
102
+ - "17.0"
103
+ - "18.0"
104
+ continue-on-error: true
105
+ steps:
106
+ - uses: actions/checkout@v4
107
+ - uses: actions/setup-node@v4
108
+ with:
109
+ node-version: 18.20.1
110
+ cache: yarn
111
+ cache-dependency-path: yarn.lock
112
+ - name: Restore cached node_modules
113
+ uses: actions/cache@v4
114
+ id: node_modules
115
+ with:
116
+ path: "**/node_modules"
117
+ key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
118
+ - run: yarn install --frozen-lockfile
119
+ - name: Restore all archived build artifacts
120
+ uses: actions/download-artifact@v4
121
+ - name: Display structure of build
122
+ run: ls -R build
123
+ - run: ./scripts/circleci/download_devtools_regression_build.js ${{ matrix.version }} --replaceBuild
124
+ - run: node ./scripts/jest/jest-cli.js --build --project devtools --release-channel=experimental --reactVersion ${{ matrix.version }} --ci=github
125
+
126
+ run_devtools_e2e_tests_for_versions:
127
+ name: Run DevTools e2e tests for versions
128
+ needs: build_devtools_and_process_artifacts
129
+ runs-on: ubuntu-latest
130
+ strategy:
131
+ matrix:
132
+ version:
133
+ - "16.0"
134
+ - "16.5" # schedule package
135
+ - "16.8" # hooks
136
+ - "17.0"
137
+ - "18.0"
138
+ continue-on-error: true
139
+ steps:
140
+ - uses: actions/checkout@v4
141
+ - uses: actions/setup-node@v4
142
+ with:
143
+ node-version: 18.20.1
144
+ cache: yarn
145
+ cache-dependency-path: yarn.lock
146
+ - name: Restore cached node_modules
147
+ uses: actions/cache@v4
148
+ id: node_modules
149
+ with:
150
+ path: "**/node_modules"
151
+ key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
152
+ - run: yarn install --frozen-lockfile
153
+ - name: Restore all archived build artifacts
154
+ uses: actions/download-artifact@v4
155
+ - name: Display structure of build
156
+ run: ls -R build
157
+ - name: Playwright install deps
158
+ run: |
159
+ npx playwright install
160
+ sudo npx playwright install-deps
161
+ - run: ./scripts/circleci/download_devtools_regression_build.js ${{ matrix.version }}
162
+ - run: ls -R build-regression
163
+ - run: ./scripts/circleci/run_devtools_e2e_tests.js ${{ matrix.version }}
164
+ env:
165
+ RELEASE_CHANNEL: experimental
166
+ - name: Cleanup build regression folder
167
+ run: rm -r ./build-regression
168
+ - uses: actions/upload-artifact@v4
169
+ with:
170
+ name: screenshots
171
+ path: ./tmp/screenshots