Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,66 @@ jobs:
path: ${{ env.ARCHIVE_PATH }}
retention-days: 5

test_tier3:
name: Test tier3
#needs: [test_tier2, style_check]
runs-on: ubuntu-24.04
strategy:
fail-fast: true
max-parallel: 12
matrix:
target:
# We test a handful of tier 3 targets that are known to be well-maintained
#- mips64-unknown-linux-muslabi64
#- powerpc64-unknown-linux-musl
#- riscv64gc-unknown-linux-musl
- s390x-unknown-linux-musl
include:
#- target: mips64-unknown-linux-muslabi64
# env:
# RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1
#- target: powerpc64-unknown-linux-musl
# env:
# RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1
#- target: riscv64gc-unknown-linux-musl
# env:
# RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1
- target: s390x-unknown-linux-musl
env:
RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1
timeout-minutes: 25
env:
INSTALL_RUST_SRC: 1
LIBC_CI_ZBUILD_STD: 1
TARGET: ${{ matrix.target }}
steps:
- uses: actions/checkout@v5
- name: Setup Rust toolchain
run: ./ci/install-rust.sh
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Add matrix env variables to the environment
if: matrix.env
run: |
echo '${{ toJson(matrix.env) }}' |
jq -r 'to_entries | map("\(.key)=\(.value|tostring)") | .[]' >>$GITHUB_ENV
shell: bash

- name: Execute run-docker.sh
run: ./ci/run-docker.sh ${{ matrix.target }}

- name: Create CI artifacts
id: create_artifacts
if: always()
run: ./ci/create-artifacts.py
- uses: actions/upload-artifact@v4
if: always() && steps.create_artifacts.outcome == 'success'
with:
name: ${{ env.ARCHIVE_NAME }}-${{ matrix.target }}${{ matrix.artifact-tag && format('-{0}', matrix.artifact-tag) }}
path: ${{ env.ARCHIVE_PATH }}
retention-days: 5

test_tier2_vm:
name: Test tier2 VM
needs: [test_tier1, style_check]
Expand Down
31 changes: 21 additions & 10 deletions ci/docker/s390x-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
FROM ubuntu:25.04

RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates \
gcc \
gcc-s390x-linux-gnu \
qemu-user \
xz-utils patch rsync
gcc make libc6-dev git curl ca-certificates \
gcc-s390x-linux-gnu qemu-user xz-utils patch rsync

# Set up an Alpine sysroot for acquiring libgcc and libgcc_s
RUN curl https://repo.chimera-linux.org/apk/3.0.0_rc4-r2/apk-x86_64.static -o /usr/bin/apk && \
chmod +x /usr/bin/apk && \
mkdir /alpine-sysroot && \
apk \
--arch s390x \
--root /alpine-sysroot \
--repository https://dl-cdn.alpinelinux.org/alpine/v3.22/main \
add \
--initdb \
--allow-untrusted \
--no-scripts \
alpine-baselayout libgcc

COPY install-musl.sh /
RUN /install-musl.sh s390x

# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in std?
ENV CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc \
CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER="qemu-s390x -L /musl-s390x" \
CC_s390x_unknown_linux_gnu=musl-gcc \
RUSTFLAGS='-Clink-args=-lgcc -L /musl-s390x/lib' \
PATH=$PATH:/musl-s390x/bin:/rust/bin
ENV PATH=$PATH:/musl-s390x/bin:/rust/bin \
CC_s390x_unknown_linux_musl=musl-gcc \
RUSTFLAGS='-Clink-args=-lgcc -L/alpine-sysroot/usr/lib -L /musl-s390x/lib' \
CARGO_TARGET_S390X_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc \
CARGO_TARGET_S390X_UNKNOWN_LINUX_MUSL_RUNNER="qemu-s390x -L /musl-s390x"
8 changes: 3 additions & 5 deletions ci/install-rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ rustup set profile minimal
rustup update --force "$toolchain" --no-self-update
rustup default "$toolchain"

if [ -n "${TARGET:-}" ]; then
echo "Install target"
rustup target add "$TARGET"
fi

if [ -n "${INSTALL_RUST_SRC:-}" ]; then
echo "Install rust-src"
rustup component add rust-src
elif [ -n "${TARGET:-}" ]; then
echo "Install target"
rustup target add "$TARGET"
fi

if [ "$os" = "windows" ]; then
Expand Down
5 changes: 4 additions & 1 deletion ctest/src/macro_expansion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fs::canonicalize;
use std::path::Path;
use std::process::Command;

use crate::{EDITION, Result};
use crate::{EDITION, GenerationError, Result};

/// Use rustc to expand all macros and pretty print the crate into a single file.
pub fn expand<P: AsRef<Path>>(
Expand All @@ -12,10 +12,13 @@ pub fn expand<P: AsRef<Path>>(
target: String,
) -> Result<String> {
let rustc = env::var("RUSTC").unwrap_or_else(|_| String::from("rustc"));
let out_dir =
env::var("OUT_DIR").map_err(|_| GenerationError::EnvVarNotFound("OUT_DIR".to_string()))?;

let mut cmd = Command::new(rustc);
cmd.env("RUSTC_BOOTSTRAP", "1")
.arg("-Zunpretty=expanded")
.arg(format!("-L{out_dir}/../../../deps"))
.arg("--edition")
.arg(EDITION) // By default, -Zunpretty=expanded uses 2015 edition.
.arg(canonicalize(crate_path)?);
Expand Down
Loading