name: Tests on: workflow_dispatch: push: branches: - main pull_request: branches: - main permissions: contents: read # A pull request cancels its previous run. Pushes to main are grouped per commit so they never cancel each other: # Release runs once Tests and Linting and typings succeed on main, and a cancelled run would skip the release. concurrency: group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.sha }}" cancel-in-progress: true defaults: run: working-directory: . jobs: test: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, windows-latest] node_version: [22, 24] cwd: - packages/adapter-cloudflare - packages/adapter-elysia - packages/adapter-express - packages/adapter-fastify - packages/adapter-h3 - packages/adapter-hattip - packages/adapter-hono - packages/adapter-srvx - packages/adapter-vercel - packages/adapter-webroute - packages/compress - packages/core - packages/sirv - packages/universal-middleware - tests-examples/tests-tool exclude: - os: windows-latest node_version: 22 - os: windows-latest cwd: packages/sirv - os: windows-latest cwd: packages/adapter-vercel - cwd: tests-examples/tests-tool node_version: 22 fail-fast: false name: "node@${{ matrix.node_version }}, ${{ matrix.os }}, ${{ matrix.cwd }}" steps: - name: Checkout uses: actions/checkout@v7 - name: Install Deno uses: denoland/setup-deno@v2 with: deno-version: v2.9.8 - name: Install Bun uses: oven-sh/setup-bun@v2 with: bun-version: 1.4.4 - name: Install pnpm uses: pnpm/action-setup@v6 - name: Set Node version to ${{ matrix.node_version }} uses: actions/setup-node@v7 with: node-version: ${{ matrix.node_version }} check-latest: true cache: "pnpm" - name: Install run: pnpm install # A build takes well under 2 minutes: the timeout fails a stalled build early instead of hanging until the 6-hour # job limit. - name: Build run: pnpm run build timeout-minutes: 10 - run: pnpm exec playwright install chromium if: matrix.cwd == 'tests-examples/tests-tool' working-directory: ${{ matrix.cwd }} # Pull requests from forks get no secrets, and `vercel dev` cannot start without a token. - name: Check for VERCEL_TOKEN id: vercel if: matrix.cwd == 'packages/adapter-vercel' shell: bash run: | if [ "${{ secrets.VERCEL_TOKEN != '' }}" = "true" ]; then echo "skip=false" >> "$GITHUB_OUTPUT" else echo "skip=true" >> "$GITHUB_OUTPUT" message="VERCEL_TOKEN is not available to this run (pull requests from forks get no secrets), so the Vercel tests did not run. They run on pushes to main." echo "::notice title=Vercel tests skipped::$message" echo "### Vercel tests skipped" >> "$GITHUB_STEP_SUMMARY" echo "$message" >> "$GITHUB_STEP_SUMMARY" fi - name: Run tests on ${{ matrix.cwd }} if: steps.vercel.outputs.skip != 'true' run: pnpm run test working-directory: ${{ matrix.cwd }} env: VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}