[Snyk] Security upgrade next from 10.1.3 to 14.2.15 #530
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: [canary] | |
pull_request: | |
types: [opened, synchronize] | |
name: Build, test, and deploy | |
jobs: | |
check-examples: | |
name: Check examples | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- 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@v2 | |
if: ${{ steps.docs-change.outputs.docsChange != 'docs only change' }} | |
with: | |
node-version: 14 | |
- uses: actions/checkout@v2 | |
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 | |
- run: yarn install --frozen-lockfile --check-files | |
- run: node run-tests.js --timings --write-timings -g 1/1 | |
- run: node ./scripts/fetch-tags.mjs ${{ github.sha }} | |
- name: Check docs only change | |
run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change') | |
id: docs-change | |
- run: echo ${{steps.docs-change.outputs.DOCS_CHANGE}} | |
- 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@v2 | |
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@v2 | |
if: ${{ steps.docs-change.outputs.docsChange != 'docs only change' }} | |
with: | |
node-version: 14 | |
- uses: actions/cache@v2 | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- run: ./scripts/check-manifests.js | |
- run: yarn lint | |
rust-check: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Install | |
uses: actions-rs/toolchain@v1 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
profile: minimal | |
toolchain: nightly-2022-02-23 | |
components: rustfmt, clippy | |
- name: Cache cargo registry | |
uses: actions/cache@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
path: ~/.cargo/registry | |
key: stable-ubuntu-clippy-cargo-registry | |
- name: Cache cargo index | |
uses: actions/cache@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
path: ~/.cargo/git | |
key: stable-ubuntu-clippy-cargo-index | |
- uses: actions/cache@v2 | |
id: restore-build | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- name: Check | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
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@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: 14 | |
# https://github.com/actions/virtual-environments/issues/1187 | |
- name: tune linux network | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
run: sudo ethtool -K eth0 tx off rx off | |
- uses: actions/checkout@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- run: mv .git .git-bak | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- uses: actions/cache@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- run: rm -rf .git && mv .git-bak .git | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- run: ./scripts/check-pre-compiled.sh | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- 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@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: 14 | |
- uses: actions/cache@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
name: next-swc-test-binary | |
path: packages/next-swc/native | |
- run: node run-tests.js --type unit | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
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, 17] | |
steps: | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: ${{ matrix.node }} | |
- 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@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
name: next-swc-test-binary | |
path: packages/next-swc/native | |
- run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- run: node run-tests.js --type development | |
name: Run test/development | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- name: Upload test trace | |
if: always() | |
uses: actions/upload-artifact@v2 | |
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 | |
steps: | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: 16 | |
- 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@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
name: next-swc-test-binary | |
path: packages/next-swc/native | |
- run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- run: node run-tests.js --type development | |
name: Run test/development | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- name: Upload test trace | |
if: always() | |
uses: actions/upload-artifact@v2 | |
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 | |
strategy: | |
fail-fast: false | |
matrix: | |
node: [16, 17] | |
steps: | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: ${{ matrix.node }} | |
- 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@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
name: next-swc-test-binary | |
path: packages/next-swc/native | |
- run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- run: NEXT_TEST_MODE=dev node run-tests.js --type e2e | |
name: Run test/e2e (dev) | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- name: Upload test trace | |
if: always() | |
uses: actions/upload-artifact@v2 | |
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 | |
steps: | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: 16 | |
- 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@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
name: next-swc-test-binary | |
path: packages/next-swc/native | |
- run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- run: NEXT_TEST_MODE=dev node run-tests.js --type e2e | |
name: Run test/e2e (dev) | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- name: Upload test trace | |
if: always() | |
uses: actions/upload-artifact@v2 | |
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, 17] | |
steps: | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: ${{ matrix.node }} | |
- 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@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
name: next-swc-test-binary | |
path: packages/next-swc/native | |
- run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- run: node run-tests.js --type production | |
name: Run test/production | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
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 | |
steps: | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: 16 | |
- 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@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
name: next-swc-test-binary | |
path: packages/next-swc/native | |
- run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- run: node run-tests.js --type production | |
name: Run test/production | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
testProdE2E: | |
name: Test Production (E2E) | |
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, 17] | |
steps: | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: ${{ matrix.node }} | |
- 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@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
name: next-swc-test-binary | |
path: packages/next-swc/native | |
- run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- run: NEXT_TEST_MODE=start node run-tests.js --type e2e | |
name: Run test/e2e (production) | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
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 | |
steps: | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: ${{ matrix.node }} | |
- 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@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
name: next-swc-test-binary | |
path: packages/next-swc/native | |
- run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- run: NEXT_TEST_MODE=start node run-tests.js --type e2e | |
name: Run test/e2e (production) | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
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] | |
steps: | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: 14 | |
- 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@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: pnpm/action-setup@v2.2.1 | |
with: | |
version: 6.32.2 | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
name: next-swc-test-binary | |
path: packages/next-swc/native | |
- run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- run: xvfb-run node run-tests.js --timings -g ${{ matrix.group }}/18 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- name: Upload test trace | |
if: always() | |
uses: actions/upload-artifact@v2 | |
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@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: 14 | |
- uses: actions/cache@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
name: next-swc-test-binary | |
path: packages/next-swc/native | |
- run: cd test/integration/with-electron/app && yarn | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- run: xvfb-run node run-tests.js test/integration/with-electron/test/index.test.js | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
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@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: 14 | |
- uses: actions/cache@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
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 != 'docs only change'}} | |
- run: node run-tests.js test/integration/production/test/index.test.js | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
# test rsc hydration on firefox due to limited support of TransformStream api | |
- run: xvfb-run yarn jest test/integration/react-streaming-and-server-components/test/index.test.js -t "should handle streaming server components correctly" | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
testSafari: | |
name: Test Safari (production) | |
runs-on: ubuntu-latest | |
needs: [build, build-native-test] | |
env: | |
BROWSERSTACK: true | |
BROWSER_NAME: 'safari' | |
NEXT_TELEMETRY_DISABLED: 1 | |
NEXT_TEST_MODE: 'start' | |
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@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: 14 | |
# https://github.com/actions/virtual-environments/issues/1187 | |
- name: tune linux network | |
run: sudo ethtool -K eth0 tx off rx off | |
- uses: actions/cache@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
name: next-swc-test-binary | |
path: packages/next-swc/native | |
# TODO: use macos runner so that we can use playwright to test against | |
# PRs instead of only running on canary? | |
- run: '[[ -z "$BROWSERSTACK_ACCESS_KEY" ]] && echo "Skipping for PR" || npm i -g browserstack-local@1.4.0' | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- run: '[[ -z "$BROWSERSTACK_ACCESS_KEY" ]] && echo "Skipping for PR" || node run-tests.js -c 1 test/integration/production/test/index.test.js test/e2e/basepath.test.ts' | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
testSafariOld: | |
name: Test Safari 10.1 (nav) | |
runs-on: ubuntu-latest | |
needs: [build, testSafari, 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@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: 14 | |
# https://github.com/actions/virtual-environments/issues/1187 | |
- name: tune linux network | |
run: sudo ethtool -K eth0 tx off rx off | |
- uses: actions/cache@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
name: next-swc-test-binary | |
path: packages/next-swc/native | |
- run: '[[ -z "$BROWSERSTACK_ACCESS_KEY" ]] && echo "Skipping for PR" || npm i -g browserstack-local@1.4.0' | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- 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 != 'docs only change'}} | |
testFirefoxNode17: | |
name: Test Firefox Node.js 17 | |
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@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: 17 | |
check-latest: true | |
- uses: actions/cache@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
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 != 'docs only change'}} | |
- run: node run-tests.js test/integration/production/test/index.test.js | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
publishRelease: | |
if: ${{ needs.build.outputs.isRelease == 'true' }} | |
name: Potentially publish release | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- build-wasm | |
- build-native | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }} | |
steps: | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: 14 | |
# https://github.com/actions/virtual-environments/issues/1187 | |
- name: tune linux network | |
run: sudo ethtool -K eth0 tx off rx off | |
- uses: actions/cache@v2 | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: actions/download-artifact@v2 | |
with: | |
name: next-swc-binaries | |
path: packages/next-swc/native | |
- uses: actions/download-artifact@v2 | |
with: | |
name: wasm-binaries | |
path: packages/next-swc/crates/wasm | |
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc | |
- run: ./scripts/publish-native.js $GITHUB_REF | |
- run: ./scripts/publish-release.sh | |
releaseStats: | |
name: Release Stats | |
runs-on: ubuntu-latest | |
needs: [publishRelease, build-native-test] | |
steps: | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
- uses: actions/cache@v2 | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- uses: actions/download-artifact@v2 | |
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-18.04 | |
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@v2 | |
with: | |
fetch-depth: 25 | |
- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change') | |
id: docs-change | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} | |
with: | |
node-version: 16 | |
check-latest: true | |
- name: Install | |
uses: actions-rs/toolchain@v1 | |
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} | |
with: | |
profile: minimal | |
toolchain: nightly-2022-02-23 | |
- name: Cache cargo registry | |
uses: actions/cache@v2 | |
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} | |
with: | |
path: ~/.cargo/registry | |
key: stable-ubuntu-18.04-cargo-registry | |
- name: Cache cargo index | |
uses: actions/cache@v2 | |
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} | |
with: | |
path: ~/.cargo/git | |
key: stable-ubuntu-18.04-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@v2 | |
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} | |
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@v2 | |
with: | |
path: ./packages/next-swc/target | |
key: next-swc-cargo-cache-dev-ubuntu-18.04-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
next-swc-cargo-cache-dev-ubuntu-18.04 | |
# since the repo's dependencies aren't installed we need | |
# to install napi globally | |
- run: npm i -g @napi-rs/cli@2.4.4 turbo@1.0.28 | |
- name: Build | |
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} | |
run: turbo run build-native --cache-dir=".turbo" -- --release | |
env: | |
MACOSX_DEPLOYMENT_TARGET: '10.13' | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2.2.4 | |
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 != 'docs only change' }} | |
run: | | |
cargo install cargo-cache --no-default-features --features ci-autoclean | |
cargo-cache | |
test-native: | |
name: Unit Test Native Code | |
runs-on: ubuntu-18.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 25 | |
- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change') | |
id: docs-change | |
- name: Install | |
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly-2022-02-23 | |
profile: minimal | |
- run: cd packages/next-swc && cargo test | |
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} | |
test-wasm: | |
name: Test the wasm build | |
runs-on: ubuntu-18.04 | |
needs: [build, build-native-test, build-wasm-dev] | |
steps: | |
- uses: actions/cache@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
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 != 'docs only change'}} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
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 != 'docs only change'}} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
check-latest: true | |
- run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- run: node ./scripts/setup-wasm.mjs | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
- run: TEST_WASM=true xvfb-run node run-tests.js test/integration/production/test/index.test.js | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
# Build binaries for publishing | |
build-native: | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- host: macos-latest | |
target: 'x86_64-apple-darwin' | |
build: | | |
npm i -g @napi-rs/cli@2.4.4 turbo@1.0.28 | |
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@2.4.4 turbo@1.0.28 | |
turbo run build-native --cache-dir=".turbo" -- --release | |
target: 'x86_64-pc-windows-msvc' | |
- host: windows-latest | |
build: | | |
npm i -g @napi-rs/cli@2.4.4 turbo@1.0.28 | |
turbo run build-native --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-alpine-zig | |
# Node.js in Baidu need to compatible with `GLIBC_2.12` | |
build: >- | |
set -e && | |
rustup toolchain install nightly-2022-02-23 && | |
rustup default nightly-2022-02-23 && | |
rustup target add x86_64-unknown-linux-gnu && | |
npm i -g @napi-rs/cli@2.4.4 turbo@1.0.28 && | |
turbo run build-native --cache-dir=".turbo" -- --release --target x86_64-unknown-linux-gnu --zig --zig-abi-suffix 2.12 && | |
llvm-strip -x 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 nightly-2022-02-23 && | |
rustup default nightly-2022-02-23 && | |
rustup target add x86_64-unknown-linux-musl && | |
npm i -g @napi-rs/cli@2.4.4 turbo@1.0.28 && | |
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@2.4.4 turbo@1.0.28 | |
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-alpine-zig | |
build: >- | |
set -e && | |
rustup toolchain install nightly-2022-02-23 && | |
rustup default nightly-2022-02-23 && | |
rustup target add aarch64-unknown-linux-gnu && | |
npm i -g @napi-rs/cli@2.4.4 turbo@1.0.28 && | |
turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-unknown-linux-gnu --zig --zig-abi-suffix 2.12 && | |
llvm-strip -x packages/next-swc/native/next-swc.*.node | |
- host: ubuntu-18.04 | |
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@2.4.4 turbo@1.0.28 | |
turbo run build-native --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 CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang" | |
export CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang" | |
export CXX="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++" | |
export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}" | |
npm i -g @napi-rs/cli@2.4.4 turbo@1.0.28 | |
turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-linux-android | |
${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip packages/next-swc/native/next-swc.*.node | |
- host: ubuntu-latest | |
target: armv7-linux-androideabi | |
build: | | |
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang" | |
export CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang" | |
export CXX="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang++" | |
export PATH="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin:${PATH}" | |
npm i -g @napi-rs/cli@2.4.4 turbo@1.0.28 | |
turbo run build-native --cache-dir=".turbo" -- --release --target armv7-linux-androideabi | |
${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-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@2.4.4 turbo@1.0.28 && | |
rustup toolchain install nightly-2022-02-23 && | |
rustup default nightly-2022-02-23 && | |
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@2.4.4 turbo@1.0.28 | |
turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-pc-windows-msvc | |
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-18.04' }} | |
- 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@v2 | |
# 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@v2 | |
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@v2 | |
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@v2 | |
if: ${{ !matrix.settings.docker }} | |
with: | |
node-version: 16 | |
check-latest: true | |
cache: yarn | |
- name: Install | |
uses: actions-rs/toolchain@v1 | |
if: ${{ !matrix.settings.docker }} | |
with: | |
profile: minimal | |
override: true | |
toolchain: nightly-2022-02-23 | |
target: ${{ matrix.settings.target }} | |
- name: Cache cargo registry | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ matrix.settings.target }}-cargo-registry | |
- name: Cache cargo index | |
uses: actions/cache@v2 | |
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: -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@v2 | |
with: | |
name: next-swc-binaries | |
path: packages/next-swc/native/next-swc.*.node | |
build-wasm: | |
needs: build | |
if: ${{ needs.build.outputs.isRelease == 'true' }} | |
strategy: | |
matrix: | |
target: [web, nodejs] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/cache@v2 | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly-2022-02-23 | |
override: true | |
target: wasm32-unknown-unknown | |
- run: npm i -g turbo@1.0.28 | |
- name: Turbo cache | |
id: turbo-cache | |
uses: actions/cache@v2 | |
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@v2 | |
with: | |
name: wasm-binaries | |
path: packages/next-swc/crates/wasm/pkg-* | |
build-wasm-dev: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/cache@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
id: restore-build | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- name: Setup node | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
- run: npm i -g turbo@1.0.28 | |
- name: Install Rust | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly-2022-02-23 | |
override: true | |
target: wasm32-unknown-unknown | |
- name: Turbo Cache | |
id: turbo-cache | |
uses: actions/cache@v2 | |
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} | |
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 != 'docs only change'}} | |
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Build | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
run: turbo run build-wasm --cache-dir=".turbo" -- --target nodejs --dev | |
- name: Add target to folder name | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
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 != 'docs only change'}} | |
uses: actions/upload-artifact@v2 | |
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' | |
steps: | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
node-version: 14 | |
- uses: actions/cache@v2 | |
id: restore-build | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
path: ./* | |
key: ${{ github.sha }}-${{ github.run_number }} | |
- name: Set Git Short sha Env | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
run: echo "GIT_SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV | |
- name: Check Git Short sha Env | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
run: echo ${GIT_SHORT_SHA} | |
- uses: actions/download-artifact@v2 | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
with: | |
name: next-swc-test-binary | |
path: packages/next-swc/native | |
- name: Generate metrics data | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
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 != 'docs only change'}} | |
with: | |
api_key: ${{ secrets.DATA_DOG_API_KEY }} | |
- name: Sending metrics data to Datadog | |
if: ${{needs.build.outputs.docsChange != 'docs only change'}} | |
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 |