From 7beef8b1229ee8daaf679e99af17f9a464937e9d Mon Sep 17 00:00:00 2001 From: Nic Polumeyv <162764842+Nic-Polumeyv@users.noreply.github.com> Date: Sun, 20 Sep 2026 22:54:08 -0400 Subject: [PATCH 1/4] chore: pass secrets to the platform test workflows again --- .github/workflows/platform-tests-all.yml | 3 +++ .github/workflows/platform-tests-netlify.yml | 4 ++++ .github/workflows/platform-tests-vercel.yml | 2 ++ 3 files changed, 9 insertions(+) diff --git a/.github/workflows/platform-tests-all.yml b/.github/workflows/platform-tests-all.yml index 944b3a2a9c64..3b54b30aac21 100644 --- a/.github/workflows/platform-tests-all.yml +++ b/.github/workflows/platform-tests-all.yml @@ -16,16 +16,19 @@ jobs: uses: ./.github/workflows/platform-tests-vercel.yml with: sha: ${{ inputs.sha }} + secrets: inherit netlify: uses: ./.github/workflows/platform-tests-netlify.yml with: sha: ${{ inputs.sha }} + secrets: inherit node: uses: ./.github/workflows/platform-tests-node.yml with: sha: ${{ inputs.sha }} + secrets: inherit report-status: if: always() diff --git a/.github/workflows/platform-tests-netlify.yml b/.github/workflows/platform-tests-netlify.yml index 820077177bdd..f6246488a7ae 100644 --- a/.github/workflows/platform-tests-netlify.yml +++ b/.github/workflows/platform-tests-netlify.yml @@ -26,6 +26,7 @@ jobs: sha: ${{ inputs.sha || github.sha }} variant: basic test-app-dir: packages/adapter-netlify/test/apps/basic + secrets: inherit edge: if: github.repository == 'sveltejs/kit' @@ -34,6 +35,7 @@ jobs: sha: ${{ inputs.sha || github.sha }} variant: edge test-app-dir: packages/adapter-netlify/test/apps/edge + secrets: inherit split: if: github.repository == 'sveltejs/kit' @@ -42,6 +44,7 @@ jobs: sha: ${{ inputs.sha || github.sha }} variant: split test-app-dir: packages/adapter-netlify/test/apps/split + secrets: inherit split-edge: if: github.repository == 'sveltejs/kit' @@ -51,3 +54,4 @@ jobs: variant: split-edge test-app-dir: packages/adapter-netlify/test/apps/split edge: true + secrets: inherit diff --git a/.github/workflows/platform-tests-vercel.yml b/.github/workflows/platform-tests-vercel.yml index 8beeeea0082c..ae4e682899cf 100644 --- a/.github/workflows/platform-tests-vercel.yml +++ b/.github/workflows/platform-tests-vercel.yml @@ -27,6 +27,7 @@ jobs: variant: basic test-app-dir: packages/adapter-vercel/test/apps/basic purge-cache: true + secrets: inherit split: if: github.repository == 'sveltejs/kit' @@ -35,3 +36,4 @@ jobs: sha: ${{ inputs.sha || github.sha }} variant: split test-app-dir: packages/adapter-vercel/test/apps/split + secrets: inherit From 02e78b3857a07b8eddca57042425e7f7e1100cec Mon Sep 17 00:00:00 2001 From: Nic Polumeyv <162764842+Nic-Polumeyv@users.noreply.github.com> Date: Sun, 20 Sep 2026 23:15:27 -0400 Subject: [PATCH 2/4] chore: run each platform test variant through one reusable workflow --- .github/actions/deployment-test/action.yml | 60 ------- .github/actions/netlify-deploy/action.yml | 81 --------- .github/actions/node-test/action.yml | 27 --- .github/actions/vercel-deploy/action.yml | 80 --------- .github/workflows/platform-test-netlify.yml | 113 ------------- .github/workflows/platform-test-vercel.yml | 109 ------------ .github/workflows/platform-test.yml | 168 +++++++++++++++++++ .github/workflows/platform-tests-all.yml | 140 ++++++++++++---- .github/workflows/platform-tests-netlify.yml | 57 ------- .github/workflows/platform-tests-node.yml | 47 ------ .github/workflows/platform-tests-vercel.yml | 39 ----- 11 files changed, 272 insertions(+), 649 deletions(-) delete mode 100644 .github/actions/deployment-test/action.yml delete mode 100644 .github/actions/netlify-deploy/action.yml delete mode 100644 .github/actions/node-test/action.yml delete mode 100644 .github/actions/vercel-deploy/action.yml delete mode 100644 .github/workflows/platform-test-netlify.yml delete mode 100644 .github/workflows/platform-test-vercel.yml create mode 100644 .github/workflows/platform-test.yml delete mode 100644 .github/workflows/platform-tests-netlify.yml delete mode 100644 .github/workflows/platform-tests-node.yml delete mode 100644 .github/workflows/platform-tests-vercel.yml diff --git a/.github/actions/deployment-test/action.yml b/.github/actions/deployment-test/action.yml deleted file mode 100644 index edec7af3ba59..000000000000 --- a/.github/actions/deployment-test/action.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: 'Platform Test' -description: 'Run platform tests against a deployed test app' - -inputs: - sha: - description: 'Commit SHA to test' - required: true - platform: - description: 'Name of the deployment platform' - required: true - test-app-dir: - description: 'Path to the test app directory' - required: true - variant: - description: 'Name of the test app variant' - required: true - -runs: - using: 'composite' - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ inputs.sha }} - persist-credentials: false - path: .target - - - uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0 - with: - runtime: node@24 - working-directory: .target - - - name: Install Playwright - shell: bash - working-directory: .target - run: pnpm playwright install chromium --no-shell - - - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: platform-${{ inputs.platform }}-${{ inputs.variant }}-deployment-${{ github.run_id }} - path: ${{ runner.temp }}/deployment - - - name: Read deployment URL - id: deployment - shell: bash - run: echo "url=$(cat '${{ runner.temp }}/deployment/url')" >> "$GITHUB_OUTPUT" - - - name: Run Playwright tests - shell: bash - working-directory: .target/${{ inputs.test-app-dir }} - env: - DEPLOYMENT_URL: ${{ steps.deployment.outputs.url }} - run: pnpm test:platform - - - name: Upload test artifacts - if: failure() - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: platform-test-results-${{ inputs.platform }}-${{ inputs.variant }} - path: .target/${{ inputs.test-app-dir }}/test-results - retention-days: 3 diff --git a/.github/actions/netlify-deploy/action.yml b/.github/actions/netlify-deploy/action.yml deleted file mode 100644 index b411c756565a..000000000000 --- a/.github/actions/netlify-deploy/action.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: 'Netlify Deploy' -description: 'Deploy a prebuilt test app to Netlify' - -inputs: - variant: - description: 'Name of the test app variant' - required: true - netlify-project-id: - description: 'Netlify project ID' - required: true - netlify-token: - description: 'Netlify authentication token' - required: true -outputs: - deployment-url: - description: 'URL of the deployed preview' - value: ${{ steps.deploy.outputs.url }} - -runs: - using: 'composite' - steps: - - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: platform-netlify-${{ inputs.variant }}-${{ github.run_id }} - path: ${{ runner.temp }}/platform-output - - - uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0 - with: - version: ^12.0.0 - runtime: node@24 - cache: true - cache-dependency-path: .workflow/pnpm-lock.yaml - - - name: Install Netlify CLI - shell: bash - run: pnpm i -g netlify-cli --allow-build=esbuild --allow-build=netlify-cli - - - name: Deploy to Netlify - id: deploy - shell: bash - working-directory: ${{ runner.temp }}/platform-output - env: - NETLIFY_AUTH_TOKEN: ${{ inputs.netlify-token }} - NETLIFY_PROJECT_ID: ${{ inputs.netlify-project-id }} - run: | - set -euo pipefail - - if deploy_json=$(env \ - -u NETLIFY_AUTH_TOKEN \ - -u NETLIFY_PROJECT_ID \ - netlify deploy \ - --json \ - --verbose \ - --no-build \ - --dir="build" \ - --functions=".netlify/v1/functions" \ - --auth="$NETLIFY_AUTH_TOKEN" \ - --site="$NETLIFY_PROJECT_ID" - ); then - deploy_url=$(jq -er '.deploy_url' <<< "$deploy_json") - echo "url=$deploy_url" >> "$GITHUB_OUTPUT" - else - echo "::error::Netlify deployment failed" - echo "$deploy_json" >&2 - exit 1 - fi - - - name: Save deployment URL - shell: bash - env: - DEPLOYMENT_URL: ${{ steps.deploy.outputs.url }} - run: | - mkdir "${{ runner.temp }}/deployment" - printf '%s' "$DEPLOYMENT_URL" > "${{ runner.temp }}/deployment/url" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: platform-netlify-${{ inputs.variant }}-deployment-${{ github.run_id }} - path: ${{ runner.temp }}/deployment/url - if-no-files-found: error - retention-days: 1 diff --git a/.github/actions/node-test/action.yml b/.github/actions/node-test/action.yml deleted file mode 100644 index 6ffa25206bd0..000000000000 --- a/.github/actions/node-test/action.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: 'Platform Test' -description: 'Run Playwright tests against a local build' - -inputs: - test-app-dir: - description: 'Path to the test app directory' - required: true - -runs: - using: 'composite' - steps: - - name: Install Playwright - shell: bash - run: pnpm playwright install chromium --no-shell - - - name: Run Playwright tests - shell: bash - working-directory: ${{ inputs.test-app-dir }} - run: pnpm test:platform - - - name: Upload test artifacts - if: failure() - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: platform-test-results-${{ github.job }} - path: ${{ inputs.test-app-dir }}/test-results - retention-days: 3 diff --git a/.github/actions/vercel-deploy/action.yml b/.github/actions/vercel-deploy/action.yml deleted file mode 100644 index 31cad370b0f5..000000000000 --- a/.github/actions/vercel-deploy/action.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: 'Vercel Deploy' -description: 'Deploy a prebuilt test app to Vercel' - -inputs: - variant: - description: 'Name of the test app variant' - required: true - # Important: When setting up a new Vercel test app, make sure - # to set the root directory in the dashboard to the correct path. - vercel-project-id: - description: 'Vercel project ID for the test app' - required: true - vercel-token: - description: 'Vercel authentication token' - required: true - vercel-org-id: - description: 'Vercel organization ID' - required: true - purge-cache: - description: 'Purge the Vercel CDN cache before testing' - required: false - default: 'false' -outputs: - deployment-url: - description: 'URL of the deployed preview' - value: ${{ steps.deploy.outputs.url }} - -runs: - using: 'composite' - steps: - - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - with: - name: platform-vercel-${{ inputs.variant }}-${{ github.run_id }} - path: ${{ runner.temp }}/platform-output - - - uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0 - with: - version: ^12.0.0 - runtime: node@24 - cache: true - cache-dependency-path: .workflow/pnpm-lock.yaml - - - name: Install Vercel CLI - shell: bash - run: pnpm i -g vercel - - - name: Deploy to Vercel - id: deploy - shell: bash - working-directory: ${{ runner.temp }}/platform-output - env: - VERCEL_TOKEN: ${{ inputs.vercel-token }} - VERCEL_ORG_ID: ${{ inputs.vercel-org-id }} - VERCEL_PROJECT_ID: ${{ inputs.vercel-project-id }} - run: echo "url=$(vercel deploy --prebuilt --yes --token="$VERCEL_TOKEN")" >> "$GITHUB_OUTPUT" - - # avoid stale cache results when testing ISR routes - - name: Purge Vercel CDN Cache - if: inputs.purge-cache == 'true' - shell: bash - env: - VERCEL_TOKEN: ${{ inputs.vercel-token }} - VERCEL_ORG_ID: ${{ inputs.vercel-org-id }} - VERCEL_PROJECT_ID: ${{ inputs.vercel-project-id }} - run: vercel cache purge --type cdn --token="$VERCEL_TOKEN" --yes - - - name: Save deployment URL - shell: bash - env: - DEPLOYMENT_URL: ${{ steps.deploy.outputs.url }} - run: | - mkdir "${{ runner.temp }}/deployment" - printf '%s' "$DEPLOYMENT_URL" > "${{ runner.temp }}/deployment/url" - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: platform-vercel-${{ inputs.variant }}-deployment-${{ github.run_id }} - path: ${{ runner.temp }}/deployment/url - if-no-files-found: error - retention-days: 1 diff --git a/.github/workflows/platform-test-netlify.yml b/.github/workflows/platform-test-netlify.yml deleted file mode 100644 index 4f7f74f4e1c4..000000000000 --- a/.github/workflows/platform-test-netlify.yml +++ /dev/null @@ -1,113 +0,0 @@ -name: Platform Test (Netlify) - -on: - workflow_call: - inputs: - sha: - description: 'Commit SHA to test' - required: true - type: string - variant: - description: 'Name of the test app variant' - required: true - type: string - test-app-dir: - description: 'Path to the test app directory' - required: true - type: string - edge: - description: 'Build the test app with Netlify Edge Functions' - required: false - type: boolean - default: false - -permissions: - contents: read - -env: - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' - -jobs: - build: - name: ${{ inputs.variant }} build - if: github.repository == 'sveltejs/kit' - runs-on: ubuntu-latest - timeout-minutes: 15 - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ inputs.sha }} - persist-credentials: false - - - uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0 - with: - runtime: node@24 - - # TODO: version-3 branch has no build command, so remove this step - - name: Build adapter - run: pnpm --filter @sveltejs/adapter-netlify --if-present build - - - name: Build test app - working-directory: ${{ inputs.test-app-dir }} - env: - EDGE: ${{ inputs.edge }} - run: pnpm build - - - name: Stage deployment artifact - env: - TARGET_DIR: ${{ github.workspace }}/${{ inputs.test-app-dir }} - run: | - mkdir platform-output - cp -a "$TARGET_DIR/build" "$TARGET_DIR/.netlify" platform-output/ - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: platform-netlify-${{ inputs.variant }}-${{ github.run_id }} - path: platform-output - include-hidden-files: true - if-no-files-found: error - retention-days: 1 - - deploy: - name: ${{ inputs.variant }} deploy - if: github.repository == 'sveltejs/kit' - needs: build - runs-on: ubuntu-latest - timeout-minutes: 15 - environment: '@sveltejs/adapter-netlify platform tests' - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ github.workflow_sha }} - persist-credentials: false - sparse-checkout: | - .github/actions - pnpm-lock.yaml - path: .workflow - - uses: ./.workflow/.github/actions/netlify-deploy - with: - netlify-project-id: ${{ inputs.variant == 'basic' && secrets.NETLIFY_PROJECT_ID_BASIC || inputs.variant == 'edge' && secrets.NETLIFY_PROJECT_ID_EDGE || inputs.variant == 'instrumentation' && secrets.NETLIFY_PROJECT_ID_INSTRUMENTATION || secrets.NETLIFY_PROJECT_ID_SPLIT }} - netlify-token: ${{ secrets.NETLIFY_TOKEN }} - variant: ${{ inputs.variant }} - - test: - name: ${{ inputs.variant }} test - if: github.repository == 'sveltejs/kit' - needs: deploy - runs-on: ubuntu-latest - timeout-minutes: 15 - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ github.workflow_sha }} - persist-credentials: false - sparse-checkout: | - .github/actions - pnpm-lock.yaml - path: .workflow - - uses: ./.workflow/.github/actions/deployment-test - with: - sha: ${{ inputs.sha }} - platform: netlify - test-app-dir: ${{ inputs.test-app-dir }} - variant: ${{ inputs.variant }} diff --git a/.github/workflows/platform-test-vercel.yml b/.github/workflows/platform-test-vercel.yml deleted file mode 100644 index 2fa243c6189b..000000000000 --- a/.github/workflows/platform-test-vercel.yml +++ /dev/null @@ -1,109 +0,0 @@ -name: Platform Test (Vercel) - -on: - workflow_call: - inputs: - sha: - description: 'Commit SHA to test' - required: true - type: string - variant: - description: 'Name of the test app variant' - required: true - type: string - test-app-dir: - description: 'Path to the test app directory' - required: true - type: string - purge-cache: - description: 'Purge the Vercel CDN cache before testing' - required: false - type: boolean - default: false - -permissions: - contents: read - -env: - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' - -jobs: - build: - name: ${{ inputs.variant }} build - if: github.repository == 'sveltejs/kit' - runs-on: ubuntu-latest - timeout-minutes: 15 - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ inputs.sha }} - persist-credentials: false - - - uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0 - with: - runtime: node@24 - - - name: Build test app - working-directory: ${{ inputs.test-app-dir }} - run: pnpm build - - - name: Stage deployment artifact - env: - TARGET_DIR: ${{ github.workspace }}/${{ inputs.test-app-dir }} - run: | - mkdir platform-output - cp -a "$TARGET_DIR/.vercel" platform-output/ - - - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: platform-vercel-${{ inputs.variant }}-${{ github.run_id }} - path: platform-output - include-hidden-files: true - if-no-files-found: error - retention-days: 1 - - deploy: - name: ${{ inputs.variant }} deploy - if: github.repository == 'sveltejs/kit' - needs: build - runs-on: ubuntu-latest - timeout-minutes: 15 - environment: '@sveltejs/adapter-vercel platform tests' - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ github.workflow_sha }} - persist-credentials: false - sparse-checkout: | - .github/actions - pnpm-lock.yaml - path: .workflow - - uses: ./.workflow/.github/actions/vercel-deploy - with: - vercel-project-id: ${{ inputs.variant == 'basic' && secrets.VERCEL_PROJECT_ID_BASIC || secrets.VERCEL_PROJECT_ID_SPLIT }} - vercel-token: ${{ secrets.VERCEL_TOKEN }} - vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} - variant: ${{ inputs.variant }} - purge-cache: ${{ inputs.purge-cache }} - - test: - name: ${{ inputs.variant }} test - if: github.repository == 'sveltejs/kit' - needs: deploy - runs-on: ubuntu-latest - timeout-minutes: 15 - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - ref: ${{ github.workflow_sha }} - persist-credentials: false - sparse-checkout: | - .github/actions - pnpm-lock.yaml - path: .workflow - - uses: ./.workflow/.github/actions/deployment-test - with: - sha: ${{ inputs.sha }} - platform: vercel - test-app-dir: ${{ inputs.test-app-dir }} - variant: ${{ inputs.variant }} diff --git a/.github/workflows/platform-test.yml b/.github/workflows/platform-test.yml new file mode 100644 index 000000000000..9c65b8701d90 --- /dev/null +++ b/.github/workflows/platform-test.yml @@ -0,0 +1,168 @@ +name: Platform Test + +on: + workflow_call: + inputs: + sha: + description: 'Commit SHA to test' + required: true + type: string + platform: + description: 'netlify or vercel' + required: true + type: string + variant: + description: 'Name of the test app variant' + required: true + type: string + app: + description: 'Directory of the test app' + required: true + type: string + +permissions: + contents: read + +env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' + APP: packages/adapter-${{ inputs.platform }}/test/apps/${{ inputs.app }} + +defaults: + run: + shell: bash + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - &checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ inputs.sha }} + persist-credentials: false + + # reads the pnpm version from the commit under test: `main` is on v10, `version-3` on v12 + - &pnpm + uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 + + - &node + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: 24 + + - &install + name: Install dependencies + run: pnpm install --frozen-lockfile + + # TODO: only adapter-netlify on `main` has a build script, remove this step after the v3 release + - name: Build adapter + env: + PLATFORM: ${{ inputs.platform }} + run: pnpm --filter "@sveltejs/adapter-$PLATFORM" --if-present build + + - name: Build test app + working-directory: ${{ env.APP }} + env: + EDGE: ${{ inputs.variant == 'split-edge' }} + run: pnpm build + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: ${{ inputs.platform }}-${{ inputs.variant }} + # whichever of these the adapter wrote, relative to the test app + path: | + ${{ env.APP }}/build + ${{ env.APP }}/.netlify + ${{ env.APP }}/.vercel + include-hidden-files: true + if-no-files-found: error + retention-days: 1 + + deploy: + needs: build + runs-on: ubuntu-latest + timeout-minutes: 15 + environment: '@sveltejs/adapter-${{ inputs.platform }} platform tests' + steps: + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ inputs.platform }}-${{ inputs.variant }} + + - uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0 + with: + version: ^12.0.0 + runtime: node@24 + + - name: Install Netlify CLI + if: inputs.platform == 'netlify' + run: pnpm i -g netlify-cli --allow-build=esbuild --allow-build=netlify-cli + + # the secrets are passed as flags and scrubbed from the environment the CLI bundles functions in + - name: Deploy to Netlify + if: inputs.platform == 'netlify' + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }} + NETLIFY_PROJECT_ID: ${{ inputs.variant == 'basic' && secrets.NETLIFY_PROJECT_ID_BASIC || inputs.variant == 'edge' && secrets.NETLIFY_PROJECT_ID_EDGE || secrets.NETLIFY_PROJECT_ID_SPLIT }} + run: | + env -u NETLIFY_AUTH_TOKEN -u NETLIFY_PROJECT_ID \ + netlify deploy --json --no-build --dir=build --functions=.netlify/v1/functions \ + --auth="$NETLIFY_AUTH_TOKEN" --site="$NETLIFY_PROJECT_ID" \ + | tee /dev/stderr | jq -er '.deploy_url' > url + + - name: Install Vercel CLI + if: inputs.platform == 'vercel' + run: pnpm i -g vercel + + # Important: When setting up a new Vercel test app, make sure + # to set the root directory in the dashboard to the correct path. + - name: Deploy to Vercel + if: inputs.platform == 'vercel' + env: &vercel-secrets + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ inputs.variant == 'basic' && secrets.VERCEL_PROJECT_ID_BASIC || secrets.VERCEL_PROJECT_ID_SPLIT }} + run: vercel deploy --prebuilt --yes --token="$VERCEL_TOKEN" > url + + # avoid stale cache results when testing ISR routes + - name: Purge Vercel CDN Cache + if: inputs.platform == 'vercel' && inputs.variant == 'basic' + env: *vercel-secrets + run: vercel cache purge --type cdn --token="$VERCEL_TOKEN" --yes + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: ${{ inputs.platform }}-${{ inputs.variant }}-url + path: url + if-no-files-found: error + retention-days: 1 + + test: + needs: deploy + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - *checkout + - *pnpm + - *node + - *install + + - name: Install Playwright + run: pnpm playwright install chromium --no-shell + + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ inputs.platform }}-${{ inputs.variant }}-url + path: ${{ runner.temp }} + + - name: Run Playwright tests + working-directory: ${{ env.APP }} + run: DEPLOYMENT_URL=$(cat "$RUNNER_TEMP/url") pnpm test:platform + + - name: Upload test artifacts + if: failure() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: test-results-${{ inputs.platform }}-${{ inputs.variant }} + path: ${{ env.APP }}/test-results + retention-days: 3 diff --git a/.github/workflows/platform-tests-all.yml b/.github/workflows/platform-tests-all.yml index 3b54b30aac21..13bc01dea730 100644 --- a/.github/workflows/platform-tests-all.yml +++ b/.github/workflows/platform-tests-all.yml @@ -7,59 +7,127 @@ on: description: 'Commit SHA to test and update check status on' required: false default: '' + platform: + description: 'Platform to test' + type: choice + options: [all, netlify, vercel, node] + default: all permissions: - contents: write + contents: read + +env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' jobs: - vercel: - uses: ./.github/workflows/platform-tests-vercel.yml + netlify: + name: netlify / ${{ matrix.variant }} + if: github.repository == 'sveltejs/kit' && (inputs.platform == 'all' || inputs.platform == 'netlify') + strategy: + fail-fast: false + matrix: + variant: [basic, edge, split] + include: + - variant: split-edge + app: split + uses: ./.github/workflows/platform-test.yml with: - sha: ${{ inputs.sha }} + sha: ${{ inputs.sha || github.sha }} + platform: netlify + variant: ${{ matrix.variant }} + app: ${{ matrix.app || matrix.variant }} + # the secrets of a job's environment only resolve in a called workflow when the caller passes `secrets` secrets: inherit - netlify: - uses: ./.github/workflows/platform-tests-netlify.yml + vercel: + name: vercel / ${{ matrix.variant }} + if: github.repository == 'sveltejs/kit' && (inputs.platform == 'all' || inputs.platform == 'vercel') + strategy: + fail-fast: false + matrix: + variant: [basic, split] + uses: ./.github/workflows/platform-test.yml with: - sha: ${{ inputs.sha }} + sha: ${{ inputs.sha || github.sha }} + platform: vercel + variant: ${{ matrix.variant }} + app: ${{ matrix.variant }} secrets: inherit node: - uses: ./.github/workflows/platform-tests-node.yml - with: - sha: ${{ inputs.sha }} - secrets: inherit + name: node / ${{ matrix.node-version }} + if: github.repository == 'sveltejs/kit' && (inputs.platform == 'all' || inputs.platform == 'node') + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + fail-fast: false + matrix: + node-version: [22, 24] + environment: '@sveltejs/adapter-node platform tests' + env: + APP: packages/adapter-node/test/apps/basic + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ inputs.sha || github.sha }} + persist-credentials: false + + - uses: ./.github/actions/node-setup + with: + node-version: ${{ matrix.node-version }} + + - name: Build adapter-node files + working-directory: packages/adapter-node + run: pnpm prepublishOnly + + - name: Install Playwright + run: pnpm playwright install chromium --no-shell + + - name: Run Playwright tests + working-directory: ${{ env.APP }} + run: pnpm test:platform + + - name: Upload test artifacts + if: failure() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: test-results-node-${{ matrix.node-version }} + path: ${{ env.APP }}/test-results + retention-days: 3 report-status: - if: always() - needs: [vercel, netlify, node] + if: always() && github.repository == 'sveltejs/kit' && inputs.platform == 'all' + needs: [netlify, vercel, node] runs-on: ubuntu-latest + permissions: + contents: write steps: - - name: Determine outcome - id: outcome - run: | - if [ "${{ contains(needs.*.result, 'failure') }}" = "true" ]; then - echo "conclusion=failure" >> "$GITHUB_OUTPUT" - echo "title=Platform tests failed" >> "$GITHUB_OUTPUT" - echo "summary=One or more platform test jobs failed. See the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details." >> "$GITHUB_OUTPUT" - elif [ "${{ contains(needs.*.result, 'cancelled') }}" = "true" ]; then - echo "conclusion=cancelled" >> "$GITHUB_OUTPUT" - echo "title=Platform tests cancelled" >> "$GITHUB_OUTPUT" - echo "summary=Platform tests were cancelled before completing." >> "$GITHUB_OUTPUT" - else - echo "conclusion=success" >> "$GITHUB_OUTPUT" - echo "title=Platform tests passed" >> "$GITHUB_OUTPUT" - echo "summary=All platform test jobs passed." >> "$GITHUB_OUTPUT" - fi - - name: Report results env: GH_TOKEN: ${{ github.token }} + SHA: ${{ inputs.sha || github.sha }} + CONCLUSION: ${{ contains(needs.*.result, 'failure') && 'failure' || contains(needs.*.result, 'cancelled') && 'cancelled' || 'success' }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} run: | - gh api repos/${{ github.repository }}/dispatches \ + case "$CONCLUSION" in + failure) + title='Platform tests failed' + summary="One or more platform test jobs failed. See the [workflow run]($RUN_URL) for details." + ;; + cancelled) + title='Platform tests cancelled' + summary='Platform tests were cancelled before completing.' + ;; + success) + title='Platform tests passed' + summary='All platform test jobs passed.' + ;; + esac + + gh api "repos/$GITHUB_REPOSITORY/dispatches" \ -f event_type=platform-tests-result \ - -f 'client_payload[sha]=${{ inputs.sha || github.sha }}' \ - -f 'client_payload[conclusion]=${{ steps.outcome.outputs.conclusion }}' \ - -f 'client_payload[title]=${{ steps.outcome.outputs.title }}' \ - -f 'client_payload[summary]=${{ steps.outcome.outputs.summary }}' \ - -f 'client_payload[details_url]=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}' + -f "client_payload[sha]=$SHA" \ + -f "client_payload[conclusion]=$CONCLUSION" \ + -f "client_payload[title]=$title" \ + -f "client_payload[summary]=$summary" \ + -f "client_payload[details_url]=$RUN_URL" diff --git a/.github/workflows/platform-tests-netlify.yml b/.github/workflows/platform-tests-netlify.yml deleted file mode 100644 index f6246488a7ae..000000000000 --- a/.github/workflows/platform-tests-netlify.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Platform Tests (Netlify) - -on: - workflow_dispatch: - inputs: - sha: - description: 'Commit SHA to test' - required: false - default: '' - workflow_call: - inputs: - sha: - description: 'Commit SHA to test' - required: false - type: string - default: '' - -permissions: - contents: read - -jobs: - basic: - if: github.repository == 'sveltejs/kit' - uses: ./.github/workflows/platform-test-netlify.yml - with: - sha: ${{ inputs.sha || github.sha }} - variant: basic - test-app-dir: packages/adapter-netlify/test/apps/basic - secrets: inherit - - edge: - if: github.repository == 'sveltejs/kit' - uses: ./.github/workflows/platform-test-netlify.yml - with: - sha: ${{ inputs.sha || github.sha }} - variant: edge - test-app-dir: packages/adapter-netlify/test/apps/edge - secrets: inherit - - split: - if: github.repository == 'sveltejs/kit' - uses: ./.github/workflows/platform-test-netlify.yml - with: - sha: ${{ inputs.sha || github.sha }} - variant: split - test-app-dir: packages/adapter-netlify/test/apps/split - secrets: inherit - - split-edge: - if: github.repository == 'sveltejs/kit' - uses: ./.github/workflows/platform-test-netlify.yml - with: - sha: ${{ inputs.sha || github.sha }} - variant: split-edge - test-app-dir: packages/adapter-netlify/test/apps/split - edge: true - secrets: inherit diff --git a/.github/workflows/platform-tests-node.yml b/.github/workflows/platform-tests-node.yml deleted file mode 100644 index 6b375d255162..000000000000 --- a/.github/workflows/platform-tests-node.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Platform Tests (Node) - -on: - workflow_dispatch: - inputs: - sha: - description: 'Commit SHA to test' - required: false - default: '' - workflow_call: - inputs: - sha: - description: 'Commit SHA to test' - required: false - type: string - default: '' - -permissions: - contents: read - -env: - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' - -jobs: - test-basic: - if: github.repository == 'sveltejs/kit' - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [22, 24] - environment: '@sveltejs/adapter-node platform tests' - steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - with: - ref: ${{ inputs.sha || github.sha }} - - - uses: ./.github/actions/node-setup - with: - node-version: ${{ matrix.node-version }} - - - name: Build adapter-node files - working-directory: packages/adapter-node - run: pnpm prepublishOnly - - - uses: ./.github/actions/node-test - with: - test-app-dir: packages/adapter-node/test/apps/basic diff --git a/.github/workflows/platform-tests-vercel.yml b/.github/workflows/platform-tests-vercel.yml deleted file mode 100644 index ae4e682899cf..000000000000 --- a/.github/workflows/platform-tests-vercel.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Platform Tests (Vercel) - -on: - workflow_dispatch: - inputs: - sha: - description: 'Commit SHA to test' - required: false - default: '' - workflow_call: - inputs: - sha: - description: 'Commit SHA to test' - required: false - type: string - default: '' - -permissions: - contents: read - -jobs: - basic: - if: github.repository == 'sveltejs/kit' - uses: ./.github/workflows/platform-test-vercel.yml - with: - sha: ${{ inputs.sha || github.sha }} - variant: basic - test-app-dir: packages/adapter-vercel/test/apps/basic - purge-cache: true - secrets: inherit - - split: - if: github.repository == 'sveltejs/kit' - uses: ./.github/workflows/platform-test-vercel.yml - with: - sha: ${{ inputs.sha || github.sha }} - variant: split - test-app-dir: packages/adapter-vercel/test/apps/split - secrets: inherit From 2141fbd91b71ccbec07cadabec012b577a85611b Mon Sep 17 00:00:00 2001 From: Nic Polumeyv <162764842+Nic-Polumeyv@users.noreply.github.com> Date: Sun, 20 Sep 2026 23:30:38 -0400 Subject: [PATCH 3/4] make the Vercel project root exist before deploying and give the test job the build output --- .github/workflows/platform-test.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/platform-test.yml b/.github/workflows/platform-test.yml index 9c65b8701d90..f82ddd649d5e 100644 --- a/.github/workflows/platform-test.yml +++ b/.github/workflows/platform-test.yml @@ -122,7 +122,10 @@ jobs: VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ inputs.variant == 'basic' && secrets.VERCEL_PROJECT_ID_BASIC || secrets.VERCEL_PROJECT_ID_SPLIT }} - run: vercel deploy --prebuilt --yes --token="$VERCEL_TOKEN" > url + # the CLI reads `.vercel/output` from here but checks that the project's root directory exists + run: | + mkdir -p "$APP" + vercel deploy --prebuilt --yes --token="$VERCEL_TOKEN" > url # avoid stale cache results when testing ISR routes - name: Purge Vercel CDN Cache @@ -150,6 +153,12 @@ jobs: - name: Install Playwright run: pnpm playwright install chromium --no-shell + # some tests inspect the build output + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ${{ inputs.platform }}-${{ inputs.variant }} + path: ${{ env.APP }} + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: ${{ inputs.platform }}-${{ inputs.variant }}-url From 4a9eb01686f330bb452f0862ee3cd440de1948ad Mon Sep 17 00:00:00 2001 From: Nic Polumeyv <162764842+Nic-Polumeyv@users.noreply.github.com> Date: Mon, 21 Sep 2026 00:04:21 -0400 Subject: [PATCH 4/4] install the CLI in one step and scope the Playwright env to the node job --- .github/workflows/platform-test.yml | 11 ++++------- .github/workflows/platform-tests-all.yml | 4 +--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/platform-test.yml b/.github/workflows/platform-test.yml index f82ddd649d5e..be98e791dcf9 100644 --- a/.github/workflows/platform-test.yml +++ b/.github/workflows/platform-test.yml @@ -94,9 +94,10 @@ jobs: version: ^12.0.0 runtime: node@24 - - name: Install Netlify CLI - if: inputs.platform == 'netlify' - run: pnpm i -g netlify-cli --allow-build=esbuild --allow-build=netlify-cli + - name: Install CLI + env: + CLI: ${{ inputs.platform == 'netlify' && 'netlify-cli' || 'vercel' }} + run: pnpm i -g "$CLI" --allow-build=esbuild --allow-build=netlify-cli # the secrets are passed as flags and scrubbed from the environment the CLI bundles functions in - name: Deploy to Netlify @@ -110,10 +111,6 @@ jobs: --auth="$NETLIFY_AUTH_TOKEN" --site="$NETLIFY_PROJECT_ID" \ | tee /dev/stderr | jq -er '.deploy_url' > url - - name: Install Vercel CLI - if: inputs.platform == 'vercel' - run: pnpm i -g vercel - # Important: When setting up a new Vercel test app, make sure # to set the root directory in the dashboard to the correct path. - name: Deploy to Vercel diff --git a/.github/workflows/platform-tests-all.yml b/.github/workflows/platform-tests-all.yml index 13bc01dea730..349688bc4461 100644 --- a/.github/workflows/platform-tests-all.yml +++ b/.github/workflows/platform-tests-all.yml @@ -16,9 +16,6 @@ on: permissions: contents: read -env: - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' - jobs: netlify: name: netlify / ${{ matrix.variant }} @@ -65,6 +62,7 @@ jobs: node-version: [22, 24] environment: '@sveltejs/adapter-node platform tests' env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' APP: packages/adapter-node/test/apps/basic steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1