From fa313a1b3b99b4bb3e03acfe250a41e0651902ed Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Mon, 24 Jun 2024 14:28:22 -0400 Subject: [PATCH] [ci] Add yarn_test_build job to gh actions ghstack-source-id: 9cd55d391a57a0254dc07c0982047005a89a2390 Pull Request resolved: https://github.com/facebook/react/pull/30072 --- .github/workflows/runtime_build.yml | 63 ++++++++++++++++++++++++++++- scripts/rollup/build-ghaction.js | 4 +- 2 files changed, 62 insertions(+), 5 deletions(-) diff --git a/.github/workflows/runtime_build.yml b/.github/workflows/runtime_build.yml index a380c2c85c722..0e229eda42b65 100644 --- a/.github/workflows/runtime_build.yml +++ b/.github/workflows/runtime_build.yml @@ -54,7 +54,7 @@ jobs: - name: Archive build uses: actions/upload-artifact@v4 with: - name: ${{ matrix.bundle_type }}-${{ matrix.release_channel }} + name: ${{ matrix.bundle_type }}_${{ matrix.release_channel }} path: | build/** @@ -82,6 +82,65 @@ jobs: - name: Restore archived build uses: actions/download-artifact@v4 with: - name: ${{ matrix.bundle_type }}-${{ matrix.release_channel }} + name: ${{ matrix.bundle_type }}_${{ matrix.release_channel }} - run: yarn install --frozen-lockfile - run: yarn lint-build + + test_build: + name: yarn test-build + needs: [define_build_params, build] + strategy: + matrix: + bundle_type: ${{ fromJSON(needs.define_build_params.outputs.bundle_type) }} + release_channel: ${{ fromJSON(needs.define_build_params.outputs.release_channel) }} + test_params: [ + # Intentionally passing these as strings instead of creating a + # separate parameter per CLI argument, since it's easier to + # control/see which combinations we want to run. + -r=stable --env=development, + -r=stable --env=production, + -r=experimental --env=development, + -r=experimental --env=production, + + # Dev Tools + --project=devtools -r=experimental, + + # TODO: Update test config to support www build tests + # - "-r=www-classic --env=development --variant=false" + # - "-r=www-classic --env=production --variant=false" + # - "-r=www-classic --env=development --variant=true" + # - "-r=www-classic --env=production --variant=true" + # - "-r=www-modern --env=development --variant=false" + # - "-r=www-modern --env=production --variant=false" + # - "-r=www-modern --env=development --variant=true" + # - "-r=www-modern --env=production --variant=true" + + # TODO: Update test config to support xplat build tests + # - "-r=xplat --env=development --variant=false" + # - "-r=xplat --env=development --variant=true" + # - "-r=xplat --env=production --variant=false" + # - "-r=xplat --env=production --variant=true" + + # TODO: Test more persistent configurations? + ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18.x + cache: "yarn" + cache-dependency-path: yarn.lock + - name: Restore cached node_modules + uses: actions/cache@v4 + id: node_modules + with: + path: "**/node_modules" + key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} + - name: Restore archived build + uses: actions/download-artifact@v4 + with: + name: ${{ matrix.bundle_type }}_${{ matrix.release_channel }} + - run: yarn install --frozen-lockfile + - run: yarn test --build ${{ matrix.test_params }} --ci=github + diff --git a/scripts/rollup/build-ghaction.js b/scripts/rollup/build-ghaction.js index 60871e3e9208c..ce2ee7addb878 100644 --- a/scripts/rollup/build-ghaction.js +++ b/scripts/rollup/build-ghaction.js @@ -846,9 +846,7 @@ async function buildEverything(bundleTypeToBuild) { ); await Promise.all( - bundles.map(([bundle, bundleType]) => { - return createBundle(bundle, bundleType); - }) + bundles.map(([bundle, bundleType]) => createBundle(bundle, bundleType)) ); await Packaging.copyAllShims();