Skip to content

Commit

Permalink
ci: fix macOS x64 build & publish job
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Apr 28, 2024
1 parent 7114530 commit 590fa00
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/publish-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ jobs:
- host: macos-latest
target: x86_64-apple-darwin
build: |
cargo build --manifest-path ./bindings/swc_cli/Cargo.toml --release --features plugin
cargo build --manifest-path ./bindings/swc_cli/Cargo.toml --release --features plugin --target x86_64-apple-darwin
cp ./bindings/target/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
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/release/swc .
target: x86_64-pc-windows-msvc
- host: windows-latest
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
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 590fa00

Please sign in to comment.