| 1 | name: (DevTools) Regression Tests |
| 2 | |
| 3 | on: |
| 4 | schedule: |
| 5 | - cron: 0 0 * * * |
| 6 | workflow_dispatch: |
| 7 | inputs: |
| 8 | commit_sha: |
| 9 | required: false |
| 10 | type: string |
| 11 | |
| 12 | permissions: {} |
| 13 | |
| 14 | env: |
| 15 | TZ: /usr/share/zoneinfo/America/Los_Angeles |
| 16 | # https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout |
| 17 | SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1 |
| 18 | |
| 19 | jobs: |
| 20 | download_build: |
| 21 | name: Download base build |
| 22 | runs-on: ubuntu-latest |
| 23 | permissions: |
| 24 | # We use github.token to download the build artifact from a previous runtime_build_and_test.yml run |
| 25 | actions: read |
| 26 | steps: |
| 27 | - uses: actions/checkout@v4 |
| 28 | - uses: actions/setup-node@v4 |
| 29 | with: |
| 30 | node-version-file: '.nvmrc' |
| 31 | - name: Cache node_modules |
| 32 | uses: actions/cache@v4 |
| 33 | id: node_modules |
| 34 | with: |
| 35 | path: | |
| 36 | **/node_modules |
| 37 | key: runtime-release-node_modules-v6-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock', 'scripts/release/yarn.lock') }} |
| 38 | - name: Ensure clean build directory |
| 39 | run: rm -rf build |
| 40 | - run: yarn install --frozen-lockfile |
| 41 | if: steps.node_modules.outputs.cache-hit != 'true' |
| 42 | - run: yarn --cwd scripts/release install --frozen-lockfile |
| 43 | if: steps.node_modules.outputs.cache-hit != 'true' |
| 44 | - name: Download react-devtools artifacts for base revision |
| 45 | run: | |
| 46 | git fetch origin main |
| 47 | GH_TOKEN=${{ github.token }} scripts/release/download-experimental-build.js --commit=${{ inputs.commit_sha || '$(git rev-parse origin/main)' }} |
| 48 | - name: Display structure of build |
| 49 | run: ls -R build |
| 50 | - name: Archive build |
| 51 | uses: actions/upload-artifact@v4 |
| 52 | with: |
| 53 | name: build |
| 54 | path: build |
| 55 | if-no-files-found: error |
| 56 | |
| 57 | build_devtools_and_process_artifacts: |
| 58 | name: Build DevTools and process artifacts |
| 59 | needs: download_build |
| 60 | runs-on: ubuntu-latest |
| 61 | steps: |
| 62 | - uses: actions/checkout@v4 |
| 63 | - uses: actions/setup-node@v4 |
| 64 | with: |
| 65 | node-version-file: '.nvmrc' |
| 66 | - name: Cache node_modules |
| 67 | uses: actions/cache@v4 |
| 68 | id: node_modules |
| 69 | with: |
| 70 | path: | |
| 71 | **/node_modules |
| 72 | key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} |
| 73 | - name: Ensure clean build directory |
| 74 | run: rm -rf build |
| 75 | - run: yarn install --frozen-lockfile |
| 76 | if: steps.node_modules.outputs.cache-hit != 'true' |
| 77 | - name: Restore archived build |
| 78 | uses: actions/download-artifact@v4 |
| 79 | with: |
| 80 | name: build |
| 81 | path: build |
| 82 | - run: ./scripts/ci/pack_and_store_devtools_artifacts.sh |
| 83 | env: |
| 84 | RELEASE_CHANNEL: experimental |
| 85 | - name: Display structure of build |
| 86 | run: ls -R build |
| 87 | - name: Archive devtools build |
| 88 | uses: actions/upload-artifact@v4 |
| 89 | with: |
| 90 | name: react-devtools |
| 91 | path: build/devtools |
| 92 | if-no-files-found: error |
| 93 | # Simplifies getting the extension for local testing |
| 94 | - name: Archive chrome extension |
| 95 | uses: actions/upload-artifact@v4 |
| 96 | with: |
| 97 | name: react-devtools-chrome-extension |
| 98 | path: build/devtools/chrome-extension.zip |
| 99 | if-no-files-found: error |
| 100 | - name: Archive firefox extension |
| 101 | uses: actions/upload-artifact@v4 |
| 102 | with: |
| 103 | name: react-devtools-firefox-extension |
| 104 | path: build/devtools/firefox-extension.zip |
| 105 | if-no-files-found: error |
| 106 | |
| 107 | run_devtools_tests_for_versions: |
| 108 | name: Run DevTools tests for versions |
| 109 | needs: build_devtools_and_process_artifacts |
| 110 | runs-on: ubuntu-latest |
| 111 | strategy: |
| 112 | fail-fast: false |
| 113 | matrix: |
| 114 | version: |
| 115 | - "16.0" |
| 116 | - "16.5" # schedule package |
| 117 | - "16.8" # hooks |
| 118 | - "17.0" |
| 119 | - "18.0" |
| 120 | - "18.2" # compiler polyfill |
| 121 | steps: |
| 122 | - uses: actions/checkout@v4 |
| 123 | - uses: actions/setup-node@v4 |
| 124 | with: |
| 125 | node-version-file: '.nvmrc' |
| 126 | - name: Cache node_modules |
| 127 | uses: actions/cache@v4 |
| 128 | id: node_modules |
| 129 | with: |
| 130 | path: | |
| 131 | **/node_modules |
| 132 | key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} |
| 133 | - run: yarn install --frozen-lockfile |
| 134 | if: steps.node_modules.outputs.cache-hit != 'true' |
| 135 | - name: Restore all archived build artifacts |
| 136 | uses: actions/download-artifact@v4 |
| 137 | - name: Display structure of build |
| 138 | run: ls -R build |
| 139 | - run: ./scripts/ci/download_devtools_regression_build.js ${{ matrix.version }} --replaceBuild |
| 140 | - run: node ./scripts/jest/jest-cli.js --build --project devtools --release-channel=experimental --reactVersion ${{ matrix.version }} --ci |
| 141 | |
| 142 | run_devtools_e2e_tests_for_versions: |
| 143 | name: Run DevTools e2e tests for versions |
| 144 | needs: build_devtools_and_process_artifacts |
| 145 | runs-on: ubuntu-latest |
| 146 | strategy: |
| 147 | fail-fast: false |
| 148 | matrix: |
| 149 | version: |
| 150 | - "16.0" |
| 151 | - "16.5" # schedule package |
| 152 | - "16.8" # hooks |
| 153 | - "17.0" |
| 154 | - "18.0" |
| 155 | steps: |
| 156 | - uses: actions/checkout@v4 |
| 157 | - uses: actions/setup-node@v4 |
| 158 | with: |
| 159 | node-version-file: '.nvmrc' |
| 160 | - name: Cache node_modules |
| 161 | uses: actions/cache@v4 |
| 162 | id: node_modules |
| 163 | with: |
| 164 | path: | |
| 165 | **/node_modules |
| 166 | key: runtime-node_modules-v10-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }} |
| 167 | - run: yarn install --frozen-lockfile |
| 168 | if: steps.node_modules.outputs.cache-hit != 'true' |
| 169 | - name: Restore all archived build artifacts |
| 170 | uses: actions/download-artifact@v4 |
| 171 | - name: Display structure of build |
| 172 | run: ls -R build |
| 173 | - name: Check Playwright version |
| 174 | id: playwright_version |
| 175 | run: echo "playwright_version=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//' | head -1)" >> "$GITHUB_OUTPUT" |
| 176 | - name: Cache Playwright Browsers for version ${{ steps.playwright_version.outputs.playwright_version }} |
| 177 | id: cache_playwright_browsers |
| 178 | uses: actions/cache@v4 |
| 179 | with: |
| 180 | path: ~/.cache/ms-playwright |
| 181 | key: playwright-browsers-v6-${{ runner.arch }}-${{ runner.os }}-${{ steps.playwright_version.outputs.playwright_version }} |
| 182 | - run: npx playwright install --with-deps |
| 183 | if: steps.cache_playwright_browsers.outputs.cache-hit != 'true' |
| 184 | - run: npx playwright install-deps |
| 185 | if: steps.cache_playwright_browsers.outputs.cache-hit == 'true' |
| 186 | - run: ./scripts/ci/download_devtools_regression_build.js ${{ matrix.version }} |
| 187 | - run: ls -R build-regression |
| 188 | - run: ./scripts/ci/run_devtools_e2e_tests.js ${{ matrix.version }} |
| 189 | env: |
| 190 | RELEASE_CHANNEL: experimental |
| 191 | - name: Cleanup build regression folder |
| 192 | run: rm -r ./build-regression |
| 193 | - uses: actions/upload-artifact@v4 |
| 194 | with: |
| 195 | name: screenshots |
| 196 | path: ./tmp/playwright-artifacts |
| 197 | if-no-files-found: warn |