Skip to content

Commit 6e3b5be

Browse files
committed
Fix remaining CI test failures on Linux
This involves a bit of fiddling so we can cross-compile the standard library tests to musl while on a GNU host. This in turn is necessary as GitHub's runner doesn't support Alpine on ARM64 hosts for some reason (actions/runner#801).
1 parent 651aca0 commit 6e3b5be

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

.github/workflows/tests.yml

+8-6
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,20 @@ jobs:
110110
runs-on: ${{ matrix.target.runner }}
111111
container:
112112
image: ghcr.io/inko-lang/ci:fedora
113+
env:
114+
# This is needed because when setting an explicit target, "ring" looks for
115+
# `aarch64-linux-musl-gcc` instead of using `musl-gcc`.
116+
CC_aarch64_unknown_linux_musl: musl-gcc
113117
steps:
114118
- uses: actions/checkout@v4
115119
- uses: actions/cache@v4
116120
with:
117121
path: '${{ env.CARGO_HOME }}'
118122
key: ${{ matrix.target.name }}-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml') }}
119-
- name: Build the runtime
120-
run: cargo build -p rt --target=${{ matrix.target.triple }}
121-
- name: Build the compiler
122-
run: INKO_RT="${PWD}/target/${{ matrix.target.triple }}/debug" cargo build -p inko
123-
- name: Run the tests
124-
run: 'cd std && ../target/${{ matrix.target.triple }}/debug/inko test --opt=${{ matrix.level }} --target=${{ matrix.name }}'
123+
- name: Build the runtime and compiler
124+
run: ./ci/linux.sh ${{ matrix.target.name }} ${{ matrix.target.triple }}
125+
- name: Run tests
126+
run: 'cd std && ../target/debug/inko test --opt=${{ matrix.level }} --target=${{ matrix.target.name }}'
125127

126128
compiler-mac:
127129
strategy:

ci/linux.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
INKO_VERSION="$(cargo pkgid -p inko | cut -d\# -f2 | cut -d: -f2)"
6+
INKO_TRIPLE="${1}"
7+
RUST_TRIPLE="${2}"
8+
INKO_RUNTIMES="${HOME}/.local/share/inko/runtimes/${INKO_VERSION}/${INKO_TRIPLE}"
9+
10+
function rustup_lib {
11+
local home
12+
local toolchain
13+
home="$(rustup show home)"
14+
toolchain="$(rustup show active-toolchain | awk '{print $1}')"
15+
16+
echo "${home}/toolchains/${toolchain}/lib/rustlib/${1}/lib/"
17+
}
18+
19+
# As the host is a GNU host, a bit of extra work is needed to get
20+
# cross-compilation to musl to work.
21+
if [[ "${INKO_TRIPLE}" == *-musl ]]
22+
then
23+
cargo build -p rt --target="${RUST_TRIPLE}"
24+
mkdir -p "${INKO_RUNTIMES}"
25+
cp "./target/${RUST_TRIPLE}/debug/libinko.a" "${INKO_RUNTIMES}/libinko.a"
26+
cp "$(rustup_lib "${RUST_TRIPLE}")/self-contained/libunwind.a" \
27+
"${INKO_RUNTIMES}/libunwind.a"
28+
29+
INKO_RT="${PWD}/target/${RUST_TRIPLE}/debug" cargo build -p inko
30+
else
31+
cargo build
32+
fi

0 commit comments

Comments
 (0)