diff --git a/.github/workflows/deno-test.yml b/.github/workflows/deno-test.yml deleted file mode 100644 index 803abf8e3a..0000000000 --- a/.github/workflows/deno-test.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Deno test -on: - pull_request: - branches: [main] -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Deno - uses: denoland/setup-deno@v1 - with: - deno-version: v1.x.x - - name: Vendor Deno modules - run: deno vendor edge-runtime/vendor.ts --output=edge-runtime/vendor --force - - name: Test - run: deno test -A edge-runtime/ diff --git a/.github/workflows/e2e-report.yml b/.github/workflows/e2e-report.yml deleted file mode 100644 index 78ea71d0ef..0000000000 --- a/.github/workflows/e2e-report.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: 'Deploy e2e test page' -on: - schedule: - - cron: '0 6 * * 3' # Run every Wednesday at 6am UTC - workflow_dispatch: - inputs: - use-branch: - description: 'Enable if you want to test data from your selected branch instead of the scheduled test runs from Main' - type: boolean - version: - description: 'Version of Next.js (most recent test run must have included this version)' - type: choice - options: - - 'latest' - - 'canary' - - '14.2.15' - - '13.5.1' - default: 'latest' - -env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - NETLIFY_SITE_ID: ${{ vars.E2E_PAGE_SITE_ID }} - GH_TOKEN: ${{ github.token }} - -jobs: - setup: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Get run id - id: get-run-id - run: | - if [ "${{ inputs.use-branch }}" == "true" ]; then - E2E_RUN_ID=$(gh run list -w test-e2e.yml -s success -b $GITHUB_REF_NAME --json databaseId --jq ".[0].databaseId" --repo $GITHUB_REPOSITORY) - else - E2E_RUN_ID=$(gh run list -w test-e2e.yml -e schedule -s success --json databaseId --jq ".[0].databaseId" --repo $GITHUB_REPOSITORY) - fi - echo "runId=$E2E_RUN_ID" >> $GITHUB_OUTPUT - - name: Download e2e results - if: ${{ steps.get-run-id.outputs.runId }} - run: | - version="${{ inputs.version }}" - version=${version:-latest} - OUTPUT_DIR="e2e-report/data" - OUTPUT_FILENAME="test-results.json" - echo "Downloading ${version} test results from run https://github.com/opennextjs/opennextjs-netlify/actions/runs/${{ steps.get-run-id.outputs.runId }}" - rm "${OUTPUT_DIR}/${OUTPUT_FILENAME}" - artifact_name="${version}-test-results.json" - # NOTE: The artifact name is not necessarily the artifact *file* name. The file name here - # must be `test-results.json`, but this is defined at the artifact upload step. - gh run download ${{ steps.get-run-id.outputs.runId }} -n "${artifact_name}" -D "${OUTPUT_DIR}" --repo $GITHUB_REPOSITORY - - name: Install site dependencies - if: success() - run: | - npm ci - working-directory: e2e-report - - name: Deploy e2e page - if: success() - run: | - npx netlify deploy --build --cwd . - working-directory: e2e-report diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index d775481a99..0000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Lint - -on: - pull_request: - branches: - - main - -jobs: - lint: - name: Lint - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - fetch-depth: 0 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '18.x' - cache: 'npm' - cache-dependency-path: '**/package-lock.json' - - run: npm ci - - name: Check Format - run: npm run format:check - - name: Lint - # github adds inline annotation for compact or stylish format - # which is different than our default for local usage - run: npm run lint -- --format=compact - - name: Types - run: npm run typecheck - # we still want to check types if lint fails just to know everything - # and not peel errors to uncover new ones of different type - if: always() diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml deleted file mode 100644 index c523c269c4..0000000000 --- a/.github/workflows/pre-release.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: prerelease -on: - push: - branches: - # releases// - # releases/alpha.1/5.0.0 - will result in 5.0.0-alpha.1 - - releases/*/* -jobs: - prerelease: - runs-on: ubuntu-latest - permissions: - id-token: write - contents: write - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: lts/* - cache: npm - registry-url: 'https://registry.npmjs.org' - - name: Install core dependencies - run: npm ci --no-audit - - name: Install Deno - uses: denoland/setup-deno@v1 - with: - # Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20 - deno-version: v1.46.3 - - name: Extract tag and version - id: extract - run: |- - ref=${{ github.ref }} - branch=${ref:11} - tag_version=${branch:9} - tag=${tag_version%/*} - version=${tag_version##*/} - echo "tag=${tag}" >> $GITHUB_OUTPUT - echo "version=${version}" >> $GITHUB_OUTPUT - - name: Log versions - run: |- - echo tag=${{ steps.extract.outputs.tag }} - echo version=${{ steps.extract.outputs.version }} - - name: Setup git user - run: git config --global user.name github-actions - - name: Setup git email - run: git config --global user.email github-actions@github.com - - name: Run npm version - run: - npm version ${{ steps.extract.outputs.version }}-${{ steps.extract.outputs.tag }} - --allow-same-version - - name: Push changes - run: git push --follow-tags - - name: build - run: npm run build - - name: Run npm publish - run: npm publish --tag=${{ steps.extract.outputs.tag }} - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml deleted file mode 100644 index 16f08ab457..0000000000 --- a/.github/workflows/release-please.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: release-please -on: - push: - branches: - - main - -permissions: - contents: write - pull-requests: write - issues: write - id-token: write - -jobs: - release-please: - runs-on: ubuntu-latest - steps: - - uses: googleapis/release-please-action@v4 - id: release - - uses: actions/checkout@v4 - if: ${{ steps.release.outputs.release_created }} - - uses: actions/setup-node@v4 - with: - node-version: '*' - cache: 'npm' - check-latest: true - registry-url: 'https://registry.npmjs.org' - if: ${{ steps.release.outputs.release_created }} - - name: Install dependencies - run: CI=1 npm ci - if: ${{ steps.release.outputs.release_created }} - - name: Install Deno - uses: denoland/setup-deno@v1 - with: - # Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20 - deno-version: v1.46.3 - - name: Build - run: npm run build - if: ${{ steps.release.outputs.release_created }} - - run: npm publish --provenance - if: ${{ steps.release.outputs.release_created }} - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml deleted file mode 100644 index 96bce88839..0000000000 --- a/.github/workflows/run-tests.yml +++ /dev/null @@ -1,281 +0,0 @@ -name: 'Run tests' -on: - pull_request: - branches: [main] - schedule: - - cron: '0 6 * * *' # Run every day at 6am UTC - workflow_dispatch: - inputs: - versions: - description: 'The versions of Next.js to test against (quoted and comma separated)' - required: false - default: 'latest' - -jobs: - setup: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} - steps: - - name: Check PR labels - if: github.event_name == 'pull_request' - id: check-labels - uses: actions/github-script@v7 - with: - script: | - const { data: labels } = await github.rest.issues.listLabelsOnIssue({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - }); - return labels.some(label => label.name === 'autorelease: pending' || label.name === 'test all versions'); - - name: Set Next.js versions to test - id: set-matrix - # If this is the nightly build or a release PR then run the full matrix of versions - run: | - if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then - echo "matrix=${{ github.event.inputs.versions }}" >> $GITHUB_OUTPUT - elif [ "${{ github.event_name }}" = "schedule" ] || [ "${{ steps.check-labels.outputs.result }}" = "true" ]; then - echo "matrix=[\"latest\", \"canary\", \"14.2.15\", \"13.5.1\"]" >> $GITHUB_OUTPUT - else - echo "matrix=[\"latest\"]" >> $GITHUB_OUTPUT - fi - - e2e: - needs: setup - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - version: ${{ fromJson(needs.setup.outputs.matrix) }} - shard: [1, 2, 3, 4, 5] - - steps: - - uses: actions/checkout@v4 - - name: 'Install Node' - uses: actions/setup-node@v4 - with: - node-version: '18.x' - cache: 'npm' - cache-dependency-path: '**/package-lock.json' - - uses: oven-sh/setup-bun@v2 - - name: setup pnpm/yarn - run: | - npm install -g corepack - corepack enable - shell: bash - - name: Install Deno - uses: denoland/setup-deno@v1 - with: - # Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20 - deno-version: v1.46.3 - - name: 'Install dependencies' - run: npm ci - - name: 'Prepare Netlify CLI' - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - run: | - # Control netlify-cli as a regular dev dep but expose it globally for test fixtures to use - npm install -g "netlify-cli@$(npm list --json --depth=0 netlify-cli | jq -r ".dependencies[\"netlify-cli\"].version")" - npx netlify login - - name: Get installed Playwright version - id: playwright-version - run: echo "version=$(npm view @playwright/test version)" >> $GITHUB_OUTPUT - - uses: actions/cache@v4 - id: playwright-cache - with: - path: '~/.cache/ms-playwright' - key: '${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}' - restore-keys: | - ${{ runner.os }}-playwright- - - name: Install Playwright Browsers - if: steps.playwright-cache.outputs.cache-hit != 'true' - run: npx playwright install --with-deps - - name: Resolve Next.js version - id: resolve-next-version - shell: bash - run: | - RESOLVED_VERSION=$(npm view next@${{ matrix.version }} version) - echo "version=$RESOLVED_VERSION" >> $GITHUB_OUTPUT - echo "Resolved Next.js version for 'next@${{ matrix.version }}' is '$RESOLVED_VERSION'" - - name: Run Playwright tests - run: npm run test:ci:e2e -- --shard=${{ matrix.shard }}/5 - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - NEXT_VERSION: ${{ matrix.version }} - NEXT_RESOLVED_VERSION: ${{ steps.resolve-next-version.outputs.version }} - - name: Upload blob report to GitHub Actions Artifacts - uses: actions/upload-artifact@v4 - if: always() - with: - name: blob-report-${{matrix.version}}-${{ matrix.shard }} - path: blob-report - retention-days: 1 - - test: - needs: setup - strategy: - fail-fast: false - matrix: - shard: [1, 2, 3, 4, 5, 6, 7, 8] - os: [ubuntu-latest, windows-2025] - version: ${{ fromJson(needs.setup.outputs.matrix) }} - exclude: - - os: windows-2025 - version: '13.5.1' - - os: windows-2025 - version: '14.2.15' - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - name: 'Install Node' - uses: actions/setup-node@v4 - with: - node-version: '18.x' - cache: 'npm' - cache-dependency-path: '**/package-lock.json' - - name: Prefer npm global on windows - if: runner.os == 'Windows' - # On Windows by default PATH prefers corepack bundled with Node.js - # This prepends npm global to PATH to ensure that npm installed global corepack is used instead - run: | - echo "$(npm config get prefix)" >> "$GITHUB_PATH" - shell: bash - - name: setup pnpm/yarn - run: | - # global corepack installation requires --force on Windows, otherwise EEXIST errors occur - npm install -g corepack --force - corepack enable - shell: bash - - name: Install Deno - uses: denoland/setup-deno@v1 - with: - # Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/edge-bundler/blob/e55f825bd985d3c92e21d1b765d71e70d5628fba/node/bridge.ts#L17 - deno-version: v1.46.3 - - name: 'Install dependencies' - run: npm ci - - name: 'Build' - run: npm run build - - name: 'Vendor deno helpers for integration tests' - run: node tools/vendor-deno-tools.js - - name: Resolve Next.js version - id: resolve-next-version - shell: bash - run: | - RESOLVED_VERSION=$(npm view next@${{ matrix.version }} version) - echo "version=$RESOLVED_VERSION" >> $GITHUB_OUTPUT - echo "Resolved Next.js version for 'next@${{ matrix.version }}' is '$RESOLVED_VERSION'" - - name: Compute Fixtures Cache Key - id: fixture-cache-key - # Fixtures only need to be rebuilt if either fixture or support files change, - # so we're using a hash of the fixtures and support files as the cache key. - run: - echo "key=$(git ls-files -s tests/fixtures/ tests/utils/ tests/prepare.mjs | git hash-object --stdin)" - >> "$GITHUB_OUTPUT" - shell: bash - - name: Cache Fixtures - id: cache-fixtures - uses: actions/cache@v4 - with: - path: tests/fixtures - key: - integration-fixtures-${{ runner.os }}-${{steps.resolve-next-version.outputs.version}}-${{ - steps.fixture-cache-key.outputs.key }} - - name: 'Prepare Fixtures' - if: steps.cache-fixtures.outputs.cache-hit != 'true' - run: npm run pretest - env: - NEXT_VERSION: ${{ matrix.version }} - NEXT_RESOLVED_VERSION: ${{ steps.resolve-next-version.outputs.version }} - - name: 'Unit and integration tests' - run: npm run test:ci:unit-and-integration -- --shard=${{ matrix.shard }}/8 - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - NEXT_VERSION: ${{ matrix.version }} - NEXT_RESOLVED_VERSION: ${{ steps.resolve-next-version.outputs.version }} - TEMP: ${{ github.workspace }}/.. - - smoke: - if: always() - needs: setup - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - version: ${{ fromJson(needs.setup.outputs.matrix) }} - steps: - - uses: actions/checkout@v4 - - name: 'Install Node' - uses: actions/setup-node@v4 - with: - node-version: '18.x' - cache: 'npm' - cache-dependency-path: '**/package-lock.json' - - name: setup pnpm/yarn - run: corepack enable - shell: bash - - name: Install Deno - uses: denoland/setup-deno@v1 - with: - # Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20 - deno-version: v1.46.3 - - name: 'Install dependencies' - run: npm ci - - name: 'Build' - run: npm run build - - name: 'Prepare Netlify CLI' - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - run: | - # Control netlify-cli as a regular dev dep but expose it globally for test fixtures to use - npm install -g "netlify-cli@$(npm list --json --depth=0 netlify-cli | jq -r ".dependencies[\"netlify-cli\"].version")" - npx netlify login - - name: Resolve Next.js version - id: resolve-next-version - shell: bash - run: | - RESOLVED_VERSION=$(npm view next@${{ matrix.version }} version) - echo "version=$RESOLVED_VERSION" >> $GITHUB_OUTPUT - echo "Resolved Next.js version for 'next@${{ matrix.version }}' is '$RESOLVED_VERSION'" - - name: 'Smoke tests' - run: npm run test:ci:smoke - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - NEXT_VERSION: ${{ matrix.version }} - NEXT_RESOLVED_VERSION: ${{ steps.resolve-next-version.outputs.version }} - - merge-reports: - if: always() - needs: [setup,e2e] - strategy: - fail-fast: false - matrix: - version: ${{ fromJson(needs.setup.outputs.matrix) }} - - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18 - - name: Install dependencies - run: npm ci - - - name: Download blob reports from GitHub Actions Artifacts - uses: actions/download-artifact@v4 - with: - path: all-blob-reports - pattern: blob-report-${{ matrix.version }}-* - merge-multiple: true - - - name: Merge reports - run: | - npx playwright merge-reports --reporter html ./all-blob-reports - npx playwright merge-reports --reporter json ./all-blob-reports > merged_reports.json - - - name: Upload HTML report - uses: actions/upload-artifact@v4 - with: - name: html-report-${{ matrix.version }}-attempt-${{ github.run_attempt }} - path: playwright-report - retention-days: 14 diff --git a/.github/workflows/size-check.yml b/.github/workflows/size-check.yml index 7a61c3308c..59c50a63da 100644 --- a/.github/workflows/size-check.yml +++ b/.github/workflows/size-check.yml @@ -20,16 +20,20 @@ jobs: node-version: '18.x' cache: 'npm' cache-dependency-path: '**/package-lock.json' + - name: Install Deno uses: denoland/setup-deno@v1 with: # Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20 - deno-version: v1.46.3 - - run: npm ci + deno-version: v2.2.4 + + - name: 'Install dependencies' + run: npm ci - name: Package size report - uses: pkg-size/action@v1 + uses: pieh/pkg-size-action@develop env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: display-size: uncompressed, gzip + mode: head-only diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml deleted file mode 100644 index 1e9d847535..0000000000 --- a/.github/workflows/test-e2e.yml +++ /dev/null @@ -1,265 +0,0 @@ -name: Run Next.js repo tests - -on: - workflow_call: - pull_request: - branches: [main] - schedule: - - cron: '0 3 * * *' # Run every day at 3am UTC - workflow_dispatch: - inputs: - versions: - description: 'The versions of Next.js to test against (escape-quoted and comma separated)' - required: false - # TODO(serhalp) Ideally this would simply accept bare quotes but we're having trouble - # parsing that so this will do for now. - default: "\\\"latest\\\"" -concurrency: - group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} - cancel-in-progress: true - -env: - NODE_VERSION: 18.18.0 - PNPM_VERSION: 8.9.0 - NEXT_REPO: vercel/next.js - NEXT_TEST_MODE: deploy - NEXT_JUNIT_TEST_REPORT: true - # In older versions of Next.js both of these need to be set to enable junit reporting - DATADOG_TRACE_NEXTJS_TEST: true - DATADOG_API_KEY: foo - TEST_CONCURRENCY: 2 - NEXT_E2E_TEST_TIMEOUT: 300000 - NEXT_TELEMETRY_DISABLED: 1 - NEXT_SKIP_NATIVE_POSTINSTALL: 1 - TURBO_API: ${{ secrets.TURBO_API }} - TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} - TURBO_TEAM: next-runtime-minimal - TURBO_TEAMID: team_netlify - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - NETLIFY_SITE_ID: 1d5a5c76-d445-4ae5-b694-b0d3f2e2c395 - NEXT_TEST_CONTINUE_ON_ERROR: 1 - # There's no benefit to cleaning up local site fixture copies in tmp dirs in CI. It wastes precious time. - # Deleting deploys is also unnecessary as they will get cleaned up naturally by Netlify. - E2E_PERSIST: 1 - next-path: next.js - runtime-path: opennextjs-netlify - GH_TOKEN: ${{ github.token }} -jobs: - setup: - runs-on: ubuntu-latest - if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'run-e2e-tests')) }} - outputs: - version_spec: ${{ steps.set-matrix.outputs.version_spec }} - group: ${{ steps.set-matrix.outputs.group }} - total: ${{ steps.set-matrix.outputs.total }} - steps: - - - name: Set Next.js versions to test - id: set-matrix - run: | - if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then - VERSION_SELECTORS=[${{ github.event.inputs.versions }}] - echo "group=[1, 2, 3, 4, 5, 6, 7, 8]" >> $GITHUB_OUTPUT - echo "total=8" >> $GITHUB_OUTPUT - elif [ "${{ github.event_name }}" == "pull_request" ]; then - VERSION_SELECTORS=[\"latest\"] - echo "group=[1, 2, 3, 4, 5, 6, 7, 8]" >> $GITHUB_OUTPUT - echo "total=8" >> $GITHUB_OUTPUT - else - VERSION_SELECTORS=[\"latest\",\"canary\"] - echo "group=[1, 2, 3, 4, 5, 6, 7, 8]" >> $GITHUB_OUTPUT - echo "total=8" >> $GITHUB_OUTPUT - fi - - VERSION_SPEC="[" - for QUOTED_SELECTOR in $(echo $VERSION_SELECTORS | jq -c '.[]'); do - SELECTOR=$(echo $QUOTED_SELECTOR | xargs) - if [ "${VERSION_SPEC}" != "[" ]; then - VERSION_SPEC+="," - fi - - VERSION=$(npm view next@$SELECTOR version) - TAG="v$VERSION" - - VERSION_SPEC+="{\"selector\":\"$SELECTOR\",\"tag\":\"$TAG\",\"version\":\"$VERSION\"}" - done - VERSION_SPEC+="]" - echo "version_spec=$VERSION_SPEC" >> $GITHUB_OUTPUT - - e2e: - needs: setup - # `playwright install` fails on Ubuntu 24.04+ with older versions of playwright (which 13.5.1 has) - runs-on: "${{ matrix.version_spec.selector == '13.5.1' && 'ubuntu-22.04' || 'ubuntu-latest' }}" - name: Test next@${{ matrix.version_spec.selector }} group ${{ matrix.group }}/${{ needs.setup.outputs.total }} - timeout-minutes: 120 - strategy: - fail-fast: false - matrix: - version_spec: ${{ fromJson(needs.setup.outputs.version_spec) }} - group: ${{ fromJson(needs.setup.outputs.group) }} - - steps: - - name: checkout Next.js repo - uses: actions/checkout@v4 - with: - repository: ${{ env.NEXT_REPO }} - path: ${{ env.next-path }} - ref: ${{ matrix.version_spec.tag }} - - - name: checkout runtime repo - uses: actions/checkout@v4 - with: - path: ${{ env.runtime-path }} - - - name: setup node - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: setup pnpm/yarn - run: corepack enable - - - name: get pnpm store - id: pnpm-store - run: echo "PATH=$(pnpm store path --silent)" >> ${GITHUB_OUTPUT} - - - name: cache pnpm deps - uses: actions/cache@v4 - with: - path: ${{ steps.pnpm-store.outputs.PATH }} - key: pnpm-store-${{ hashFiles('next.js/pnpm-lock.yaml') }} - restore-keys: | - pnpm-store- - - - name: get npm cache - id: npm-cache - run: echo "PATH=$(npm config get cache)" >> ${GITHUB_OUTPUT} - - - name: cache npm deps - uses: actions/cache@v4 - with: - path: ${{ steps.npm-cache.outputs.PATH }} - key: node-cache-${{ hashFiles('opennextjs-netlify/package-lock.json') }} - restore-keys: | - node-cache- - - - name: patch Next.js - run: | - cp ../${{ env.runtime-path }}/tests/netlify-deploy.ts test/lib/next-modes/ - git apply ../${{ env.runtime-path }}/tests/e2e-utils.patch || git apply ../${{ env.runtime-path }}/tests/e2e-utils-v2.patch - working-directory: ${{ env.next-path }} - - - name: install Next.js - run: pnpm install - working-directory: ${{ env.next-path }} - - - name: build Next.js - run: pnpm build - working-directory: ${{ env.next-path }} - - - name: install swc - run: pnpm add --workspace-root @next/swc-linux-x64-gnu@${{ matrix.version_spec.version }} - working-directory: ${{ env.next-path }} - - - name: Install Deno - uses: denoland/setup-deno@v1 - with: - # Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20 - deno-version: v1.46.3 - - - name: install runtime - run: npm install --ignore-scripts - working-directory: ${{ env.runtime-path }} - - - name: build runtime - run: npm run build - working-directory: ${{ env.runtime-path }} - - - name: Prepare Netlify CLI - # Control netlify-cli as a regular dev dep but expose it globally for test fixtures to use - run: npm install -g "netlify-cli@$(npm list --json --depth=0 netlify-cli | jq -r ".dependencies[\"netlify-cli\"].version")" - working-directory: ${{ env.runtime-path }} - - - name: Install Playwright Browsers - run: npx playwright install --with-deps - working-directory: ${{ env.next-path }} - - - name: Get test filters - id: test-filters - run: | - # This is when the manifest version was changed - if [ `npx semver -p -r ">=14.0.4-canary.26" ${{ matrix.version_spec.version }}` ]; then - echo "filters=../opennextjs-netlify/tests/netlify-e2e.cjs" >> $GITHUB_OUTPUT - echo "skip-retry=../opennextjs-netlify/tests/e2e-skip-retry.json" >> $GITHUB_OUTPUT - else - echo "filters=../opennextjs-netlify/tests/netlify-e2e-legacy.json" >> $GITHUB_OUTPUT - echo "skip-retry=../opennextjs-netlify/tests/e2e-skip-retry-legacy.json" >> $GITHUB_OUTPUT - fi - - - name: run tests - env: - NODE_ENV: production - NEXT_EXTERNAL_TESTS_FILTERS: ${{ steps.test-filters.outputs.filters }} - NEXT_TEST_SKIP_RETRY_MANIFEST: ${{ steps.test-filters.outputs.skip-retry }} - # Use a unique alias per test matrix group and shard. Otherwise, a deploy within - # one job may wait for deploys in other jobs (only one deploy may be in progress for - # a given alias at a time), resulting in cascading timeouts. - DEPLOY_ALIAS: vercel-next-e2e-${{ matrix.version_spec.selector }}-${{ matrix.group }} - run: node run-tests.js -g ${{ matrix.group }}/${{ needs.setup.outputs.total }} -c ${TEST_CONCURRENCY} --type e2e - working-directory: ${{ env.next-path }} - - - name: Upload Test Results - if: success() || failure() - uses: actions/upload-artifact@v4 - with: - name: test-result-${{matrix.version_spec.selector}}-${{ matrix.group }} - path: ${{ env.next-path }}/test/test-junit-report/*.xml - publish-test-results: - name: 'E2E Test Summary (${{matrix.version_spec.selector}})' - needs: - - e2e - - setup - runs-on: ubuntu-latest - permissions: - checks: write - contents: read - issues: read - if: success() || failure() - strategy: - matrix: - version_spec: ${{ fromJson(needs.setup.outputs.version_spec) }} - - steps: - - name: checkout runtime repo - uses: actions/checkout@v4 - - - name: Install Deno - uses: denoland/setup-deno@v1 - - - name: Download Artifacts - uses: actions/download-artifact@v4 - with: - pattern: test-result-${{matrix.version_spec.selector}}-* - path: artifacts - - - name: Get and format Github issues - if: success() || failure() - run: | - gh issue list --label "Next.js e2e test failure" --json url,body > report/issues.json - deno run -A tools/deno/ghIssues2json.ts tests/test-config.json report/issues.json - - - name: Publish Test Report - id: publish-test-results - if: success() || failure() - run: | - deno run -A tools/deno/junit2json.ts artifacts ${{ matrix.version_spec.tag }} > report/test-results.json - deno run -A tools/deno/generate-md.ts >> $GITHUB_STEP_SUMMARY - - - name: Upload Test JSON - uses: actions/upload-artifact@v4 - with: - # TODO(serhalp) Consider renaming this. It's misleading, since it's just an identifier, - # but it's formatted like a filename, and happens to be almost - but not quite - the - # actual filename. - name: ${{matrix.version_spec.selector}}-test-results.json - path: report/test-results.json diff --git a/deno.json b/edge-runtime/deno.json similarity index 76% rename from deno.json rename to edge-runtime/deno.json index 561c910ed5..fa5e81d84c 100644 --- a/deno.json +++ b/edge-runtime/deno.json @@ -7,5 +7,5 @@ "imports": { "@netlify/edge-functions": "https://edge.netlify.com/v1/index.ts" }, - "importMap": "./edge-runtime/vendor/import_map.json" + "vendor": true } diff --git a/edge-runtime/lib/logging.ts b/edge-runtime/lib/logging.ts index b2b60f2a12..62d24bf892 100644 --- a/edge-runtime/lib/logging.ts +++ b/edge-runtime/lib/logging.ts @@ -2,4 +2,4 @@ export { logger, LogLevel, StructuredLogger, -} from '../vendor/v1-7-0--edge-utils.netlify.app/logger/mod.ts' +} from 'https://v1-7-0--edge-utils.netlify.app/logger/mod.ts' diff --git a/edge-runtime/lib/middleware.ts b/edge-runtime/lib/middleware.ts index f2ed78e861..910aa90bfc 100644 --- a/edge-runtime/lib/middleware.ts +++ b/edge-runtime/lib/middleware.ts @@ -1,7 +1,7 @@ import type { Context } from '@netlify/edge-functions' -import type { ElementHandlers } from '../vendor/deno.land/x/htmlrewriter@v1.0.0/src/index.ts' -import { getCookies } from '../vendor/deno.land/std@0.175.0/http/cookie.ts' +import type { ElementHandlers } from 'https://deno.land/x/htmlrewriter@v1.0.0/src/index.ts' +import { getCookies } from 'https://deno.land/x/std@0.175.0/http/cookie.ts' type NextDataTransform = (data: T) => T diff --git a/edge-runtime/lib/response.ts b/edge-runtime/lib/response.ts index 31bb7ead7b..54546367dc 100644 --- a/edge-runtime/lib/response.ts +++ b/edge-runtime/lib/response.ts @@ -1,8 +1,5 @@ import type { Context } from '@netlify/edge-functions' -import { - HTMLRewriter, - type TextChunk, -} from '../vendor/deno.land/x/htmlrewriter@v1.0.0/src/index.ts' +import { HTMLRewriter, type TextChunk } from 'https://deno.land/x/htmlrewriter@v1.0.0/src/index.ts' import { updateModifiedHeaders } from './headers.ts' import type { StructuredLogger } from './logging.ts' diff --git a/edge-runtime/lib/routing.ts b/edge-runtime/lib/routing.ts index e9fbaf137c..804b6c5315 100644 --- a/edge-runtime/lib/routing.ts +++ b/edge-runtime/lib/routing.ts @@ -5,10 +5,10 @@ * Some types have been re-implemented to be more compatible with Deno or avoid chains of dependent files */ -import type { Key } from '../vendor/deno.land/x/path_to_regexp@v6.2.1/index.ts' +import type { Key } from 'https://deno.land/x/path_to_regexp@v6.2.1/index.ts' -import { compile, pathToRegexp } from '../vendor/deno.land/x/path_to_regexp@v6.2.1/index.ts' -import { getCookies } from '../vendor/deno.land/std@0.175.0/http/cookie.ts' +import { compile, pathToRegexp } from 'https://deno.land/x/path_to_regexp@v6.2.1/index.ts' +import { getCookies } from 'https://deno.land/std@0.175.0/http/cookie.ts' /* ┌─────────────────────────────────────────────────────────────────────────┐ diff --git a/tools/build-helpers.js b/tools/build-helpers.js index 0d2feb0f06..29ec16bd6f 100644 --- a/tools/build-helpers.js +++ b/tools/build-helpers.js @@ -34,12 +34,11 @@ export async function vendorDeno({ if (initEmptyDenoJson) { const denoJsonPath = join(cwd, 'deno.json') console.log(`🧹 Generating clean '${denoJsonPath}`) - await writeFile(denoJsonPath, '{}') + await writeFile(denoJsonPath, '{ "vendor": true }') } console.log(`📦 Vendoring Deno modules for '${vendorSource}' into '${vendorDest}'...`) - // --output=${vendorDest} - await execaCommand(`deno vendor ${vendorSource} --force`, { + await execaCommand(`deno --allow-import ${vendorSource}`, { cwd, }) @@ -50,7 +49,7 @@ export async function vendorDeno({ // see https://github.com/denoland/deno/issues/14123 // to workaround this we copy the wasm files manually // (note Deno 2 allows to vendor wasm files, but it also require modules to import them and not fetch and instantiate them - // se being able to drop downloading is dependent on implementation of wasm handling in external modules as well) + // so being able to drop downloading is dependent on implementation of wasm handling in external modules as well) await Promise.all( wasmFilesToDownload.map(async (urlString) => { const url = new URL(urlString)