name: Test on: # Ensure GitHub actions are not run twice for same commits push: branches: [main] pull_request: types: [opened, synchronize, reopened] branches: - '**' - '!release-please--**' merge_group: jobs: test: runs-on: ${{ matrix.os }} timeout-minutes: 30 strategy: matrix: os: [ubuntu-latest, macOS-latest, windows-latest] node-version: ['26'] # `node-install-version` is what `setup-node` actually installs. # `node-version` is the display value used in the matrix job name # (which required status checks are pinned to), so it must stay stable. node-install-version: ['26.13.0'] include: - os: ubuntu-latest # Test the minimum supported Node.js version. node-version: '22.12.0' node-install-version: '22.12.0' fail-fast: false steps: # Increasing the maximum number of open files. See: # https://github.com/actions/virtual-environments/issues/268 - name: Increase open file limit run: sudo ulimit -Sn 65536 if: "${{ matrix.os == 'macOS-latest' }}" - run: git config --global core.symlinks true - uses: actions/checkout@v6 with: fetch-depth: 0 - name: Node.js ${{ matrix.node-install-version }} uses: actions/setup-node@v7 with: node-version: ${{ matrix.node-install-version }} cache: 'npm' - name: Setup Deno uses: denoland/setup-deno@v1 with: deno-version: 2.9.0 - name: Setup Deno dependencies run: deno cache https://deno.land/x/eszip@v0.55.2/eszip.ts - name: Install dependencies run: npm ci - name: Install playwright browsers run: npx playwright install --with-deps chromium - name: Build run: npm run build --workspaces=true # Fork PRs don't have access to secrets, so live E2E tests (e.g. Netlify # deploy tests) must be skipped. - name: Flag fork PR if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'netlify/primitives' }} run: echo "SKIP_LIVE_TESTS=true" >> "$GITHUB_ENV" - name: Tests run: npm run test --workspaces=true env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - name: Warn if live tests were skipped if: ${{ env.SKIP_LIVE_TESTS == 'true' }} run: | echo "::warning::Live E2E tests were skipped because secrets are not available (likely a fork PR)." echo "## ⚠️ Live E2E tests were skipped" >> "$GITHUB_STEP_SUMMARY" echo "" >> "$GITHUB_STEP_SUMMARY" echo "This workflow run does not have access to secrets (likely a fork PR)." >> "$GITHUB_STEP_SUMMARY" echo "Live tests that deploy to Netlify were skipped." >> "$GITHUB_STEP_SUMMARY" echo "Maintainers: before merging, verify that these tests pass or aren't relevant." >> "$GITHUB_STEP_SUMMARY"