Skip to content

[Snyk] Security upgrade tailwindcss from 2.1.4 to 2.2.0 #3698

[Snyk] Security upgrade tailwindcss from 2.1.4 to 2.2.0

[Snyk] Security upgrade tailwindcss from 2.1.4 to 2.2.0 #3698

on:
push:
branches: [canary]
pull_request:
types: [opened, synchronize]
name: Build, test, and deploy
env:
NAPI_CLI_VERSION: 2.7.0
TURBO_VERSION: 1.3.2-canary.1
RUST_TOOLCHAIN: nightly-2022-06-12
PNPM_VERSION: 7.2.1
jobs:
check-examples:
name: Check examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install moreutils
run: sudo apt install moreutils
- name: Check examples
run: ./scripts/check-examples.sh
build:
runs-on: ubuntu-latest
env:
NEXT_TELEMETRY_DISABLED: 1
# we build a dev binary for use in CI so skip downloading
# canary next-swc binaries in the monorepo
NEXT_SKIP_NATIVE_POSTINSTALL: 1
outputs:
docsChange: ${{ steps.docs-change.outputs.DOCS_CHANGE }}
isRelease: ${{ steps.check-release.outputs.IS_RELEASE }}
weekNum: ${{ steps.get-week.outputs.WEEK }}
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{ steps.docs-change.outputs.docsChange == 'nope' }}
with:
node-version: 16
check-latest: true
- uses: actions/checkout@v3
with:
fetch-depth: 25
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- name: Check non-docs only change
run: echo "::set-output name=DOCS_CHANGE::$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')"
id: docs-change
- run: echo ${{steps.docs-change.outputs.DOCS_CHANGE}}
- run: npm i -g pnpm@${PNPM_VERSION}
- id: get-store-path
run: echo ::set-output name=STORE_PATH::$(pnpm store path)
- uses: actions/cache@v3
id: cache-pnpm-store
with:
path: ${{ steps.get-store-path.outputs.STORE_PATH }}
key: pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
pnpm-store-
pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
- run: pnpm install
- run: pnpm run build
- run: node run-tests.js --timings --write-timings -g 1/1
- run: node ./scripts/fetch-tags.mjs ${{ github.sha }}
- id: check-release
run: |
if [[ $(git describe --exact-match 2> /dev/null || :) = v* ]];
then
echo "::set-output name=IS_RELEASE::true"
else
echo "::set-output name=IS_RELEASE::false"
fi
# We use week in the turbo cache key to keep the cache from infinitely growing
- id: get-week
run: echo ::set-output name=WEEK::$(date +%U)
- uses: actions/cache@v3
id: cache-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
lint:
runs-on: ubuntu-latest
needs: build
steps:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true
- run: npm i -g pnpm@${PNPM_VERSION}
- uses: actions/cache@v3
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- run: ./scripts/check-manifests.js
- run: pnpm lint
rust-check:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/cache@v3
id: restore-build
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- run: echo "::set-output name=SWC_CHANGE::$(node scripts/run-for-change.js --type next-swc --exec echo 'yup')"
id: swc-change
- run: echo ${{ steps.swc-change.outputs.SWC_CHANGE }}
- name: Install
uses: actions-rs/toolchain@v1
if: ${{ steps.swc-change.outputs.SWC_CHANGE == 'yup' }}
with:
profile: minimal
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: rustfmt, clippy
- name: Cache cargo registry
uses: actions/cache@v3
if: ${{ steps.swc-change.outputs.SWC_CHANGE == 'yup' }}
with:
path: ~/.cargo/registry
key: stable-ubuntu-clippy-cargo-registry
- name: Cache cargo index
uses: actions/cache@v3
if: ${{ steps.swc-change.outputs.SWC_CHANGE == 'yup' }}
with:
path: ~/.cargo/git
key: stable-ubuntu-clippy-cargo-index
- name: Check
if: ${{ steps.swc-change.outputs.SWC_CHANGE == 'yup' }}
run: |
cargo fmt -- --check
cargo clippy --all -- -D warnings
working-directory: packages/next-swc
checkPrecompiled:
name: Check Pre-compiled
runs-on: ubuntu-latest
needs: build
env:
NEXT_TELEMETRY_DISABLED: 1
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: 16
check-latest: true
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
if: ${{needs.build.outputs.docsChange == 'nope'}}
run: sudo ethtool -K eth0 tx off rx off
- uses: actions/checkout@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: mv .git .git-bak
if: ${{needs.build.outputs.docsChange == 'nope'}}
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- run: npm i -g pnpm@${PNPM_VERSION}
- run: rm -rf .git && mv .git-bak .git
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: ./scripts/check-pre-compiled.sh
if: ${{needs.build.outputs.docsChange == 'nope'}}
- uses: EndBug/add-and-commit@v7
if: ${{ failure() }}
with:
add: 'packages/next/compiled packages/next/bundles --force'
message: '⚙ Update compiled files'
testUnit:
name: Test Unit
runs-on: ubuntu-latest
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: 16
check-latest: true
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: node run-tests.js --type unit
if: ${{needs.build.outputs.docsChange == 'nope'}}
testDev:
name: Test Development
runs-on: ubuntu-latest
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
strategy:
fail-fast: false
matrix:
node: [16, 18]
group: [1, 2]
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: ${{ matrix.node }}
check-latest: true
- run: echo ${{needs.build.outputs.docsChange}}
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: node run-tests.js --type development --timings -g ${{ matrix.group }}/2
name: Run test/development
if: ${{needs.build.outputs.docsChange == 'nope'}}
- name: Upload test trace
if: always()
uses: actions/upload-artifact@v3
with:
name: test-trace
if-no-files-found: ignore
retention-days: 2
path: |
test/traces
testDevReact17:
name: Test Development (react v17)
runs-on: ubuntu-latest
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
NEXT_TEST_REACT_VERSION: ^17
strategy:
fail-fast: false
matrix:
group: [1, 2]
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: 16
check-latest: true
- run: echo ${{needs.build.outputs.docsChange}}
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: node run-tests.js --type development --timings -g ${{ matrix.group }}/2
name: Run test/development
if: ${{needs.build.outputs.docsChange == 'nope'}}
- name: Upload test trace
if: always()
uses: actions/upload-artifact@v3
with:
name: test-trace
if-no-files-found: ignore
retention-days: 2
path: |
test/traces
testDevE2E:
name: Test Development (E2E)
runs-on: ubuntu-latest
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
strategy:
fail-fast: false
matrix:
node: [16, 18]
group: [1, 2, 3]
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: ${{ matrix.node }}
check-latest: true
- run: echo ${{needs.build.outputs.docsChange}}
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: NEXT_TEST_MODE=dev node run-tests.js --type e2e --timings -g ${{ matrix.group }}/3
name: Run test/e2e (dev)
if: ${{needs.build.outputs.docsChange == 'nope'}}
- name: Upload test trace
if: always()
uses: actions/upload-artifact@v3
with:
name: test-trace
if-no-files-found: ignore
retention-days: 2
path: |
test/traces
testDevE2EReact17:
name: Test Development (E2E) (react v17)
runs-on: ubuntu-latest
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
NEXT_TEST_REACT_VERSION: ^17
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
strategy:
fail-fast: false
matrix:
group: [1, 2, 3]
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: 16
check-latest: true
- run: echo ${{needs.build.outputs.docsChange}}
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: NEXT_TEST_MODE=dev node run-tests.js --type e2e --timings -g ${{ matrix.group }}/3
name: Run test/e2e (dev)
if: ${{needs.build.outputs.docsChange == 'nope'}}
- name: Upload test trace
if: always()
uses: actions/upload-artifact@v3
with:
name: test-trace
if-no-files-found: ignore
retention-days: 2
path: |
test/traces
testProd:
name: Test Production
runs-on: ubuntu-latest
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
strategy:
fail-fast: false
matrix:
node: [16, 18]
group: [1, 2]
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: ${{ matrix.node }}
check-latest: true
- run: echo ${{needs.build.outputs.docsChange}}
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: node run-tests.js --type production --timings -g ${{ matrix.group }}/2
name: Run test/production
if: ${{needs.build.outputs.docsChange == 'nope'}}
testProdReact17:
name: Test Production (react v17)
runs-on: ubuntu-latest
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
NEXT_TEST_REACT_VERSION: ^17
strategy:
fail-fast: false
matrix:
group: [1, 2]
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: 16
check-latest: true
- run: echo ${{needs.build.outputs.docsChange}}
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: node run-tests.js --type production --timings -g ${{ matrix.group }}/2
name: Run test/production
if: ${{needs.build.outputs.docsChange == 'nope'}}
testProdE2E:
name: Test Production (E2E)
runs-on: ubuntu-latest
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
strategy:
fail-fast: false
matrix:
node: [16, 18]
group: [1, 2, 3]
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: ${{ matrix.node }}
check-latest: true
- run: echo ${{needs.build.outputs.docsChange}}
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: NEXT_TEST_MODE=start node run-tests.js --type e2e --timings -g ${{ matrix.group }}/3
name: Run test/e2e (production)
if: ${{needs.build.outputs.docsChange == 'nope'}}
testProdE2EReact17:
name: Test Production (E2E) (react v17)
runs-on: ubuntu-latest
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
NEXT_TEST_REACT_VERSION: ^17
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
strategy:
fail-fast: false
matrix:
group: [1, 2, 3]
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: ${{ matrix.node }}
check-latest: true
- run: echo ${{needs.build.outputs.docsChange}}
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: NEXT_TEST_MODE=start node run-tests.js --type e2e --timings -g ${{ matrix.group }}/3
name: Run test/e2e (production)
if: ${{needs.build.outputs.docsChange == 'nope'}}
testIntegration:
name: Test Integration
runs-on: ubuntu-latest
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
strategy:
fail-fast: false
matrix:
group:
[
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
]
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: 16
check-latest: true
- run: echo ${{needs.build.outputs.docsChange}}
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: xvfb-run node run-tests.js --timings -g ${{ matrix.group }}/20
if: ${{needs.build.outputs.docsChange == 'nope'}}
- name: Upload test trace
if: always()
uses: actions/upload-artifact@v3
with:
name: test-trace
if-no-files-found: ignore
retention-days: 2
path: |
test/traces
testElectron:
name: Test Electron
runs-on: ubuntu-latest
needs: [build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
TEST_ELECTRON: 1
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: 16
check-latest: true
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: cd test/integration/with-electron/app && yarn install
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: xvfb-run node run-tests.js test/integration/with-electron/test/index.test.js
if: ${{needs.build.outputs.docsChange == 'nope'}}
testsPass:
name: thank you, next
runs-on: ubuntu-latest
needs:
[
lint,
check-examples,
test-native,
checkPrecompiled,
testIntegration,
testUnit,
testDev,
testProd,
]
steps:
- run: exit 0
testFirefox:
name: Test Firefox (production)
runs-on: ubuntu-latest
needs: [build, build-native-test]
env:
BROWSER_NAME: 'firefox'
NEXT_TELEMETRY_DISABLED: 1
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: 16
check-latest: true
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npx playwright install-deps && npx playwright install firefox
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: node run-tests.js test/integration/production/test/index.test.js
if: ${{needs.build.outputs.docsChange == 'nope'}}
# test rsc hydration on firefox due to limited support of TransformStream api
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
testSafari:
name: Test Safari (production)
runs-on: ubuntu-latest
needs: [build, build-native-test]
env:
BROWSER_NAME: 'safari'
NEXT_TEST_MODE: 'start'
NEXT_TELEMETRY_DISABLED: 1
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: 16
check-latest: true
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: npx playwright install-deps && npx playwright install webkit
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: node run-tests.js -c 1 test/integration/production/test/index.test.js test/e2e/basepath.test.ts
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: DEVICE_NAME='iPhone XR' node run-tests.js -c 1 test/production/prerender-prefetch/index.test.ts
if: ${{needs.build.outputs.docsChange == 'nope'}}
testSafariOld:
name: Test Safari 10.1 (nav)
runs-on: ubuntu-latest
needs: [build, build-native-test]
env:
BROWSERSTACK: true
LEGACY_SAFARI: true
BROWSER_NAME: 'safari'
NEXT_TELEMETRY_DISABLED: 1
SKIP_LOCAL_SELENIUM_SERVER: true
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: 16
check-latest: true
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: '[[ -z "$BROWSERSTACK_ACCESS_KEY" ]] && echo "Skipping for PR" || npm i -g browserstack-local@1.4.0'
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: '[[ -z "$BROWSERSTACK_ACCESS_KEY" ]] && echo "Skipping for PR" || node run-tests.js test/integration/production-nav/test/index.test.js'
if: ${{needs.build.outputs.docsChange == 'nope'}}
testFirefoxNode18:
name: Test Firefox Node.js 18
runs-on: ubuntu-latest
needs: [build, testFirefox, build-native-test]
env:
BROWSER_NAME: 'firefox'
NEXT_TELEMETRY_DISABLED: 1
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: 18
check-latest: true
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: npx playwright install-deps && npx playwright install firefox
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: node run-tests.js test/integration/production/test/index.test.js
if: ${{needs.build.outputs.docsChange == 'nope'}}
publishRelease:
if: ${{ needs.build.outputs.isRelease == 'true' }}
name: Potentially publish release
runs-on: ubuntu-latest
needs:
- build
- build-wasm
- build-native
- build-native-freebsd
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: 16
check-latest: true
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- uses: actions/cache@v3
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
with:
name: next-swc-binaries
path: packages/next-swc/native
- uses: actions/download-artifact@v3
with:
name: wasm-binaries
path: packages/next-swc/crates/wasm
- run: npm i -g pnpm@${PNPM_VERSION}
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- run: ./scripts/publish-native.js $GITHUB_REF
- run: ./scripts/publish-release.sh
testDeployE2E:
name: E2E (deploy)
runs-on: ubuntu-latest
needs: [publishRelease, build, build-native-test]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
VERCEL_TEST_TOKEN: ${{ secrets.VERCEL_TEST_TOKEN }}
VERCEL_TEST_TEAM: 'vtest314-next-e2e-tests'
NEXT_TEST_MODE: deploy
steps:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true
- uses: actions/cache@v3
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: npm i -g pnpm@${PNPM_VERSION}
name: Install pnpm
- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
name: Install playwright dependencies
- run: RESET_VC_PROJECT=true node scripts/reset-vercel-project.mjs
name: Reset test project
- run: node run-tests.js --type e2e
name: Run test/e2e (deploy)
- name: Upload test trace
if: always()
uses: actions/upload-artifact@v3
with:
name: test-trace
if-no-files-found: ignore
retention-days: 2
path: |
test/traces
releaseStats:
name: Release Stats
runs-on: ubuntu-latest
needs: [publishRelease, build-native-test]
steps:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true
- uses: actions/cache@v3
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- uses: actions/download-artifact@v3
with:
name: next-swc-test-binary
path: packages/next-swc/native
- run: cp -r packages/next-swc/native .github/actions/next-stats-action/native
- run: ./scripts/release-stats.sh
- uses: ./.github/actions/next-stats-action
env:
PR_STATS_COMMENT_TOKEN: ${{ secrets.PR_STATS_COMMENT_TOKEN }}
build-native-test:
name: Build native binary for tests and metrics
runs-on: ubuntu-latest
steps:
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- uses: actions/checkout@v3
with:
fetch-depth: 25
- run: echo "::set-output name=DOCS_CHANGE::$(node scripts/run-for-change.js --not --type docs --exec echo 'nope')"
id: docs-change
- name: Setup node
uses: actions/setup-node@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
node-version: 16
check-latest: true
- name: Install
uses: actions-rs/toolchain@v1
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
profile: minimal
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Cache cargo registry
uses: actions/cache@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
path: ~/.cargo/registry
key: stable-ubuntu-latest-cargo-registry
- name: Cache cargo index
uses: actions/cache@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
path: ~/.cargo/git
key: stable-ubuntu-latest-cargo-index
# We use week in the turbo cache key to keep the cache from infinitely growing
- id: get-week
run: echo ::set-output name=WEEK::$(date +%U)
- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v3
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
path: .turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-
turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-
turbo-${{ github.job }}-canary-${{ steps.get-week.outputs.WEEK }}-
# We use restore-key to pick latest cache.
# We will not get exact match, but doc says
# "If there are multiple partial matches for a restore key, the action returns the most recently created cache."
# So we get latest cache
- name: Cache built files
uses: actions/cache@v3
with:
path: ./packages/next-swc/target
key: next-swc-cargo-cache-dev-ubuntu-latest-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
next-swc-cargo-cache-dev-ubuntu-latest
# since the repo's dependencies aren't installed we need
# to install napi globally
- run: npm i -g @napi-rs/cli@${{ env.NAPI_CLI_VERSION }} turbo@${{ env.TURBO_VERSION }} pnpm@${PNPM_VERSION}
- name: Build
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
run: turbo run build-native --cache-dir=".turbo" -- --release
env:
MACOSX_DEPLOYMENT_TARGET: '10.13'
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: next-swc-test-binary
path: packages/next-swc/native/next-swc.linux-x64-gnu.node
- name: Clear the cargo caches
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache
test-native:
name: Unit Test Native Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 25
- run: echo "::set-output name=SWC_CHANGE::$(node scripts/run-for-change.js --type next-swc --exec echo 'yup')"
id: swc-change
- run: echo ${{ steps.swc-change.outputs.SWC_CHANGE }}
- name: Install
if: ${{ steps.swc-change.outputs.SWC_CHANGE == 'yup' }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
profile: minimal
- run: cd packages/next-swc && cargo test
if: ${{ steps.swc-change.outputs.SWC_CHANGE == 'yup' }}
test-wasm:
name: Test the wasm build
runs-on: ubuntu-latest
needs: [build, build-native-test, build-wasm-dev]
steps:
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: wasm-dev-binary
path: packages/next-swc/crates/wasm/pkg-nodejs
- run: ls packages/next-swc/crates/wasm
if: ${{needs.build.outputs.docsChange == 'nope'}}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
# node version needs to be 16+ to use --no-addons option
- name: Setup node
if: ${{needs.build.outputs.docsChange == 'nope'}}
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true
- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: node ./scripts/setup-wasm.mjs
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: npm i -g pnpm@${PNPM_VERSION}
if: ${{needs.build.outputs.docsChange == 'nope'}}
- run: TEST_WASM=true xvfb-run node run-tests.js test/integration/production/test/index.test.js
if: ${{needs.build.outputs.docsChange == 'nope'}}
# test wasm parsing for runtime in page config
- run: TEST_WASM=true xvfb-run node run-tests.js test/e2e/streaming-ssr/index.test.ts
if: ${{needs.build.outputs.docsChange == 'nope'}}
# Build binaries for publishing
build-native:
strategy:
fail-fast: false
matrix:
settings:
# pnpm is aliased here temporarily until the build docker
# image is updated past Node.js v14.19 (current 14.18.1)
- host: macos-latest
target: 'x86_64-apple-darwin'
build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi
turbo run build-native --cache-dir=".turbo" -- --release
strip -x packages/next-swc/native/next-swc.*.node
- host: windows-latest
build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native --cache-dir=".turbo" -- --release
target: 'x86_64-pc-windows-msvc'
- host: windows-latest
build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native-no-plugin --cache-dir=".turbo" -- --release --target i686-pc-windows-msvc
target: 'i686-pc-windows-msvc'
- host: ubuntu-latest
target: 'x86_64-unknown-linux-gnu'
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
build: >-
set -e &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add x86_64-unknown-linux-gnu &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi &&
turbo run build-native --cache-dir=".turbo" -- --release --target x86_64-unknown-linux-gnu &&
strip packages/next-swc/native/next-swc.*.node
- host: ubuntu-latest
target: 'x86_64-unknown-linux-musl'
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: >-
set -e &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add x86_64-unknown-linux-musl &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi &&
turbo run build-native --cache-dir=".turbo" -- --release --target x86_64-unknown-linux-musl &&
strip packages/next-swc/native/next-swc.*.node
- host: macos-latest
target: 'aarch64-apple-darwin'
build: |
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*;
export CC=$(xcrun -f clang);
export CXX=$(xcrun -f clang++);
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi
turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-apple-darwin
strip -x packages/next-swc/native/next-swc.*.node
- host: ubuntu-latest
target: 'aarch64-unknown-linux-gnu'
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: >-
set -e &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add aarch64-unknown-linux-gnu &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi &&
export CC_aarch64_unknown_linux_gnu=/usr/aarch64-unknown-linux-gnu/bin/aarch64-unknown-linux-gnu-gcc &&
turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-unknown-linux-gnu &&
llvm-strip -x packages/next-swc/native/next-swc.*.node
- host: ubuntu-latest
target: 'armv7-unknown-linux-gnueabihf'
setup: |
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y
build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi
turbo run build-native-no-plugin --cache-dir=".turbo" -- --release --target armv7-unknown-linux-gnueabihf
arm-linux-gnueabihf-strip packages/next-swc/native/next-swc.*.node
- host: ubuntu-latest
target: aarch64-linux-android
build: |
export CLANG_VERSION=`ls ${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang | sed 's/ *$//g'`
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
export CC="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
export CXX="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++"
export AR="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
export PATH="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"
touch "${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/${CLANG_VERSION}/lib/linux/aarch64/libgcc.a"
chmod 777 "${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/${CLANG_VERSION}/lib/linux/aarch64/libgcc.a"
echo "INPUT(-lunwind)" > "${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/${CLANG_VERSION}/lib/linux/aarch64/libgcc.a"
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi
turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-linux-android
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip packages/next-swc/native/next-swc.*.node
- host: ubuntu-latest
target: armv7-linux-androideabi
build: |
export CLANG_VERSION=`ls ${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang | sed 's/ *$//g'`
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
export CC="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang"
export CXX="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang++"
export AR="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
export PATH="${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}"
touch "${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/${CLANG_VERSION}/lib/linux/arm/libgcc.a"
chmod 777 "${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/${CLANG_VERSION}/lib/linux/arm/libgcc.a"
echo "INPUT(-lunwind)" > "${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/${CLANG_VERSION}/lib/linux/arm/libgcc.a"
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native-no-plugin --cache-dir=".turbo" -- --release --target armv7-linux-androideabi
${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip packages/next-swc/native/next-swc.*.node
- host: ubuntu-latest
target: 'aarch64-unknown-linux-musl'
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: >-
set -e &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add aarch64-unknown-linux-musl &&
turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-unknown-linux-musl &&
llvm-strip -x packages/next-swc/native/next-swc.*.node
- host: windows-latest
target: 'aarch64-pc-windows-msvc'
build: |
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}"
turbo run build-native-no-plugin --cache-dir=".turbo" -- --release --target aarch64-pc-windows-msvc --cargo-flags=--no-default-features
if: ${{ needs.build.outputs.isRelease == 'true' }}
needs: build
name: stable - ${{ matrix.settings.target }} - node@16
runs-on: ${{ matrix.settings.host }}
steps:
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
- name: tune windows network
run: Disable-NetAdapterChecksumOffload -Name * -TcpIPv4 -UdpIPv4 -TcpIPv6 -UdpIPv6
if: ${{ matrix.settings.host == 'windows-latest' }}
- name: tune mac network
run: sudo sysctl -w net.link.generic.system.hwcksum_tx=0 && sudo sysctl -w net.link.generic.system.hwcksum_rx=0
if: ${{ matrix.settings.host == 'macos-latest' }}
# we use checkout here instead of the build cache since
# it can fail to restore in different OS'
- uses: actions/checkout@v3
# We use restore-key to pick latest cache.
# We will not get exact match, but doc says
# "If there are multiple partial matches for a restore key, the action returns the most recently created cache."
# So we get latest cache
- name: Cache built files
uses: actions/cache@v3
with:
path: ./packages/next-swc/target
key: next-swc-cargo-cache-${{ matrix.settings.target }}--${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
next-swc-cargo-cache-${{ matrix.settings.target }}
- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ matrix.settings.target }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ github.ref_name }}-${{ matrix.settings.target }}
turbo-${{ github.job }}-${{ github.ref_name }}-${{ matrix.settings.target }}-${{ needs.build.outputs.weekNum }}-
turbo-${{ github.job }}-canary-${{ matrix.settings.target }}-${{ needs.build.outputs.weekNum }}-
- name: Setup node
uses: actions/setup-node@v3
if: ${{ !matrix.settings.docker }}
with:
node-version: 16
check-latest: true
- name: Install
uses: actions-rs/toolchain@v1
if: ${{ !matrix.settings.docker }}
with:
profile: minimal
override: true
toolchain: ${{ env.RUST_TOOLCHAIN }}
target: ${{ matrix.settings.target }}
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ matrix.settings.target }}-cargo-registry
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ matrix.settings.target }}-cargo-index
- name: Setup toolchain
run: ${{ matrix.settings.setup }}
if: ${{ matrix.settings.setup }}
shell: bash
- name: Build in docker
uses: addnab/docker-run-action@v3
if: ${{ matrix.settings.docker }}
with:
image: ${{ matrix.settings.docker }}
options: -e RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} -e NAPI_CLI_VERSION=${{ env.NAPI_CLI_VERSION }} -e TURBO_VERSION=${{ env.TURBO_VERSION }} -v ${{ env.HOME }}/.cargo/git:/root/.cargo/git -v ${{ env.HOME }}/.cargo/registry:/root/.cargo/registry -v ${{ github.workspace }}:/build -w /build
run: ${{ matrix.settings.build }}
- name: 'Build'
run: ${{ matrix.settings.build }}
if: ${{ !matrix.settings.docker }}
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: next-swc-binaries
path: packages/next-swc/native/next-swc.*.node
build-native-freebsd:
if: ${{ needs.build.outputs.isRelease == 'true' }}
needs: build
name: stable - x86_64-unknown-freebsd - node@16
runs-on: macos-12
steps:
- name: tune mac network
run: sudo sysctl -w net.link.generic.system.hwcksum_tx=0 && sudo sysctl -w net.link.generic.system.hwcksum_rx=0
- uses: actions/checkout@v3
- name: Delete useless files
run: |
rm -rf bench
rm -rf docs
rm -rf errors
rm -rf examples
rm -rf scripts
rm -rf test
- name: Build
id: build
uses: vmactions/freebsd-vm@v0.2.3
env:
DEBUG: napi:*
RUSTUP_HOME: /usr/local/rustup
CARGO_HOME: /usr/local/cargo
RUSTUP_IO_THREADS: 1
# Disable LTO, or the lld may crash with OOM
CARGO_PROFILE_RELEASE_LTO: false
with:
envs: DEBUG RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS CARGO_PROFILE_RELEASE_LTO NAPI_CLI_VERSION TURBO_VERSION RUST_TOOLCHAIN PNPM_VERSION
usesh: true
mem: 6000
prepare: |
pkg install -y curl node16
curl -qL https://www.npmjs.com/install.sh | sh
npm i -g pnpm@${PNPM_VERSION} "@napi-rs/cli@${NAPI_CLI_VERSION}"
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile minimal --default-toolchain stable
export PATH="/usr/local/cargo/bin:$PATH"
echo "~~~~ rustc --version ~~~~"
rustc --version
echo "~~~~ node -v ~~~~"
node -v
run: |
export PATH="/usr/local/cargo/bin:$PATH"
pwd
ls -lah
whoami
env
freebsd-version
pnpm --filter=@next/swc run build-native-no-plugin --platform --release --target x86_64-unknown-freebsd
rm -rf node_modules
rm -rf packages/next-swc/target
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: next-swc-binaries
path: packages/next-swc/native/next-swc.*.node
if-no-files-found: error
build-wasm:
needs: build
if: ${{ needs.build.outputs.isRelease == 'true' }}
strategy:
matrix:
target: [web, nodejs]
runs-on: macos-latest
steps:
- uses: actions/cache@v3
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_TOOLCHAIN }}
override: true
target: wasm32-unknown-unknown
- run: npm i -g turbo@${{ env.TURBO_VERSION }} pnpm@${PNPM_VERSION}
- name: Turbo cache
id: turbo-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ github.job }}-${{ matrix.target }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ matrix.target }}-
turbo-${{ github.job }}-${{ matrix.target }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-
turbo-${{ github.job }}-${{ matrix.target }}-canary-${{ needs.build.outputs.weekNum }}-
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build
run: turbo run build-wasm --cache-dir=".turbo" -- --target ${{ matrix.target }}
- name: Add target to folder name
run: '[[ -d "packages/next-swc/crates/wasm/pkg" ]] && mv packages/next-swc/crates/wasm/pkg packages/next-swc/crates/wasm/pkg-${{ matrix.target }} || ls packages/next-swc/crates/wasm'
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: wasm-binaries
path: packages/next-swc/crates/wasm/pkg-*
build-wasm-dev:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- name: Setup node
if: ${{needs.build.outputs.docsChange == 'nope'}}
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true
- run: npm i -g turbo@${{ env.TURBO_VERSION }} pnpm@${PNPM_VERSION}
- name: Install Rust
if: ${{needs.build.outputs.docsChange == 'nope'}}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_TOOLCHAIN }}
override: true
target: wasm32-unknown-unknown
- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
path: .turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-
turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-
turbo-${{ github.job }}-canary-${{ steps.get-week.outputs.WEEK }}-
- name: Install wasm-pack
if: ${{needs.build.outputs.docsChange == 'nope'}}
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build
if: ${{needs.build.outputs.docsChange == 'nope'}}
run: turbo run build-wasm --cache-dir=".turbo" -- --target nodejs --dev
- name: Add target to folder name
if: ${{needs.build.outputs.docsChange == 'nope'}}
run: '[[ -d "packages/next-swc/crates/wasm/pkg" ]] && mv packages/next-swc/crates/wasm/pkg packages/next-swc/crates/wasm/pkg-nodejs || ls packages/next-swc/crates/wasm'
- name: Upload artifact
if: ${{needs.build.outputs.docsChange == 'nope'}}
uses: actions/upload-artifact@v3
with:
name: wasm-dev-binary
path: packages/next-swc/crates/wasm/pkg-nodejs
check-trace-secrests:
runs-on: ubuntu-latest
outputs:
trace-api-key: ${{ steps.trace-api-key.outputs.defined }}
steps:
- id: trace-api-key
env:
TRACE_API_KEY: ${{ secrets.DATA_DOG_API_KEY }}
if: "${{ env.TRACE_API_KEY != '' }}"
run: echo "::set-output name=defined::true"
build-performance-metrics:
name: Performance Metrics for Release Build
runs-on: ubuntu-latest
needs: [build, build-native-test, check-trace-secrests]
if: needs.check-trace-secrests.outputs.trace-api-key == 'true'
env:
NEXT_TELEMETRY_DISABLED: 1
steps:
- name: Setup node
uses: actions/setup-node@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
node-version: 16
check-latest: true
- uses: actions/cache@v3
id: restore-build
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- name: Set Git Short sha Env
if: ${{needs.build.outputs.docsChange == 'nope'}}
run: echo "GIT_SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
- name: Check Git Short sha Env
if: ${{needs.build.outputs.docsChange == 'nope'}}
run: echo ${GIT_SHORT_SHA}
- uses: actions/download-artifact@v3
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
name: next-swc-test-binary
path: packages/next-swc/native
- name: Generate metrics data
if: ${{needs.build.outputs.docsChange == 'nope'}}
run: |
yarn --cwd bench/nested-deps install
node bench/nested-deps/bench.mjs build
- uses: datadog/agent-github-action@v1
if: ${{needs.build.outputs.docsChange == 'nope'}}
with:
api_key: ${{ secrets.DATA_DOG_API_KEY }}
- name: Sending metrics data to Datadog
if: ${{needs.build.outputs.docsChange == 'nope'}}
run: |
node scripts/trace-dd.mjs bench/nested-deps/.next/trace build ${GIT_SHORT_SHA} ./bench/nested-deps/next.config.js
env:
DATA_DOG_API_KEY: ${{ secrets.DATA_DOG_API_KEY }}
DD_TRACE_PARTIAL_FLUSH_MIN_SPANS: 10
DD_ENV: canary
DD_SERVICE: nextjs-dev-build
DD_TRACE_DEBUG: true