diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 7906496c0d9ad69..e2b02075f956a6d 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -518,13 +518,6 @@ jobs: - build - build-wasm - build-native - - build-windows-i686 - - build-windows-aarch64 - - build-linux-musl - - build-linux-arm7 - - build-linux-aarch64-gnu - - build-android-aarch64 - - build-linux-aarch64-musl env: NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }} steps: @@ -606,7 +599,7 @@ jobs: uses: actions/setup-node@v2 if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} with: - node-version: 14 + node-version: 16 check-latest: true - name: Install @@ -621,14 +614,14 @@ jobs: if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} with: path: ~/.cargo/registry - key: stable-ubuntu-18.04-node@14-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }} + key: stable-ubuntu-18.04-cargo-registry - name: Cache cargo index uses: actions/cache@v1 if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} with: path: ~/.cargo/git - key: stable-ubuntu-18.04-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }} + 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 @@ -660,9 +653,7 @@ 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.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" @@ -747,95 +738,137 @@ jobs: # Build binaries for publishing build-native: - needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} strategy: + fail-fast: false matrix: - os: [ubuntu-18.04, macos-latest, windows-latest] - description: [default] - include: - - os: ubuntu-18.04 - target: x86_64-unknown-linux-gnu - name: linux-x64-gnu - - os: windows-latest - target: x86_64-pc-windows-msvc - name: win32-x64-msvc - - os: macos-latest - target: x86_64-apple-darwin - name: darwin-x64 - - os: macos-latest - target: aarch64-apple-darwin - name: darwin-arm64 - description: m1 - - name: next-swc - ${{ matrix.os }} - ${{ matrix.target }} - node@14 - runs-on: ${{ matrix.os }} - + 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-2021-11-15 && + rustup default nightly-2021-11-15 && + 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-2021-11-15 && + rustup default nightly-2021-11-15 && + 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-2021-11-15 && + rustup default nightly-2021-11-15 && + 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-2021-11-15 && + rustup default nightly-2021-11-15 && + 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.os == 'ubuntu-18.04' }} + 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.os == 'windows-latest' }} + 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.os == 'macos-latest' }} - - - name: Setup node - uses: actions/setup-node@v2 - with: - node-version: 14 - check-latest: true - + 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 - - # 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 - - - name: Install - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly-2021-11-15 - target: ${{ matrix.target }} - - - name: Cache cargo registry - uses: actions/cache@v1 - with: - path: ~/.cargo/registry - key: stable-${{ matrix.os }}-node@14-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }} - - - name: Cache cargo index - uses: actions/cache@v1 - with: - path: ~/.cargo/git - key: stable-${{ matrix.os }}-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }} - - - name: Turbo cache - id: turbo-cache - uses: actions/cache@v2 - with: - path: .turbo - key: turbo-${{ github.job }}-${{ matrix.name }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} - restore-keys: | - turbo-${{ github.job }}-${{ matrix.name }}- - turbo-${{ github.job }}-${{ matrix.name }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- - turbo-${{ github.job }}-${{ matrix.name }}-canary-${{ needs.build.outputs.weekNum }}- - - - name: Cross build aarch64 setup - if: ${{ matrix.target == 'aarch64-apple-darwin' }} - run: | - 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"; # 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." @@ -844,65 +877,9 @@ jobs: uses: actions/cache@v2 with: path: ./packages/next-swc/target - key: next-swc-cargo-cache-${{ matrix.os }}--${{ hashFiles('**/Cargo.lock') }} + key: next-swc-cargo-cache-${{ matrix.settings.target }}--${{ hashFiles('**/Cargo.lock') }} restore-keys: | - next-swc-cargo-cache-${{ matrix.os }} - - - name: 'Build' - shell: bash - run: turbo run build-native --cache-dir=".turbo" -- --release --target ${{ matrix.target }} - env: - MACOSX_DEPLOYMENT_TARGET: '10.13' - - - name: Upload artifact - uses: actions/upload-artifact@v2.2.4 - with: - name: next-swc-binaries - path: packages/next-swc/native/next-swc.${{ matrix.name }}.node - - - name: Clear the cargo caches - run: | - cargo install cargo-cache --no-default-features --features ci-autoclean - cargo-cache - - build-windows-i686: - needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} - name: next-swc - windows-i686 - node@14 - runs-on: windows-latest - env: - CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 32 - CARGO_PROFILE_RELEASE_LTO: 'false' - steps: - - name: Install node x86 - run: | - choco install nodejs-lts --x86 -y --force - refreshenv - - - name: Set 32bit Node.js path - run: | - echo "C:\\Program Files (x86)\\nodejs" >> $GITHUB_PATH - shell: bash - - - name: Node.js arch - run: node -e "console.log(process.arch)" - - # we use checkout here instead of the build cache since - # it can fail to restore in different OS' - - uses: actions/checkout@v2 - - # 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 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly-2021-11-15 - override: true - target: i686-pc-windows-msvc - + next-swc-cargo-cache-${{ matrix.settings.target }} - name: Turbo Cache id: turbo-cache uses: actions/cache@v2 @@ -914,349 +891,58 @@ jobs: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- - - name: Build - shell: bash - run: turbo run build-native --cache-dir=".turbo" -- --release --target i686-pc-windows-msvc - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: next-swc-binaries - path: packages/next-swc/native/next-swc.win32-ia32-msvc.node - - build-windows-aarch64: - needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} - name: next-swc - windows-aarch64 - node@14 - runs-on: windows-latest - steps: - name: Setup node uses: actions/setup-node@v2 + if: ${{ !matrix.settings.docker }} with: - node-version: 14 - - # we use checkout here instead of the build cache since - # it can fail to restore in different OS' - - uses: actions/checkout@v2 - - # 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 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly-2021-11-15 - override: true - target: aarch64-pc-windows-msvc - - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v2 - with: - path: .turbo - key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} - restore-keys: | - turbo-${{ github.job }}- - turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- - turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- - - - name: Build - shell: bash - run: turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-pc-windows-msvc - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: next-swc-binaries - path: packages/next-swc/native/next-swc.win32-arm64-msvc.node - - build-linux-musl: - needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} - name: next-swc - linux-musl - node@lts - runs-on: ubuntu-latest - steps: - # we use checkout here instead of the build cache since - # it can fail to restore in different OS' - - uses: actions/checkout@v2 - - - name: Login to registry - run: | - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL - env: - DOCKER_REGISTRY_URL: ghcr.io - DOCKER_USERNAME: ${{ github.actor }} - DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - - - name: Cache - uses: actions/cache@v2 - with: - path: | - target/ - key: linux-musl-publish-integration - - - name: Pull docker image - run: | - docker pull ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine - docker tag ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine builder - - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v2 - with: - path: .turbo - key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} - restore-keys: | - turbo-${{ github.job }}- - turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- - turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- - - - name: 'Build' - run: | - docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder sh -c "npm i -g @napi-rs/cli@1.2.1 && npm i -g turbo@1.0.28 && turbo run build-native --cache-dir=".turbo" -- --release --target x86_64-unknown-linux-musl" - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: next-swc-binaries - path: packages/next-swc/native/next-swc.linux-x64-musl.node - - build-linux-aarch64-gnu: - needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} - name: next-swc - aarch64-unknown-linux-gnu - node@14 - runs-on: ubuntu-18.04 - steps: - - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset - - - name: Setup node - uses: actions/setup-node@v2 - with: - node-version: 14 - - # we use checkout here instead of the build cache since - # it can fail to restore in different OS' - - uses: actions/checkout@v2 - - # 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 - - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly-2021-11-15 - override: true - target: aarch64-unknown-linux-gnu - - - name: Cache - uses: actions/cache@v2 - with: - path: | - target/ - key: aarch64-linux-gnu-publish-integration - - - name: Install cross compile toolchain - run: | - sudo apt-get update - sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y - - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v2 - with: - path: .turbo - key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} - restore-keys: | - turbo-${{ github.job }}- - turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- - turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- - - - name: Cross build aarch64 - if: ${{ steps.binary-cache.outputs.cache-hit != 'true' }} - run: turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-unknown-linux-gnu - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: next-swc-binaries - path: packages/next-swc/native/next-swc.linux-arm64-gnu.node - - build-linux-aarch64-musl: - needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} - name: next-swc - aarch64-unknown-linux-musl - node@14 - runs-on: ubuntu-18.04 - steps: - - name: Setup node - uses: actions/setup-node@v2 - with: - node-version: 14 - - # we use checkout here instead of the build cache since - # it can fail to restore in different OS' - - uses: actions/checkout@v2 + node-version: 16 + check-latest: true + cache: yarn - # 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 - - name: Install Rust + - name: Install uses: actions-rs/toolchain@v1 + if: ${{ !matrix.settings.docker }} with: profile: minimal - toolchain: nightly-2021-11-15 override: true - target: aarch64-unknown-linux-musl - - - name: Cache - uses: actions/cache@v2 - with: - path: | - target/ - key: aarch64-linux-musl-publish-integration - - - name: Install cross compile toolchain - run: | - sudo apt-get update - sudo apt-get install gcc-aarch64-linux-gnu -y - - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v2 - with: - path: .turbo - key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} - restore-keys: | - turbo-${{ github.job }}- - turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- - turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- - - - name: Cross build aarch64 - run: turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-unknown-linux-musl - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: next-swc-binaries - path: packages/next-swc/native/next-swc.linux-arm64-musl.node - - build-linux-arm7: - needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} - name: next-swc - arm7-unknown-linux-gnu - node@14 - runs-on: ubuntu-18.04 - steps: - - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset - - - name: Setup node - uses: actions/setup-node@v2 - with: - node-version: 14 - - # we use checkout here instead of the build cache since - # it can fail to restore in different OS' - - uses: actions/checkout@v2 - - # 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 - - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal toolchain: nightly-2021-11-15 - override: true - target: armv7-unknown-linux-gnueabihf + target: ${{ matrix.settings.target }} - - name: Cache + - name: Cache cargo registry uses: actions/cache@v2 with: - path: | - target/ - key: arm7-linux-gnu-publish-integration - - - name: Install cross compile toolchain - run: | - sudo apt-get update - sudo apt-get install gcc-arm-linux-gnueabihf -y + path: ~/.cargo/registry + key: ${{ matrix.settings.target }}-cargo-registry - - name: Turbo Cache - id: turbo-cache + - name: Cache cargo index uses: actions/cache@v2 with: - path: .turbo - key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} - restore-keys: | - turbo-${{ github.job }}- - turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- - turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- - - - name: Cross build aarch64 - run: turbo run build-native --cache-dir=".turbo" -- --release --target armv7-unknown-linux-gnueabihf - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: next-swc-binaries - path: packages/next-swc/native/next-swc.linux-arm-gnueabihf.node - - build-android-aarch64: - needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} - name: next-swc - Android - aarch64 - runs-on: macos-latest - steps: - - name: Setup node - uses: actions/setup-node@v2 - with: - node-version: 14 - - # we use checkout here instead of the build cache since - # it can fail to restore in different OS' - - uses: actions/checkout@v2 - - # 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 + path: ~/.cargo/git + key: ${{ matrix.settings.target }}-cargo-index - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly-2021-11-15 - override: true - target: aarch64-linux-android + - name: Setup toolchain + run: ${{ matrix.settings.setup }} + if: ${{ matrix.settings.setup }} + shell: bash - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v2 + - name: Build in docker + uses: addnab/docker-run-action@v3 + if: ${{ matrix.settings.docker }} with: - path: .turbo - key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} - restore-keys: | - turbo-${{ github.job }}- - turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- - turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- + 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 + - name: 'Build' + run: ${{ matrix.settings.build }} + if: ${{ !matrix.settings.docker }} shell: bash - run: | - export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android24-clang" - turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-linux-android - name: Upload artifact uses: actions/upload-artifact@v2 with: name: next-swc-binaries - path: packages/next-swc/native/next-swc.android-arm64.node + path: packages/next-swc/native/next-swc.*.node build-wasm: needs: build diff --git a/packages/next-swc/.cargo/config.toml b/packages/next-swc/.cargo/config.toml index 1fb099927fed8fb..1d7e537b13c3128 100644 --- a/packages/next-swc/.cargo/config.toml +++ b/packages/next-swc/.cargo/config.toml @@ -21,7 +21,7 @@ rustflags = [ ] [target.aarch64-unknown-linux-musl] -linker = "aarch64-linux-gnu-gcc" +linker = "aarch64-linux-musl-gcc" rustflags = [ "-C", "target-feature=-crt-static", diff --git a/packages/next-swc/crates/napi/npm/android-arm-eabi/README.md b/packages/next-swc/crates/napi/npm/android-arm-eabi/README.md new file mode 100644 index 000000000000000..7044554db68c738 --- /dev/null +++ b/packages/next-swc/crates/napi/npm/android-arm-eabi/README.md @@ -0,0 +1,3 @@ +# `@next/swc-android-arm-eabi` + +This is the **android-arm-eabi** binary for `@next/swc` diff --git a/packages/next-swc/crates/napi/npm/android-arm-eabi/package.json b/packages/next-swc/crates/napi/npm/android-arm-eabi/package.json new file mode 100644 index 000000000000000..69ec8a4b23a91b1 --- /dev/null +++ b/packages/next-swc/crates/napi/npm/android-arm-eabi/package.json @@ -0,0 +1,18 @@ +{ + "name": "@next/swc-android-arm-eabi", + "version": "0.0.0", + "os": [ + "android" + ], + "cpu": [ + "arm" + ], + "main": "next-swc.android-arm-eabi.node", + "files": [ + "next-swc.android-arm-eabi.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index 69368143ee37926..87deaf6c87d5b28 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -16,6 +16,7 @@ "armv7-unknown-linux-gnueabihf", "aarch64-apple-darwin", "aarch64-linux-android", + "arm-linux-androideabi", "x86_64-unknown-freebsd", "x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl", diff --git a/packages/next/package.json b/packages/next/package.json index e22442f6fdef61f..cdb265cbae244c9 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -115,7 +115,7 @@ "@babel/traverse": "7.15.0", "@babel/types": "7.15.0", "@hapi/accept": "5.0.2", - "@napi-rs/cli": "1.2.1", + "@napi-rs/cli": "2.4.4", "@napi-rs/triples": "1.0.3", "@next/polyfill-module": "12.0.11-canary.20", "@next/polyfill-nomodule": "12.0.11-canary.20", diff --git a/scripts/install-native.mjs b/scripts/install-native.mjs index a52305df8881b9b..198b6385e13ba4a 100644 --- a/scripts/install-native.mjs +++ b/scripts/install-native.mjs @@ -19,6 +19,7 @@ import fs from 'fs-extra' version: '1.0.0', optionalDependencies: { '@next/swc-android-arm64': 'canary', + '@next/swc-android-arm-eabi': 'canary', '@next/swc-darwin-arm64': 'canary', '@next/swc-darwin-x64': 'canary', '@next/swc-linux-arm-gnueabihf': 'canary', diff --git a/yarn.lock b/yarn.lock index a5d0874165bc290..d6733c25dd1e4bd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3706,10 +3706,10 @@ call-me-maybe "^1.0.1" glob-to-regexp "^0.3.0" -"@napi-rs/cli@1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@napi-rs/cli/-/cli-1.2.1.tgz#eccdf9e0835aec3adcef30074bf69c110ea65960" - integrity sha512-7FoYn1JSK5rTIG9KcKfYnZL/O0UjUMMuzZCXd//bJdkLw0Xx9EqQJs1X/Mg4KqywJYb79LDfxRMiJRSukPGDNw== +"@napi-rs/cli@2.4.4": + version "2.4.4" + resolved "https://registry.npmjs.org/@napi-rs/cli/-/cli-2.4.4.tgz#878a38f0fba1709d89d66eba706745ce728a61a5" + integrity sha512-f+tvwCv1ka24dBqI2DgBhR7Oxl3DKHOp4onxLXwyBFt6iCADnr3YZIr1/2Iq5r3uqxFgaf01bfPsRQZPkEp0kQ== "@napi-rs/triples@1.0.3", "@napi-rs/triples@^1.0.3": version "1.0.3" @@ -4501,9 +4501,9 @@ version "4.1.5" resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd" -"@types/eslint-scope@^3.7.3": +"@types/eslint-scope@^3.7.0", "@types/eslint-scope@^3.7.3": version "3.7.3" - resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.3.tgz#125b88504b61e3c8bc6f870882003253005c3224" + resolved "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.3.tgz#125b88504b61e3c8bc6f870882003253005c3224" integrity sha512-PB3ldyrcnAicT35TWPs5IcwKD8S333HMaa2VVv4+wdvebJkjWuW/xESoB8IwRcog8HYVYamb1g/R31Qv5Bx03g== dependencies: "@types/eslint" "*" @@ -4526,6 +4526,11 @@ version "0.0.39" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" +"@types/estree@^0.0.50": + version "0.0.50" + resolved "https://registry.npmjs.org/@types/estree/-/estree-0.0.50.tgz#1e0caa9364d3fccd2931c3ed96fdbeaa5d4cca83" + integrity sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw== + "@types/estree@^0.0.51": version "0.0.51" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.51.tgz#cfd70924a25a3fd32b218e5e420e6897e1ac4f40" @@ -8878,9 +8883,9 @@ enhanced-resolve@^4.3.0: memory-fs "^0.5.0" tapable "^1.0.0" -enhanced-resolve@^5.9.0: +enhanced-resolve@^5.8.3, enhanced-resolve@^5.9.0: version "5.9.0" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.9.0.tgz#49ac24953ac8452ed8fed2ef1340fc8e043667ee" + resolved "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.9.0.tgz#49ac24953ac8452ed8fed2ef1340fc8e043667ee" integrity sha512-weDYmzbBygL7HzGGS26M3hGQx68vehdEg6VUmqSOaFzXExFqlnKuSvsEJCVGQHScS8CQMbrAqftT+AzzHNt/YA== dependencies: graceful-fs "^4.2.4" @@ -14289,6 +14294,7 @@ minipass-fetch@^1.3.0, minipass-fetch@^1.3.2: resolved "https://registry.yarnpkg.com/minipass-fetch/-/minipass-fetch-1.3.3.tgz#34c7cea038c817a8658461bf35174551dce17a0a" integrity sha512-akCrLDWfbdAWkMLBxJEeWTdNsjML+dt5YgOI4gJ53vuO0vrmYQkUPxa6j6V65s9CcePIr2SSWqjT2EcrNseryQ== dependencies: + encoding "^0.1.12" minipass "^3.1.0" minipass-sized "^1.0.3" minizlib "^2.0.0" @@ -20812,7 +20818,7 @@ webpack-bundle-analyzer@4.3.0: source-list-map "^2.0.0" source-map "~0.6.1" -"webpack-sources3@npm:webpack-sources@3.2.3", webpack-sources@^3.2.2, webpack-sources@^3.2.3: +"webpack-sources3@npm:webpack-sources@3.2.3", webpack-sources@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==