@@ -33,54 +33,43 @@ jobs:
3333 otp-version : ${{ matrix.otp }}
3434 elixir-version : ${{ matrix.elixir }}
3535
36- - name : Cache musl cross-compilers
37- id : cache-musl
38- uses : actions/cache@v5
36+ # taiki-e/setup-cross-toolchain-action pulls a prebuilt musl toolchain
37+ # from ghcr.io/taiki-e/rust-cross-toolchain, sidestepping musl.cc which
38+ # is unreliable. The action installs binaries named with the Rust triple
39+ # (x86_64-unknown-linux-musl-gcc); we symlink them to the names cc_precompiler
40+ # expects (x86_64-linux-musl-gcc) so the artefact filenames stay stable.
41+ - name : Install musl cross-toolchain (x86_64)
42+ uses : taiki-e/setup-cross-toolchain-action@v1
3943 with :
40- path : |
41- x86_64-linux-musl-cross
42- aarch64-linux-musl-cross
43- key : musl-${{ runner.os }}-build
44-
45- - if : steps.cache-musl.outputs.cache-hit != 'true'
46- name : Install musl cross-compilers
47- # more.musl.cc and musl.cc are run by the same maintainer and either
48- # can be down independently, so we try both with retries before giving
49- # up. Once installed they are cached by the actions/cache step above.
44+ target : x86_64-unknown-linux-musl
45+
46+ - name : Install musl cross-toolchain (aarch64)
47+ uses : taiki-e/setup-cross-toolchain-action@v1
48+ with :
49+ target : aarch64-unknown-linux-musl
50+
51+ - name : Map musl toolchain names for cc_precompiler
5052 run : |
51- set -e
52- install_musl() {
53- local arch=$1
54- local mirrors=(
55- "https://more.musl.cc/11.2.1/x86_64-linux-musl/${arch}-linux-musl-cross.tgz"
56- "https://musl.cc/${arch}-linux-musl-cross.tgz"
57- )
58- for url in "${mirrors[@]}"; do
59- for attempt in 1 2 3; do
60- echo "::group::Download ${arch} (attempt ${attempt}): ${url}"
61- if curl -fsSL --connect-timeout 30 --max-time 600 \
62- --retry 2 --retry-delay 5 "${url}" | tar -xz; then
63- echo "::endgroup::"
64- return 0
65- fi
66- echo "::endgroup::"
67- sleep 5
68- done
53+ set -eu
54+ for arch in x86_64 aarch64; do
55+ for tool in gcc g++; do
56+ src="/usr/local/bin/${arch}-unknown-linux-musl-${tool}"
57+ dst="/usr/local/bin/${arch}-linux-musl-${tool}"
58+ if [ ! -e "$src" ]; then
59+ echo "::error::Expected $src to exist after taiki-e/setup-cross-toolchain-action"
60+ exit 1
61+ fi
62+ sudo ln -sf "$src" "$dst"
63+ echo "Linked $dst -> $src"
6964 done
70- echo "::error::Failed to download ${arch} musl cross-compiler from any mirror"
71- return 1
72- }
73- install_musl x86_64
74- install_musl aarch64
65+ done
7566
7667 - name : Install GNU cross-compilers
7768 run : |
7869 sudo apt-get update
7970 sudo apt-get install -y gcc make curl tar \
8071 gcc-aarch64-linux-gnu \
8172 gcc-arm-linux-gnueabihf
82- echo "$PWD/x86_64-linux-musl-cross/bin" >> $GITHUB_PATH
83- echo "$PWD/aarch64-linux-musl-cross/bin" >> $GITHUB_PATH
8473
8574 - run : mix deps.get
8675
0 commit comments