@@ -46,64 +46,66 @@ jobs:
4646 name : Build ${{ matrix.variant }}-${{ matrix.arch }}
4747 runs-on : ${{ matrix.runner }}
4848 needs : [meta]
49- container : ${{ matrix.container || '' }}
5049 strategy :
5150 matrix :
5251 include :
5352 - arch : amd64
5453 runner : ubuntu-latest
5554 target : x86_64-unknown-linux-gnu
5655 variant : linux
56+ musl : false
5757 - arch : arm64
5858 runner : ubuntu-24.04-arm
5959 target : aarch64-unknown-linux-gnu
6060 variant : linux
61+ musl : false
6162 - arch : amd64
6263 runner : ubuntu-latest
6364 variant : linux-musl
64- container : alpine:latest
65+ musl : true
6566 - arch : arm64
6667 runner : ubuntu-24.04-arm
6768 variant : linux-musl
68- container : alpine:latest
69+ musl : true
6970 steps :
7071 - uses : actions/checkout@v6
7172 - name : Check if lib has a builtin
7273 id : check
7374 run : |
7475 lib="${{ needs.meta.outputs.lib }}"
75- if [ -d "${lib}-builtin" ]; then
76+ if [[ -d "${lib}-builtin" ] ]; then
7677 echo "has_builtin=true" >> "${GITHUB_OUTPUT}"
7778 else
7879 echo "has_builtin=false" >> "${GITHUB_OUTPUT}"
7980 fi
8081 # glibc builds
8182 - uses : dtolnay/rust-toolchain@stable
82- if : steps.check.outputs.has_builtin == 'true' && !matrix.container
83+ if : steps.check.outputs.has_builtin == 'true' && !matrix.musl
8384 with :
8485 targets : ${{ matrix.target }}
8586 - uses : Swatinem/rust-cache@v2
86- if : steps.check.outputs.has_builtin == 'true' && !matrix.container
87+ if : steps.check.outputs.has_builtin == 'true' && !matrix.musl
8788 with :
8889 shared-key : publish-${{ matrix.variant }}-${{ matrix.arch }}
8990 - name : Build (glibc)
90- if : steps.check.outputs.has_builtin == 'true' && !matrix.container
91+ if : steps.check.outputs.has_builtin == 'true' && !matrix.musl
9192 run : cargo build --release --target ${{ matrix.target }}
9293 - name : Rename .so (glibc)
93- if : steps.check.outputs.has_builtin == 'true' && !matrix.container
94+ if : steps.check.outputs.has_builtin == 'true' && !matrix.musl
9495 run : |
9596 lib="${{ needs.meta.outputs.lib }}"
9697 cp "target/${{ matrix.target }}/release/lib${lib}.so" \
9798 "${lib}-${{ matrix.variant }}-${{ matrix.arch }}.so"
98- # musl builds (Alpine container)
99- - name : Install build tools (musl)
100- if : steps.check.outputs.has_builtin == 'true' && matrix.container
101- run : apk add --no-cache rust cargo musl-dev
99+ # musl builds (docker run Alpine — avoids container: alpine JS action bug on arm64)
102100 - name : Build (musl)
103- if : steps.check.outputs.has_builtin == 'true' && matrix.container
104- run : cargo build --release
101+ if : steps.check.outputs.has_builtin == 'true' && matrix.musl
102+ run : |
103+ docker run --rm -v "$PWD:/src" -w /src alpine:latest sh -c '
104+ apk add --no-cache rust cargo musl-dev
105+ cargo build --release
106+ '
105107 - name : Rename .so (musl)
106- if : steps.check.outputs.has_builtin == 'true' && matrix.container
108+ if : steps.check.outputs.has_builtin == 'true' && matrix.musl
107109 run : |
108110 lib="${{ needs.meta.outputs.lib }}"
109111 cp "target/release/lib${lib}.so" \
0 commit comments