Skip to content

Commit 4269d05

Browse files
committed
Add aarch64-windows release artifacts
Also includes refactorings to mirror changes in bytecodealliance/wasm-component-ld#87 (also mirrored in bytecodealliance/wit-bindgen#1488). Change here include making the build more self-contained instead of relying on a github action from a historical release of Wasmtime.
1 parent e1fce94 commit 4269d05

File tree

3 files changed

+91
-32
lines changed

3 files changed

+91
-32
lines changed

.github/workflows/main.yml

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,41 +30,60 @@ jobs:
3030
include:
3131
- build: x86_64-linux
3232
os: ubuntu-latest
33+
env:
34+
CARGO_BUILD_TARGET: x86_64-unknown-linux-gnu
35+
DOCKER_IMAGE: ./ci/docker/x86_64-linux/Dockerfile
3336
- build: x86_64-musl
3437
os: ubuntu-latest
35-
target: x86_64-unknown-linux-musl
38+
env:
39+
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
40+
DOCKER_IMAGE: ./ci/docker/x86_64-musl/Dockerfile
41+
- build: aarch64-linux
42+
os: ubuntu-latest
43+
env:
44+
CARGO_BUILD_TARGET: aarch64-unknown-linux-gnu
45+
DOCKER_IMAGE: ./ci/docker/aarch64-linux/Dockerfile
46+
- build: aarch64-musl
47+
os: ubuntu-latest
48+
env:
49+
CARGO_BUILD_TARGET: aarch64-unknown-linux-musl
50+
DOCKER_IMAGE: ./ci/docker/aarch64-musl/Dockerfile
51+
3652
- build: x86_64-macos
3753
os: macos-latest
38-
target: x86_64-apple-darwin
54+
env:
55+
CARGO_BUILD_TARGET: x86_64-apple-darwin
56+
MACOSX_DEPLOYMENT_TARGET: 10.12
3957
- build: aarch64-macos
4058
os: macos-latest
41-
target: aarch64-apple-darwin
59+
env:
60+
CARGO_BUILD_TARGET: aarch64-apple-darwin
61+
MACOSX_DEPLOYMENT_TARGET: 10.12
62+
4263
- build: x86_64-windows
4364
os: windows-latest
44-
- build: aarch64-linux
45-
os: ubuntu-latest
46-
target: aarch64-unknown-linux-gnu
47-
- build: aarch64-musl
48-
os: ubuntu-latest
49-
target: aarch64-unknown-linux-musl
65+
env:
66+
CARGO_BUILD_TARGET: x86_64-pc-windows-msvc
67+
RUSTFLAGS: -Ctarget-feature=+crt-static
68+
- build: aarch64-windows
69+
os: windows-11-arm
70+
env:
71+
CARGO_BUILD_TARGET: aarch64-pc-windows-msvc
72+
RUSTFLAGS: -Ctarget-feature=+crt-static
73+
5074
- build: wasm32-wasip1
5175
os: ubuntu-latest
52-
target: wasm32-wasip1
76+
env:
77+
CARGO_BUILD_TARGET: wasm32-wasip1
78+
env: ${{ matrix.env }}
5379
steps:
5480
- uses: actions/checkout@v6
5581
with:
5682
submodules: true
5783
- uses: ./.github/actions/install-rust
58-
- uses: bytecodealliance/wasmtime/.github/actions/binary-compatible-builds@release-28.0.0
59-
with:
60-
name: ${{ matrix.build }}
61-
if: matrix.build != 'wasm32-wasip1'
62-
- run: |
63-
echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV
64-
rustup target add ${{ matrix.target }}
65-
if: matrix.target != ''
66-
- run: $CENTOS cargo build --release
67-
- run: ./ci/build-tarballs.sh "${{ matrix.build }}" "${{ matrix.target }}"
84+
- run: rustup target add $CARGO_BUILD_TARGET
85+
- run: ./ci/build-release-artifacts.sh
86+
- run: ./ci/build-tarballs.sh "${{ matrix.build }}"
6887
- uses: actions/upload-artifact@v4
6988
with:
7089
name: bins-${{ matrix.build }}

ci/build-release-artifacts.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
# A script to build the release artifacts of this repository into the `target`
4+
# directory. Note that this script only produces the artifacts through Cargo and
5+
# doesn't package things up. That's intended for the `build-tarballs.sh` script.
6+
7+
set -ex
8+
9+
# If `$DOCKER_IMAGE` is set then run the build inside of that docker container
10+
# instead of on the host machine. In CI this uses `./ci/docker/*/Dockerfile` to
11+
# have precise glibc requirements for Linux platforms for example.
12+
if [ "$DOCKER_IMAGE" != "" ]; then
13+
if [ -f "$DOCKER_IMAGE" ]; then
14+
docker build --tag build-image --file $DOCKER_IMAGE ci/docker
15+
DOCKER_IMAGE=build-image
16+
fi
17+
18+
# Inherit the environment's rustc and env vars related to cargo/rust, and then
19+
# otherwise re-execute ourselves and we'll be missing `$DOCKER_IMAGE` in the
20+
# container so we'll continue below.
21+
exec docker run --interactive \
22+
--volume `pwd`:`pwd` \
23+
--volume `rustc --print sysroot`:/rust:ro \
24+
--workdir `pwd` \
25+
--interactive \
26+
--env-file <(env | grep 'CARGO\|RUST') \
27+
$DOCKER_IMAGE \
28+
bash -c "PATH=\$PATH:/rust/bin RUSTFLAGS=\"\$RUSTFLAGS \$EXTRA_RUSTFLAGS\" `pwd`/$0 $*"
29+
fi
30+
31+
# Default build flags for release artifacts. Leave debugging for
32+
# builds-from-source which have richer information anyway, and additionally the
33+
# CLI won't benefit from catching unwinds.
34+
export CARGO_PROFILE_RELEASE_STRIP=debuginfo
35+
export CARGO_PROFILE_RELEASE_PANIC=abort
36+
37+
exec cargo build --release

ci/build-tarballs.sh

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -ex
44

55
platform=$1
6-
target=$2
6+
target=$CARGO_BUILD_TARGET
77

88
rm -rf tmp
99
mkdir tmp
@@ -15,17 +15,20 @@ bin_pkgname=wasm-tools-$tag-$platform
1515
mkdir tmp/$bin_pkgname
1616
cp LICENSE-* README.md tmp/$bin_pkgname
1717

18-
fmt=tar
19-
if [ "$platform" = "x86_64-windows" ]; then
20-
cp target/release/wasm-tools.exe tmp/$bin_pkgname
21-
fmt=zip
22-
elif [ "$target" = "wasm32-wasip1" ]; then
23-
cp target/wasm32-wasip1/release/wasm-tools.wasm tmp/$bin_pkgname
24-
elif [ "$target" = "" ]; then
25-
cp target/release/wasm-tools tmp/$bin_pkgname
26-
else
27-
cp target/$target/release/wasm-tools tmp/$bin_pkgname
28-
fi
18+
case $platform in
19+
*-windows)
20+
fmt=zip
21+
cp target/$target/release/wasm-tools.exe tmp/$bin_pkgname
22+
;;
23+
wasm*)
24+
fmt=tar
25+
cp target/$target/release/wasm-tools.wasm tmp/$bin_pkgname
26+
;;
27+
*)
28+
fmt=tar
29+
cp target/$target/release/wasm-tools tmp/$bin_pkgname
30+
;;
31+
esac
2932

3033

3134
mktarball() {

0 commit comments

Comments
 (0)