From 2012f4e7c648ed99154a84190876a772225cf8e8 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 5 May 2022 02:51:25 +0800 Subject: [PATCH] Update components in GitHub Actions (#36669) `build-native` jobs tested on https://github.com/vercel/next.js/runs/6288266017 --- .github/workflows/build_test_deploy.yml | 331 ++++++++++-------- .github/workflows/pull_request_stats.yml | 20 +- .github/workflows/test_react_experimental.yml | 6 +- .github/workflows/test_react_next.yml | 6 +- errors/no-cache.md | 2 +- package.json | 20 -- test/integration/chunking/pages/page3.js | 4 +- turbo.json | 12 + 8 files changed, 213 insertions(+), 188 deletions(-) create mode 100644 turbo.json diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 1b91c3fb11ab..59b4e71bce5b 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -6,12 +6,17 @@ on: name: Build, test, and deploy +env: + NAPI_CLI_VERSION: 2.7.0 + TURBO_VERSION: 1.2.6 + RUST_TOOLCHAIN: nightly-2022-02-23 + jobs: check-examples: name: Check examples runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install moreutils run: sudo apt install moreutils - name: Check examples @@ -30,12 +35,13 @@ jobs: weekNum: ${{ steps.get-week.outputs.WEEK }} steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{ steps.docs-change.outputs.docsChange != 'docs only change' }} with: - node-version: 14 + node-version: 16 + check-latest: true - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 25 @@ -64,7 +70,7 @@ jobs: - id: get-week run: echo ::set-output name=WEEK::$(date +%U) - - uses: actions/cache@v2 + - uses: actions/cache@v3 id: cache-build with: path: ./* @@ -75,12 +81,13 @@ jobs: needs: build steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{ steps.docs-change.outputs.docsChange != 'docs only change' }} with: - node-version: 14 + node-version: 16 + check-latest: true - - uses: actions/cache@v2 + - uses: actions/cache@v3 id: restore-build with: path: ./* @@ -97,24 +104,24 @@ jobs: if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: profile: minimal - toolchain: nightly-2022-02-23 + toolchain: ${{ env.RUST_TOOLCHAIN }} components: rustfmt, clippy - name: Cache cargo registry - uses: actions/cache@v2 + uses: actions/cache@v3 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 + uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: path: ~/.cargo/git key: stable-ubuntu-clippy-cargo-index - - uses: actions/cache@v2 + - uses: actions/cache@v3 id: restore-build if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: @@ -136,23 +143,24 @@ jobs: NEXT_TELEMETRY_DISABLED: 1 steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: - node-version: 14 + node-version: 16 + check-latest: true # 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 + - uses: actions/checkout@v3 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 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: @@ -180,19 +188,20 @@ jobs: NEXT_TEST_JOB: 1 steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: - node-version: 14 + node-version: 16 + check-latest: true - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary @@ -211,13 +220,14 @@ jobs: strategy: fail-fast: false matrix: - node: [16, 17] + node: [16, 18] steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: node-version: ${{ matrix.node }} + check-latest: true - run: echo ${{needs.build.outputs.docsChange}} @@ -225,14 +235,14 @@ jobs: - name: tune linux network run: sudo ethtool -K eth0 tx off rx off - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary @@ -247,7 +257,7 @@ jobs: - name: Upload test trace if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: test-trace if-no-files-found: ignore @@ -265,10 +275,11 @@ jobs: NEXT_TEST_REACT_VERSION: ^17 steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: node-version: 16 + check-latest: true - run: echo ${{needs.build.outputs.docsChange}} @@ -276,14 +287,14 @@ jobs: - name: tune linux network run: sudo ethtool -K eth0 tx off rx off - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary @@ -298,7 +309,7 @@ jobs: - name: Upload test trace if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: test-trace if-no-files-found: ignore @@ -316,13 +327,14 @@ jobs: strategy: fail-fast: false matrix: - node: [16, 17] + node: [16, 18] steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: node-version: ${{ matrix.node }} + check-latest: true - run: echo ${{needs.build.outputs.docsChange}} @@ -330,14 +342,14 @@ jobs: - name: tune linux network run: sudo ethtool -K eth0 tx off rx off - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary @@ -352,7 +364,7 @@ jobs: - name: Upload test trace if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: test-trace if-no-files-found: ignore @@ -370,10 +382,11 @@ jobs: NEXT_TEST_REACT_VERSION: ^17 steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: node-version: 16 + check-latest: true - run: echo ${{needs.build.outputs.docsChange}} @@ -381,14 +394,14 @@ jobs: - name: tune linux network run: sudo ethtool -K eth0 tx off rx off - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary @@ -403,7 +416,7 @@ jobs: - name: Upload test trace if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: test-trace if-no-files-found: ignore @@ -421,13 +434,14 @@ jobs: strategy: fail-fast: false matrix: - node: [16, 17] + node: [16, 18] steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: node-version: ${{ matrix.node }} + check-latest: true - run: echo ${{needs.build.outputs.docsChange}} @@ -435,14 +449,14 @@ jobs: - name: tune linux network run: sudo ethtool -K eth0 tx off rx off - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary @@ -465,10 +479,11 @@ jobs: NEXT_TEST_REACT_VERSION: ^17 steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: node-version: 16 + check-latest: true - run: echo ${{needs.build.outputs.docsChange}} @@ -476,14 +491,14 @@ jobs: - name: tune linux network run: sudo ethtool -K eth0 tx off rx off - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary @@ -506,13 +521,14 @@ jobs: strategy: fail-fast: false matrix: - node: [16, 17] + node: [16, 18] steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: node-version: ${{ matrix.node }} + check-latest: true - run: echo ${{needs.build.outputs.docsChange}} @@ -520,14 +536,14 @@ jobs: - name: tune linux network run: sudo ethtool -K eth0 tx off rx off - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary @@ -548,12 +564,17 @@ jobs: NEXT_TELEMETRY_DISABLED: 1 NEXT_TEST_JOB: 1 NEXT_TEST_REACT_VERSION: ^17 + strategy: + fail-fast: false + matrix: + node: [16, 18] steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: node-version: ${{ matrix.node }} + check-latest: true - run: echo ${{needs.build.outputs.docsChange}} @@ -561,14 +582,14 @@ jobs: - name: tune linux network run: sudo ethtool -K eth0 tx off rx off - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary @@ -595,10 +616,11 @@ jobs: 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 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: - node-version: 14 + node-version: 16 + check-latest: true - run: echo ${{needs.build.outputs.docsChange}} @@ -606,7 +628,7 @@ jobs: - name: tune linux network run: sudo ethtool -K eth0 tx off rx off - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: @@ -617,7 +639,7 @@ jobs: with: version: 6.32.2 - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary @@ -631,7 +653,7 @@ jobs: - name: Upload test trace if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: test-trace if-no-files-found: ignore @@ -649,19 +671,20 @@ jobs: TEST_ELECTRON: 1 steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: - node-version: 14 + node-version: 16 + check-latest: true - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary @@ -699,18 +722,19 @@ jobs: NEXT_TELEMETRY_DISABLED: 1 steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: - node-version: 14 + node-version: 16 + check-latest: true - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary @@ -737,23 +761,24 @@ jobs: BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: - node-version: 14 + 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@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary @@ -781,23 +806,24 @@ jobs: BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: - node-version: 14 + 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@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary @@ -809,8 +835,8 @@ jobs: - 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 + testFirefoxNode18: + name: Test Firefox Node.js 18 runs-on: ubuntu-latest needs: [build, testFirefox, build-native-test] env: @@ -818,18 +844,18 @@ jobs: NEXT_TELEMETRY_DISABLED: 1 steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: - node-version: 17 + node-version: 18 check-latest: true - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary @@ -851,27 +877,28 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }} steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: - node-version: 14 + 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@v2 + - uses: actions/cache@v3 id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: next-swc-binaries path: packages/next-swc/native - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: wasm-binaries path: packages/next-swc/crates/wasm @@ -886,17 +913,18 @@ jobs: needs: [publishRelease, build-native-test] steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: 14 + node-version: 16 + check-latest: true - - uses: actions/cache@v2 + - uses: actions/cache@v3 id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: next-swc-test-binary path: packages/next-swc/native @@ -916,7 +944,7 @@ jobs: - name: tune linux network run: sudo ethtool -K eth0 tx off rx off - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 25 @@ -924,7 +952,7 @@ jobs: id: docs-change - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} with: node-version: 16 @@ -935,17 +963,17 @@ jobs: if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} with: profile: minimal - toolchain: nightly-2022-02-23 + toolchain: ${{ env.RUST_TOOLCHAIN }} - name: Cache cargo registry - uses: actions/cache@v2 + uses: actions/cache@v3 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 + uses: actions/cache@v3 if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} with: path: ~/.cargo/git @@ -957,7 +985,7 @@ jobs: - name: Turbo Cache id: turbo-cache - uses: actions/cache@v2 + uses: actions/cache@v3 if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} with: path: .turbo @@ -972,7 +1000,7 @@ jobs: # "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 + uses: actions/cache@v3 with: path: ./packages/next-swc/target key: next-swc-cargo-cache-dev-ubuntu-18.04-${{ hashFiles('**/Cargo.lock') }} @@ -981,7 +1009,7 @@ jobs: # 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 + - run: npm i -g @napi-rs/cli@${{ env.NAPI_CLI_VERSION }} turbo@${{ env.TURBO_VERSION }} - name: Build if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} run: turbo run build-native --cache-dir=".turbo" -- --release @@ -989,7 +1017,7 @@ jobs: MACOSX_DEPLOYMENT_TARGET: '10.13' - name: Upload artifact - uses: actions/upload-artifact@v2.2.4 + uses: actions/upload-artifact@v3 with: name: next-swc-test-binary path: packages/next-swc/native/next-swc.linux-x64-gnu.node @@ -1005,7 +1033,7 @@ jobs: runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 25 - run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change') @@ -1014,7 +1042,7 @@ jobs: if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} uses: actions-rs/toolchain@v1 with: - toolchain: nightly-2022-02-23 + toolchain: ${{ env.RUST_TOOLCHAIN }} profile: minimal - run: cd packages/next-swc && cargo test if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} @@ -1025,14 +1053,14 @@ jobs: needs: [build, build-native-test, build-wasm-dev] steps: - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: path: ./* key: ${{ github.sha }} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: wasm-dev-binary @@ -1041,7 +1069,7 @@ jobs: - run: ls packages/next-swc/crates/wasm if: ${{needs.build.outputs.docsChange != 'docs only change'}} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary @@ -1050,7 +1078,7 @@ jobs: # 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 + uses: actions/setup-node@v3 with: node-version: 16 check-latest: true @@ -1076,17 +1104,17 @@ jobs: - host: macos-latest target: 'x86_64-apple-darwin' build: | - npm i -g @napi-rs/cli@2.4.4 turbo@1.0.28 + npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" 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 + npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_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@2.4.4 turbo@1.0.28 + npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" turbo run build-native --cache-dir=".turbo" -- --release --target i686-pc-windows-msvc target: 'i686-pc-windows-msvc' - host: ubuntu-latest @@ -1095,10 +1123,10 @@ jobs: # 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 toolchain install "${RUST_TOOLCHAIN}" && + rustup default "${RUST_TOOLCHAIN}" && rustup target add x86_64-unknown-linux-gnu && - npm i -g @napi-rs/cli@2.4.4 turbo@1.0.28 && + npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && 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 @@ -1106,10 +1134,10 @@ jobs: 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 toolchain install "${RUST_TOOLCHAIN}" && + rustup default "${RUST_TOOLCHAIN}" && rustup target add x86_64-unknown-linux-musl && - npm i -g @napi-rs/cli@2.4.4 turbo@1.0.28 && + npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && 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 @@ -1120,7 +1148,7 @@ jobs: 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 + npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-apple-darwin strip -x packages/next-swc/native/next-swc.*.node - host: ubuntu-latest @@ -1128,10 +1156,10 @@ jobs: 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 toolchain install "${RUST_TOOLCHAIN}" && + rustup default "${RUST_TOOLCHAIN}" && rustup target add aarch64-unknown-linux-gnu && - npm i -g @napi-rs/cli@2.4.4 turbo@1.0.28 && + npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && 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 @@ -1140,7 +1168,7 @@ jobs: 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 + npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" 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 @@ -1150,7 +1178,7 @@ jobs: 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 + npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" 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 @@ -1160,7 +1188,7 @@ jobs: 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 + npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" 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 @@ -1168,16 +1196,16 @@ jobs: 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 && + npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && + 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@2.4.4 turbo@1.0.28 + npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-pc-windows-msvc if: ${{ needs.build.outputs.isRelease == 'true' }} needs: build @@ -1199,13 +1227,13 @@ jobs: 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 + - 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@v2 + uses: actions/cache@v3 with: path: ./packages/next-swc/target key: next-swc-cargo-cache-${{ matrix.settings.target }}--${{ hashFiles('**/Cargo.lock') }} @@ -1213,7 +1241,7 @@ jobs: next-swc-cargo-cache-${{ matrix.settings.target }} - name: Turbo Cache id: turbo-cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: .turbo key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ matrix.settings.target }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} @@ -1223,7 +1251,7 @@ jobs: turbo-${{ github.job }}-canary-${{ matrix.settings.target }}-${{ needs.build.outputs.weekNum }}- - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{ !matrix.settings.docker }} with: node-version: 16 @@ -1236,17 +1264,17 @@ jobs: with: profile: minimal override: true - toolchain: nightly-2022-02-23 + toolchain: ${{ env.RUST_TOOLCHAIN }} target: ${{ matrix.settings.target }} - name: Cache cargo registry - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cargo/registry key: ${{ matrix.settings.target }}-cargo-registry - name: Cache cargo index - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cargo/git key: ${{ matrix.settings.target }}-cargo-index @@ -1261,7 +1289,7 @@ jobs: 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 + 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' @@ -1270,7 +1298,7 @@ jobs: shell: bash - name: Upload artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: next-swc-binaries path: packages/next-swc/native/next-swc.*.node @@ -1283,30 +1311,31 @@ jobs: target: [web, nodejs] runs-on: ubuntu-latest steps: - - uses: actions/cache@v2 + - uses: actions/cache@v3 id: restore-build with: path: ./* key: ${{ github.sha }}-${{ github.run_number }} - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: 14 + node-version: 16 + check-latest: true - name: Install Rust uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly-2022-02-23 + toolchain: ${{ env.RUST_TOOLCHAIN }} override: true target: wasm32-unknown-unknown - - run: npm i -g turbo@1.0.28 + - run: npm i -g turbo@${{ env.TURBO_VERSION }} - name: Turbo cache id: turbo-cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: .turbo key: turbo-${{ github.job }}-${{ matrix.target }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} @@ -1325,7 +1354,7 @@ jobs: 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 + uses: actions/upload-artifact@v3 with: name: wasm-binaries path: packages/next-swc/crates/wasm/pkg-* @@ -1334,7 +1363,7 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - uses: actions/cache@v2 + - uses: actions/cache@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} id: restore-build with: @@ -1343,24 +1372,25 @@ jobs: - name: Setup node if: ${{needs.build.outputs.docsChange != 'docs only change'}} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: 14 + node-version: 16 + check-latest: true - - run: npm i -g turbo@1.0.28 + - run: npm i -g turbo@${{ env.TURBO_VERSION }} - name: Install Rust if: ${{needs.build.outputs.docsChange != 'docs only change'}} uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly-2022-02-23 + toolchain: ${{ env.RUST_TOOLCHAIN }} override: true target: wasm32-unknown-unknown - name: Turbo Cache id: turbo-cache - uses: actions/cache@v2 + uses: actions/cache@v3 if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} with: path: .turbo @@ -1384,7 +1414,7 @@ jobs: - name: Upload artifact if: ${{needs.build.outputs.docsChange != 'docs only change'}} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: wasm-dev-binary path: packages/next-swc/crates/wasm/pkg-nodejs @@ -1406,12 +1436,13 @@ jobs: if: needs.check-trace-secrests.outputs.trace-api-key == 'true' steps: - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: - node-version: 14 + node-version: 16 + check-latest: true - - uses: actions/cache@v2 + - uses: actions/cache@v3 id: restore-build if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: @@ -1426,7 +1457,7 @@ jobs: if: ${{needs.build.outputs.docsChange != 'docs only change'}} run: echo ${GIT_SHORT_SHA} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{needs.build.outputs.docsChange != 'docs only change'}} with: name: next-swc-test-binary diff --git a/.github/workflows/pull_request_stats.yml b/.github/workflows/pull_request_stats.yml index 0d1e32362409..26e43bfe2a7e 100644 --- a/.github/workflows/pull_request_stats.yml +++ b/.github/workflows/pull_request_stats.yml @@ -13,7 +13,7 @@ jobs: - name: tune linux network run: sudo ethtool -K eth0 tx off rx off - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 25 @@ -21,10 +21,10 @@ jobs: id: docs-change - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} with: - node-version: 14 + node-version: 16 check-latest: true - name: Install @@ -54,7 +54,7 @@ jobs: - name: Turbo Cache id: turbo-cache - uses: actions/cache@v2 + uses: actions/cache@v3 if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} with: path: .turbo @@ -68,7 +68,7 @@ jobs: # "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 + uses: actions/cache@v3 with: path: ./packages/next-target key: next-swc-cargo-cache-ubuntu-18.04--${{ hashFiles('**/Cargo.lock') }} @@ -77,8 +77,8 @@ jobs: # since the repo's dependencies aren't installed we need # to install napi globally - - run: npm i -g @napi-rs/cli@1.2.1 - - run: npm i -g turbo@1.0.28 + - run: npm i -g @napi-rs/cli@2.7.0 + - run: npm i -g turbo@1.2.6 - name: Build if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} @@ -90,7 +90,7 @@ jobs: TURBO_PROJECT: nextjs - name: Upload artifact - uses: actions/upload-artifact@v2.2.4 + uses: actions/upload-artifact@v3 with: name: next-swc-dev-binary path: packages/next-swc/native/next-swc.linux-x64-gnu.node @@ -106,14 +106,14 @@ jobs: needs: build-native-dev runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 25 - run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change') id: docs-change - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} with: name: next-swc-dev-binary diff --git a/.github/workflows/test_react_experimental.yml b/.github/workflows/test_react_experimental.yml index 8b56f79f4d9b..79b3381bcdd0 100644 --- a/.github/workflows/test_react_experimental.yml +++ b/.github/workflows/test_react_experimental.yml @@ -9,7 +9,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: yarn install --frozen-lockfile --check-files env: @@ -19,7 +19,7 @@ jobs: - run: node run-tests.js --timings --write-timings -g 1/1 - - uses: actions/cache@v2 + - uses: actions/cache@v3 id: cache-build with: path: ./* @@ -38,7 +38,7 @@ jobs: matrix: group: [1, 2, 3, 4, 5, 6] steps: - - uses: actions/cache@v2 + - uses: actions/cache@v3 id: restore-build with: path: ./* diff --git a/.github/workflows/test_react_next.yml b/.github/workflows/test_react_next.yml index 4411c0a521a5..e44f28170e73 100644 --- a/.github/workflows/test_react_next.yml +++ b/.github/workflows/test_react_next.yml @@ -9,7 +9,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: yarn install --frozen-lockfile --check-files env: @@ -19,7 +19,7 @@ jobs: - run: node run-tests.js --timings --write-timings -g 1/1 - - uses: actions/cache@v2 + - uses: actions/cache@v3 id: cache-build with: path: ./* @@ -38,7 +38,7 @@ jobs: matrix: group: [1, 2, 3, 4, 5, 6] steps: - - uses: actions/cache@v2 + - uses: actions/cache@v3 id: restore-build with: path: ./* diff --git a/errors/no-cache.md b/errors/no-cache.md index b3b0214ca31f..3ef035538512 100644 --- a/errors/no-cache.md +++ b/errors/no-cache.md @@ -78,7 +78,7 @@ cache: Using GitHub's [actions/cache](https://github.com/actions/cache), add the following step in your workflow file: ```yaml -uses: actions/cache@v2 +uses: actions/cache@v3 with: # See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node path: | diff --git a/package.json b/package.json index af8fd7315dd9..9dadec67da76 100644 --- a/package.json +++ b/package.json @@ -181,25 +181,5 @@ }, "engines": { "node": ">=12.22.0" - }, - "turbo": { - "pipeline": { - "build-native": { - "dependsOn": [ - "^build-native" - ], - "outputs": [ - "native/*.node" - ] - }, - "build-wasm": { - "dependsOn": [ - "^build-wasm" - ], - "outputs": [ - "crates/wasm/pkg/*" - ] - } - } } } diff --git a/test/integration/chunking/pages/page3.js b/test/integration/chunking/pages/page3.js index 03d534597ca2..a49f3544a696 100644 --- a/test/integration/chunking/pages/page3.js +++ b/test/integration/chunking/pages/page3.js @@ -1,5 +1,7 @@ import Link from 'next/link' -import('lodash').then((_) => console.log(_.chunk(['a', 'b', 'c', 'd'], 2))) +import('lodash').then(({ default: _ }) => + console.log(_.chunk(['a', 'b', 'c', 'd'], 2)) +) const Page = () => { return ( diff --git a/turbo.json b/turbo.json new file mode 100644 index 000000000000..62b903aeb59f --- /dev/null +++ b/turbo.json @@ -0,0 +1,12 @@ +{ + "pipeline": { + "build-native": { + "dependsOn": ["^build-native"], + "outputs": ["native/*.node"] + }, + "build-wasm": { + "dependsOn": ["^build-wasm"], + "outputs": ["crates/wasm/pkg/*"] + } + } +}