|
| 1 | +name: facebook/react/build_and_test |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + branches: |
| 5 | + - '!builds/facebook-www' |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + prerelease_commit_sha: |
| 9 | + required: false |
| 10 | +jobs: |
| 11 | + yarn_flow: |
| 12 | + if: inputs.prerelease_commit_sha == '' && github.ref != 'refs/heads/builds/facebook-www' |
| 13 | + runs-on: ubuntu-latest |
| 14 | + env: |
| 15 | + TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 16 | + steps: |
| 17 | + |
| 18 | + - uses: actions/setup-node@v4 |
| 19 | + with: |
| 20 | + node-version: '16' |
| 21 | + cache: 'yarn' |
| 22 | + - uses: "./.github/actions/setup_node_modules" |
| 23 | + - run: node ./scripts/tasks/flow-ci |
| 24 | + check_generated_fizz_runtime: |
| 25 | + if: inputs.prerelease_commit_sha == '' && github.ref != 'refs/heads/builds/facebook-www' |
| 26 | + runs-on: ubuntu-latest |
| 27 | + env: |
| 28 | + TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 29 | + steps: |
| 30 | + |
| 31 | + - uses: actions/setup-node@v4 |
| 32 | + with: |
| 33 | + node-version: '16' |
| 34 | + cache: 'yarn' |
| 35 | + |
| 36 | + with: |
| 37 | + path: build |
| 38 | + - uses: "./.github/actions/setup_node_modules" |
| 39 | + - name: Confirm generated inline Fizz runtime is up to date |
| 40 | + run: |- |
| 41 | + yarn generate-inline-fizz-runtime |
| 42 | + git diff --quiet || (echo "There was a change to the Fizz runtime. Run `yarn generate-inline-fizz-runtime` and check in the result." && false) |
| 43 | + yarn_lint: |
| 44 | + if: inputs.prerelease_commit_sha == '' && github.ref != 'refs/heads/builds/facebook-www' |
| 45 | + runs-on: ubuntu-latest |
| 46 | + env: |
| 47 | + TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 48 | + steps: |
| 49 | + |
| 50 | + - uses: actions/setup-node@v4 |
| 51 | + with: |
| 52 | + node-version: '16' |
| 53 | + cache: 'yarn' |
| 54 | + - uses: "./.github/actions/setup_node_modules" |
| 55 | + - run: node ./scripts/prettier/index |
| 56 | + - run: node ./scripts/tasks/eslint |
| 57 | + - run: "./scripts/circleci/check_license.sh" |
| 58 | + - run: "./scripts/circleci/check_modules.sh" |
| 59 | + - run: "./scripts/circleci/test_print_warnings.sh" |
| 60 | + yarn_test: |
| 61 | + if: inputs.prerelease_commit_sha == '' && github.ref != 'refs/heads/builds/facebook-www' |
| 62 | + runs-on: ubuntu-latest |
| 63 | + env: |
| 64 | + TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 65 | + strategy: |
| 66 | + fail-fast: false |
| 67 | + matrix: |
| 68 | + args: |
| 69 | + - "-r=stable --env=development" |
| 70 | + - "-r=stable --env=production" |
| 71 | + - "-r=experimental --env=development" |
| 72 | + - "-r=experimental --env=production" |
| 73 | + - "-r=www-classic --env=development --variant=false" |
| 74 | + - "-r=www-classic --env=production --variant=false" |
| 75 | + - "-r=www-classic --env=development --variant=true" |
| 76 | + - "-r=www-classic --env=production --variant=true" |
| 77 | + - "-r=www-modern --env=development --variant=false" |
| 78 | + - "-r=www-modern --env=production --variant=false" |
| 79 | + - "-r=www-modern --env=development --variant=true" |
| 80 | + - "-r=www-modern --env=production --variant=true" |
| 81 | + - "-r=stable --env=development --persistent" |
| 82 | + - "-r=experimental --env=development --persistent" |
| 83 | + steps: |
| 84 | + |
| 85 | + - uses: actions/setup-node@v4 |
| 86 | + with: |
| 87 | + node-version: '16' |
| 88 | + cache: 'yarn' |
| 89 | + - uses: "./.github/actions/setup_node_modules" |
| 90 | + - run: yarn test ${{ matrix.args }} --ci |
| 91 | + yarn_build: |
| 92 | + if: inputs.prerelease_commit_sha == '' && github.ref != 'refs/heads/builds/facebook-www' |
| 93 | + runs-on: ubuntu-latest |
| 94 | + env: |
| 95 | + TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 96 | + steps: |
| 97 | + |
| 98 | + - uses: actions/setup-node@v4 |
| 99 | + with: |
| 100 | + node-version: '16' |
| 101 | + cache: 'yarn' |
| 102 | + - uses: "./.github/actions/setup_node_modules" |
| 103 | + - run: yarn build |
| 104 | + |
| 105 | + with: |
| 106 | + name: yarn-build |
| 107 | + path: build |
| 108 | + scrape_warning_messages: |
| 109 | + if: inputs.prerelease_commit_sha == '' && github.ref != 'refs/heads/builds/facebook-www' |
| 110 | + runs-on: ubuntu-latest |
| 111 | + env: |
| 112 | + TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 113 | + steps: |
| 114 | + |
| 115 | + - uses: actions/setup-node@v4 |
| 116 | + with: |
| 117 | + node-version: '16' |
| 118 | + cache: 'yarn' |
| 119 | + - uses: "./.github/actions/setup_node_modules" |
| 120 | + - run: |- |
| 121 | + mkdir -p ./build |
| 122 | + node ./scripts/print-warnings/print-warnings.js > build/WARNINGS |
| 123 | + |
| 124 | + with: |
| 125 | + name: yarn-build |
| 126 | + path: build |
| 127 | + process_artifacts_combined: |
| 128 | + if: inputs.prerelease_commit_sha == '' |
| 129 | + runs-on: ubuntu-latest |
| 130 | + needs: |
| 131 | + - scrape_warning_messages |
| 132 | + - yarn_build |
| 133 | + env: |
| 134 | + TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 135 | + steps: |
| 136 | + |
| 137 | + - uses: actions/setup-node@v4 |
| 138 | + with: |
| 139 | + node-version: '16' |
| 140 | + cache: 'yarn' |
| 141 | + |
| 142 | + with: |
| 143 | + name: yarn-build |
| 144 | + path: build |
| 145 | + - uses: "./.github/actions/setup_node_modules" |
| 146 | + - run: echo "$GITHUB_SHA" >> build/COMMIT_SHA |
| 147 | + - run: tar -zcvf ./build.tgz ./build |
| 148 | + - run: cp ./build.tgz ./build2.tgz |
| 149 | + |
| 150 | + with: |
| 151 | + name: combined-artifacts2 |
| 152 | + path: "./build2.tgz" |
| 153 | + |
| 154 | + with: |
| 155 | + name: combined-artifacts |
| 156 | + path: "./build.tgz" |
| 157 | + yarn_test_build: |
| 158 | + if: inputs.prerelease_commit_sha == '' |
| 159 | + runs-on: ubuntu-latest |
| 160 | + needs: |
| 161 | + - yarn_build |
| 162 | + env: |
| 163 | + TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 164 | + strategy: |
| 165 | + fail-fast: false |
| 166 | + matrix: |
| 167 | + args: |
| 168 | + - "-r=stable --env=development" |
| 169 | + - "-r=stable --env=production" |
| 170 | + - "-r=experimental --env=development" |
| 171 | + - "-r=experimental --env=production" |
| 172 | + - "--project=devtools -r=experimental" |
| 173 | + steps: |
| 174 | + |
| 175 | + - uses: actions/setup-node@v4 |
| 176 | + with: |
| 177 | + node-version: '16' |
| 178 | + cache: 'yarn' |
| 179 | + |
| 180 | + with: |
| 181 | + name: yarn-build |
| 182 | + path: build |
| 183 | + - uses: "./.github/actions/setup_node_modules" |
| 184 | + - run: yarn test --build ${{ matrix.args }} --ci |
| 185 | + download_base_build_for_sizebot: |
| 186 | + if: inputs.prerelease_commit_sha == '' && github.ref != 'refs/heads/main' && github.ref != 'refs/heads/builds/facebook-www' |
| 187 | + runs-on: ubuntu-latest |
| 188 | + env: |
| 189 | + TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 190 | + steps: |
| 191 | + |
| 192 | + - uses: actions/setup-node@v4 |
| 193 | + with: |
| 194 | + node-version: '16' |
| 195 | + cache: 'yarn' |
| 196 | + - uses: "./.github/actions/setup_node_modules" |
| 197 | + - name: Download artifacts for base revision |
| 198 | + run: |- |
| 199 | + git fetch origin main |
| 200 | + cd ./scripts/release && yarn && cd ../../ |
| 201 | + scripts/release/download-experimental-build.js --commit=$(git merge-base HEAD origin/main) --allowBrokenCI |
| 202 | + mv ./build ./base-build |
| 203 | + - name: Delete extraneous files |
| 204 | + run: rm -rf ./base-build/node_modules |
| 205 | + |
| 206 | + with: |
| 207 | + name: base-build |
| 208 | + path: "./base-build" |
| 209 | + sizebot: |
| 210 | + if: inputs.prerelease_commit_sha == '' && github.ref != 'refs/heads/main' |
| 211 | + runs-on: ubuntu-latest |
| 212 | + needs: |
| 213 | + - download_base_build_for_sizebot |
| 214 | + - yarn_build |
| 215 | + env: |
| 216 | + TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 217 | + steps: |
| 218 | + |
| 219 | + - uses: actions/setup-node@v4 |
| 220 | + with: |
| 221 | + node-version: '16' |
| 222 | + cache: 'yarn' |
| 223 | + |
| 224 | + with: |
| 225 | + name: yarn-build |
| 226 | + path: build |
| 227 | + - run: echo "$GITHUB_SHA" >> build/COMMIT_SHA |
| 228 | + - uses: "./.github/actions/setup_node_modules" |
| 229 | + - run: node ./scripts/tasks/danger |
| 230 | + yarn_lint_build: |
| 231 | + if: inputs.prerelease_commit_sha == '' |
| 232 | + runs-on: ubuntu-latest |
| 233 | + needs: |
| 234 | + - yarn_build |
| 235 | + env: |
| 236 | + TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 237 | + steps: |
| 238 | + |
| 239 | + - uses: actions/setup-node@v4 |
| 240 | + with: |
| 241 | + node-version: '16' |
| 242 | + cache: 'yarn' |
| 243 | + |
| 244 | + with: |
| 245 | + name: yarn-build |
| 246 | + path: build |
| 247 | + - uses: "./.github/actions/setup_node_modules" |
| 248 | + - run: yarn lint-build |
| 249 | + yarn_check_release_dependencies: |
| 250 | + if: inputs.prerelease_commit_sha == '' |
| 251 | + runs-on: ubuntu-latest |
| 252 | + needs: |
| 253 | + - yarn_build |
| 254 | + env: |
| 255 | + TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 256 | + steps: |
| 257 | + |
| 258 | + - uses: actions/setup-node@v4 |
| 259 | + with: |
| 260 | + node-version: '16' |
| 261 | + cache: 'yarn' |
| 262 | + |
| 263 | + with: |
| 264 | + name: yarn-build |
| 265 | + path: build |
| 266 | + - uses: "./.github/actions/setup_node_modules" |
| 267 | + - run: yarn check-release-dependencies |
| 268 | + check_error_codes: |
| 269 | + if: inputs.prerelease_commit_sha == '' |
| 270 | + runs-on: ubuntu-latest |
| 271 | + needs: |
| 272 | + - yarn_build |
| 273 | + env: |
| 274 | + TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 275 | + steps: |
| 276 | + |
| 277 | + - uses: actions/setup-node@v4 |
| 278 | + with: |
| 279 | + node-version: '16' |
| 280 | + cache: 'yarn' |
| 281 | + |
| 282 | + with: |
| 283 | + name: yarn-build |
| 284 | + path: build |
| 285 | + - uses: "./.github/actions/setup_node_modules" |
| 286 | + - name: Search build artifacts for unminified errors |
| 287 | + run: |- |
| 288 | + yarn extract-errors |
| 289 | + git diff --quiet || (echo "Found unminified errors. Either update the error codes map or disable error minification for the affected build, if appropriate." && false) |
| 290 | + RELEASE_CHANNEL_stable_yarn_test_dom_fixtures: |
| 291 | + if: inputs.prerelease_commit_sha == '' |
| 292 | + runs-on: ubuntu-latest |
| 293 | + needs: |
| 294 | + - yarn_build |
| 295 | + env: |
| 296 | + TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 297 | + steps: |
| 298 | + |
| 299 | + - uses: actions/setup-node@v4 |
| 300 | + with: |
| 301 | + node-version: '16' |
| 302 | + cache: 'yarn' |
| 303 | + |
| 304 | + with: |
| 305 | + name: yarn-build |
| 306 | + path: build |
| 307 | + - uses: "./.github/actions/setup_node_modules" |
| 308 | + - name: Install dependencies in fixtures/dom |
| 309 | + run: yarn install --frozen-lockfile --cache-folder `yarn cache dir` |
| 310 | + working-directory: fixtures/dom |
| 311 | + - name: Install dependencies in fixtures/dom (retry) |
| 312 | + run: yarn install --frozen-lockfile --cache-folder `yarn cache dir` |
| 313 | + working-directory: fixtures/dom |
| 314 | + if: failure() |
| 315 | + - name: Run DOM fixture tests |
| 316 | + run: |- |
| 317 | + yarn predev |
| 318 | + yarn test --maxWorkers=2 |
| 319 | + working-directory: fixtures/dom |
| 320 | + env: |
| 321 | + RELEASE_CHANNEL: stable |
| 322 | + build_devtools_and_process_artifacts: |
| 323 | + if: inputs.prerelease_commit_sha == '' |
| 324 | + runs-on: ubuntu-latest |
| 325 | + needs: |
| 326 | + - yarn_build |
| 327 | + env: |
| 328 | + TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 329 | + steps: |
| 330 | + |
| 331 | + - uses: actions/setup-node@v4 |
| 332 | + with: |
| 333 | + node-version: '16' |
| 334 | + cache: 'yarn' |
| 335 | + |
| 336 | + with: |
| 337 | + name: yarn-build |
| 338 | + path: build |
| 339 | + - uses: "./.github/actions/setup_node_modules" |
| 340 | + - run: "./scripts/circleci/pack_and_store_devtools_artifacts.sh" |
| 341 | + env: |
| 342 | + RELEASE_CHANNEL: experimental |
| 343 | + |
| 344 | + with: |
| 345 | + name: devtools |
| 346 | + path: "./build/devtools.tgz" |
| 347 | + run_devtools_e2e_tests: |
| 348 | + if: inputs.prerelease_commit_sha == '' |
| 349 | + runs-on: ubuntu-latest |
| 350 | + needs: |
| 351 | + - build_devtools_and_process_artifacts |
| 352 | + env: |
| 353 | + TZ: "/usr/share/zoneinfo/America/Los_Angeles" |
| 354 | + steps: |
| 355 | + |
| 356 | + - uses: actions/setup-node@v4 |
| 357 | + with: |
| 358 | + node-version: '16' |
| 359 | + cache: 'yarn' |
| 360 | + |
| 361 | + with: |
| 362 | + name: devtools |
| 363 | + path: build |
| 364 | + - uses: "./.github/actions/setup_node_modules" |
| 365 | + - name: Playwright install deps |
| 366 | + run: |- |
| 367 | + npx playwright install |
| 368 | + sudo npx playwright install-deps |
| 369 | + - run: "./scripts/circleci/run_devtools_e2e_tests.js" |
| 370 | + env: |
| 371 | + RELEASE_CHANNEL: experimental |
0 commit comments