Skip to content

Commit

Permalink
chore(ci): Fix macOS x64 build & publish job (#8901)
Browse files Browse the repository at this point in the history
`macos-latest` runner was upgraded to `macos-14-arm64`. We need to add `--target x86_64-apple-darwin` explicitly

- Closes #8898
  • Loading branch information
Brooooooklyn authored Apr 29, 2024
1 parent 7ac3b0a commit 65ea99e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
25 changes: 13 additions & 12 deletions .github/workflows/publish-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ jobs:
- host: macos-latest
target: x86_64-apple-darwin
build: |
cargo build --manifest-path ./bindings/swc_cli/Cargo.toml --release --features plugin
cp ./bindings/target/release/swc .
cargo build --manifest-path ./bindings/swc_cli/Cargo.toml --release --features plugin --target x86_64-apple-darwin
cp ./bindings/target/x86_64-apple-darwin/release/swc .
chmod +x ./swc
yarn build
yarn build --target x86_64-apple-darwin
strip -x *.node
- host: windows-latest
build: |
export CARGO_PROFILE_RELEASE_LTO=false
yarn build
cargo build --manifest-path ./bindings/swc_cli/Cargo.toml --release --features plugin
cp ./bindings/target/release/swc .
yarn build --target x86_64-pc-windows-msvc
cargo build --manifest-path ./bindings/swc_cli/Cargo.toml --release --features plugin --target x86_64-pc-windows-msvc
cp ./bindings/target/x86_64-pc-windows-msvc/release/swc .
target: x86_64-pc-windows-msvc
- host: windows-latest
# use npm to run test, because of corepack link the yarn with x64 Node.js
Expand All @@ -61,7 +61,7 @@ jobs:
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
build: >-
set -e &&
unset CC_x86_64_unknown_linux_gnu && unset CC && RUSTFLAGS='-C target-feature=+sse2' cargo build --manifest-path ./bindings/swc_cli/Cargo.toml --release --features plugin &&
unset CC_x86_64_unknown_linux_gnu && unset CC && RUSTFLAGS='-C target-feature=+sse2' cargo build --manifest-path ./bindings/swc_cli/Cargo.toml --release --features plugin --target x86_64-unknown-linux-gnu &&
rm -rf bindings/target/target/x86_64-unknown-linux-gnu/release/.cargo-lock &&
cp bindings/target/x86_64-unknown-linux-gnu/release/swc . && chmod +x ./swc &&
yarn build --target x86_64-unknown-linux-gnu
Expand All @@ -72,10 +72,10 @@ jobs:
build: >-
set -e &&
export CARGO_PROFILE_RELEASE_LTO=false &&
RUSTFLAGS='-C target-feature=+sse2' cargo build --manifest-path ./bindings/swc_cli/Cargo.toml --release --features plugin &&
RUSTFLAGS='-C target-feature=+sse2' cargo build --manifest-path ./bindings/swc_cli/Cargo.toml --release --features plugin --target x86_64-unknown-linux-musl &&
rm -rf target/release/.cargo-lock &&
cp bindings/target/release/swc . && chmod +x ./swc &&
RUSTFLAGS='-C target-feature=+sse2 -C target-feature=-crt-static' yarn build
cp bindings/target/x86_64-unknown-linux-musl/release/swc . && chmod +x ./swc &&
RUSTFLAGS='-C target-feature=+sse2 -C target-feature=-crt-static' yarn build --target x86_64-unknown-linux-musl
- host: macos-latest
target: aarch64-apple-darwin
build: |
Expand All @@ -84,7 +84,7 @@ jobs:
export CXX=$(xcrun -f clang++);
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
cargo build --manifest-path ./bindings/swc_cli/Cargo.toml --release --features plugin --target=aarch64-apple-darwin
cargo build --manifest-path ./bindings/swc_cli/Cargo.toml --release --features plugin --target aarch64-apple-darwin
cp ./bindings/target/aarch64-apple-darwin/release/swc .
chmod +x ./swc
yarn build --target aarch64-apple-darwin
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
- uses: goto-bus-stop/setup-zig@v2
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }}
with:
version: 0.11.0
version: 0.12.0
- name: Cache cargo registry
uses: actions/cache@v3
with:
Expand Down Expand Up @@ -235,6 +235,7 @@ jobs:
with:
node-version: ${{ matrix.node }}
cache: yarn
architecture: x64
- name: Install dependencies
run: yarn install --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000
- name: Download artifacts
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/publish-extra-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
- host: macos-latest
target: x86_64-apple-darwin
build: |
(cd packages/${{ github.event.inputs.package }} && yarn build)
(cd packages/${{ github.event.inputs.package }} && yarn build --target x86_64-apple-darwin)
- host: windows-latest
build: |
(cd packages/${{ github.event.inputs.package }} && yarn build)
(cd packages/${{ github.event.inputs.package }} && yarn build --target x86_64-pc-windows-msvc)
target: x86_64-pc-windows-msvc
- host: windows-latest
build: |
Expand All @@ -58,7 +58,7 @@ jobs:
build: >-
set -e &&
export CARGO_PROFILE_RELEASE_LTO=false &&
(cd packages/${{ github.event.inputs.package }} && RUSTFLAGS='-C target-feature=+sse2 -C target-feature=-crt-static' yarn build)
(cd packages/${{ github.event.inputs.package }} && RUSTFLAGS='-C target-feature=+sse2 -C target-feature=-crt-static' yarn build --target x86_64-unknown-linux-musl)
- host: macos-latest
target: aarch64-apple-darwin
build: |
Expand All @@ -67,7 +67,7 @@ jobs:
export CXX=$(xcrun -f clang++);
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
(cd packages/${{ github.event.inputs.package }} && yarn build --target=aarch64-apple-darwin)
(cd packages/${{ github.event.inputs.package }} && yarn build --target aarch64-apple-darwin)
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
Expand All @@ -92,7 +92,7 @@ jobs:
export JEMALLOC_SYS_WITH_LG_PAGE=16 &&
rustup toolchain install $(cat ./rust-toolchain) &&
rustup target add aarch64-unknown-linux-musl &&
(cd packages/${{ github.event.inputs.package }} && env RUSTFLAGS='-C target-feature=-crt-static' yarn build --target=aarch64-unknown-linux-musl)
(cd packages/${{ github.event.inputs.package }} && env RUSTFLAGS='-C target-feature=-crt-static' yarn build --target aarch64-unknown-linux-musl)
- host: windows-latest
target: aarch64-pc-windows-msvc
# Disable `LTO` and increase `codegen-units` to avoid llvm `OOM` on GitHub Actions.
Expand Down Expand Up @@ -206,6 +206,7 @@ jobs:
with:
node-version: ${{ matrix.node }}
cache: "yarn"
architecture: x64
- name: Install dependencies
working-directory: "./packages/${{ github.event.inputs.package }}"
run: yarn
Expand Down

0 comments on commit 65ea99e

Please sign in to comment.