From d618df04dedce6a3c38ee99a6424d0f1942841a9 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Wed, 11 May 2022 16:50:57 +0800 Subject: [PATCH] Build x86_64-freebsd SWC binary --- .github/workflows/build_test_deploy.yml | 60 +++++++++++++++++++ .../crates/napi/npm/freebsd-x64/README.md | 3 + .../crates/napi/npm/freebsd-x64/package.json | 18 ++++++ 3 files changed, 81 insertions(+) create mode 100644 packages/next-swc/crates/napi/npm/freebsd-x64/README.md create mode 100644 packages/next-swc/crates/napi/npm/freebsd-x64/package.json diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 59b4e71bce5b3..e82e3ac929d18 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -1303,6 +1303,66 @@ jobs: name: next-swc-binaries path: packages/next-swc/native/next-swc.*.node + build-native-freebsd: + if: ${{ needs.build.outputs.isRelease == 'true' }} + needs: build + name: stable - x86_64-unknown-freebsd - node@16 + runs-on: macos-10.15 + steps: + - name: tune mac network + run: sudo sysctl -w net.link.generic.system.hwcksum_tx=0 && sudo sysctl -w net.link.generic.system.hwcksum_rx=0 + - uses: actions/checkout@v3 + - name: Delete useless files + run: | + rm -rf bench + rm -rf docs + rm -rf errors + rm -rf examples + rm -rf scripts + rm -rf test + - name: Build + id: build + uses: vmactions/freebsd-vm@v0.1.6 + env: + DEBUG: napi:* + RUSTUP_HOME: /usr/local/rustup + CARGO_HOME: /usr/local/cargo + RUSTUP_IO_THREADS: 1 + # Disable LTO, or the lld may crash with OOM + CARGO_PROFILE_RELEASE_LTO: false + with: + envs: DEBUG RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS CARGO_PROFILE_RELEASE_LTO NAPI_CLI_VERSION TURBO_VERSION RUST_TOOLCHAIN + usesh: true + mem: 6000 + prepare: | + pkg install -y curl node14 + curl -qL https://www.npmjs.com/install.sh | sh + npm install -g yarn + curl https://sh.rustup.rs -sSf --output rustup.sh + sh rustup.sh -y --profile minimal --default-toolchain stable + export PATH="/usr/local/cargo/bin:$PATH" + echo "~~~~ rustc --version ~~~~" + rustc --version + echo "~~~~ node -v ~~~~" + node -v + run: | + export PATH="/usr/local/cargo/bin:$PATH" + pwd + ls -lah + whoami + env + freebsd-version + npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" + yarn --cwd packages/next-swc build-native --release --target x86_64-unknown-freebsd + rm -rf node_modules + rm -rf packages/next-swc/target + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: next-swc-binaries + path: packages/next-swc/native/next-swc.*.node + if-no-files-found: error + build-wasm: needs: build if: ${{ needs.build.outputs.isRelease == 'true' }} diff --git a/packages/next-swc/crates/napi/npm/freebsd-x64/README.md b/packages/next-swc/crates/napi/npm/freebsd-x64/README.md new file mode 100644 index 0000000000000..8a9ba18e17b4d --- /dev/null +++ b/packages/next-swc/crates/napi/npm/freebsd-x64/README.md @@ -0,0 +1,3 @@ +# `@next/swc-freebsd-x64` + +This is the **x86_64-unknown-freebsd** binary for `@next/swc` diff --git a/packages/next-swc/crates/napi/npm/freebsd-x64/package.json b/packages/next-swc/crates/napi/npm/freebsd-x64/package.json new file mode 100644 index 0000000000000..d76208230f26d --- /dev/null +++ b/packages/next-swc/crates/napi/npm/freebsd-x64/package.json @@ -0,0 +1,18 @@ +{ + "name": "@next/swc-freebsd-x64", + "version": "0.0.0", + "os": [ + "freebsd" + ], + "cpu": [ + "x64" + ], + "main": "next-swc.freebsd-x64.node", + "files": [ + "next-swc.freebsd-x64.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +}