1240cda484
### Why? They used the `node16` runner which is deprecated ### Notable breaking changes #### `dessant/lock-threads@v5` [link](https://github.com/dessant/lock-threads) Now also locks discussions (in addition to issues and pull requests): https://github.com/dessant/lock-threads/blob/main/CHANGELOG.md#500-2023-11-14 #### `actions/stale@v9` [link](https://github.com/actions/stale) Is now stateful: If the action ends because of [operations-per-run](https://github.com/actions/stale#operations-per-run) then the next run will start from the first unprocessed issue skipping the issues processed during the previous run(s). https://github.com/actions/stale/releases/tag/v9.0.0 Closes PACK-2347 Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
135 lines
6.2 KiB
YAML
135 lines
6.2 KiB
YAML
# Reusable workflow to setup next.js integration test environment.
|
|
name: Setup Next.js
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
# Allow to specify Next.js version to run integration test against.
|
|
# If not specified, will use latest release version including canary.
|
|
version:
|
|
type: string
|
|
|
|
jobs:
|
|
build_nextjs:
|
|
name: Build Next.js for the turbopack integration test
|
|
runs-on: ubuntu-latest-16-core-oss
|
|
outputs:
|
|
output1: ${{ steps.build-next-swc-turbopack-patch.outputs.success }}
|
|
steps:
|
|
- name: Get number of CPU cores
|
|
uses: SimenB/github-actions-cpu-cores@v2
|
|
id: cpu-cores
|
|
|
|
- name: 'Setup Rust toolchain'
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Display runner information
|
|
run: echo runner cpu count ${{ steps.cpu-cores.outputs.count }}
|
|
|
|
- name: Find Next.js latest release version
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
# Grab the latest release version from next.js repo, including prelease. `/releases/latest` will only return latest stable release.
|
|
echo NEXJS_LATEST_VERSION=$(gh release --repo vercel/next.js --limit 1 list | sed -n 1p | awk '{print $1}') >> $GITHUB_ENV
|
|
|
|
- name: Set Next.js release version
|
|
run: |
|
|
echo "NEXTJS_VERSION=${{ inputs.version != '' && inputs.version || env.NEXJS_LATEST_VERSION }}" >> $GITHUB_ENV
|
|
|
|
- name: Print Next.js release version to checkout
|
|
run: echo "Checking out Next.js ${{ env.NEXTJS_VERSION }}"
|
|
|
|
# https://github.com/actions/virtual-environments/issues/1187
|
|
- name: tune linux network
|
|
run: sudo ethtool -K eth0 tx off rx off
|
|
|
|
- name: Checkout Next.js
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: vercel/next.js
|
|
ref: ${{ env.NEXTJS_VERSION }}
|
|
|
|
- name: Checkout failed test lists
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: vercel/turbo
|
|
ref: nextjs-integration-test-data
|
|
path: integration-test-data
|
|
|
|
- name: Download binary
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
- uses: actions/cache/restore@v3
|
|
id: restore-build
|
|
with:
|
|
path: |
|
|
./*
|
|
key: ${{ inputs.version }}-${{ github.sha }}
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
wget https://github.com/sharkdp/hyperfine/releases/download/v1.16.1/hyperfine_1.16.1_amd64.deb
|
|
sudo dpkg -i hyperfine_1.16.1_amd64.deb
|
|
corepack enable
|
|
pnpm install --loglevel error
|
|
|
|
- name: Build next-swc with latest turbopack
|
|
id: build-next-swc-turbopack-patch
|
|
continue-on-error: true
|
|
run: |
|
|
export TURBOPACK_REMOTE="https://github.com/vercel/turbo"
|
|
# Apply patches to the cargo to the latest turbopack's sha.
|
|
# Basic recipe to apply patch to cargo via cli looks like this:
|
|
# cargo check --config 'patch."https://github.com/vercel/turbo".$PKG_NAME.git="https://github.com/vercel/turbo.git?rev=$SHA"'
|
|
# Careful to preserve quote to allow dot expression can access git url based property key.
|
|
export BINDING=$(printf 'patch.\\"%s\\".%s.git=\\"%s?rev=%s\\"' "$TURBOPACK_REMOTE" "turbopack-binding" "$TURBOPACK_REMOTE" "$GITHUB_SHA")
|
|
export TASKS=$(printf 'patch.\\"%s\\".%s.git=\\"%s?rev=%s\\"' "$TURBOPACK_REMOTE" "turbo-tasks" "$TURBOPACK_REMOTE" "$GITHUB_SHA")
|
|
export TASKS_FS=$(printf 'patch.\\"%s\\".%s.git=\\"%s?rev=%s\\"' "$TURBOPACK_REMOTE" "turbo-tasks-fs" "$TURBOPACK_REMOTE" "$GITHUB_SHA")
|
|
|
|
echo "Trying to build next-swc with turbopack $GITHUB_SHA"
|
|
hyperfine --min-runs 1 --show-output 'pnpm run --filter=@next/swc build-native --features plugin --release --cargo-flags="--config $BINDING --config $TASKS --config $TASKS_FS"'
|
|
echo "built=pass" >> $GITHUB_OUTPUT
|
|
echo "Successfully built next-swc with turbopack $GITHUB_SHA"
|
|
|
|
- name: Build next-swc
|
|
if: steps.build-next-swc-turbopack-patch.outputs.built != 'pass'
|
|
run: |
|
|
echo "Looks like we could not apply latest turbopack to next-swc. Trying to build next-swc with published turbopack. This might happen when there is a breaking changes in turbopack, and next.js is not yet updated."
|
|
hyperfine --min-runs 1 --show-output 'pnpm run --filter=@next/swc build-native --features plugin --release'
|
|
echo "Successfully built next-swc with published turbopack"
|
|
|
|
- name: Build next.js
|
|
run: |
|
|
pnpm run build
|
|
strip packages/next-swc/native/next-swc.*.node
|
|
ls -al packages/next-swc/native
|
|
# Reduce the size of the cache bit
|
|
cd packages/next-swc && cargo clean && cd ../../
|
|
echo NEXT_SWC_FILESIZE: $(stat -c %s packages/next-swc/native/next-swc.linux-x64-gnu.node)
|
|
node -e "console.log('Host', require('os').arch(), require('os').platform())"
|
|
|
|
# If input version is published release, detect version by running next.js build.
|
|
- name: Detects Next.js build version
|
|
run: |
|
|
# This is being used in github action to collect test results. Do not change it, or should update ./.github/actions/next-integration-test to match.
|
|
docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c 'curl https://install-node.vercel.app/v16 | FORCE=1 bash && cd /work && echo RUNNING NEXTJS VERSION: $(packages/next/dist/bin/next --version) && ls -al packages/next-swc/native && node -e "console.log(\"Container\", require(\"os\").arch(), require(\"os\").platform())"'
|
|
|
|
- name: Temporary test skip
|
|
run: |
|
|
rm -rf test/integration/jsconfig-paths/test/index.test.js
|
|
|
|
# Once build completes, creates a cache of the build output
|
|
# so subsequent job to actually execute tests can reuse it.
|
|
# Note that we do not use upload / download artifacts for this -
|
|
# it is too heavyweight for the purpose since we do not need to persist
|
|
# the cache across multiple runs.
|
|
- name: Store next.js build cache with next-swc
|
|
uses: actions/cache/save@v3
|
|
id: cache-build
|
|
with:
|
|
path: |
|
|
./*
|
|
key: ${{ inputs.version }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt}}-${{ github.run_number }}
|