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
174 changes: 87 additions & 87 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,23 @@ jobs:
strategy:
matrix:
include:
- target: aarch64-apple-darwin
os: macos-15
- target: aarch64-pc-windows-msvc
os: windows-11-arm
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
# FIXME: It currently causes segfaults.
#- target: i686-pc-windows-gnu
# env: { ARCH_BITS: 32, ARCH: i686 }
- target: i686-pc-windows-msvc
os: windows-2025
# - target: aarch64-apple-darwin
# os: macos-15
# - target: aarch64-pc-windows-msvc
# os: windows-11-arm
# - target: aarch64-unknown-linux-gnu
# os: ubuntu-24.04-arm
# # FIXME: It currently causes segfaults.
# #- target: i686-pc-windows-gnu
# # env: { ARCH_BITS: 32, ARCH: i686 }
# - target: i686-pc-windows-msvc
# os: windows-2025
- target: i686-unknown-linux-gnu
- target: x86_64-pc-windows-gnu
os: windows-2025
env: { ARCH_BITS: 64, ARCH: x86_64 }
- target: x86_64-pc-windows-msvc
os: windows-2025
# - target: x86_64-pc-windows-gnu
# os: windows-2025
# env: { ARCH_BITS: 64, ARCH: x86_64 }
# - target: x86_64-pc-windows-msvc
# os: windows-2025
- target: x86_64-unknown-linux-gnu
runs-on: ${{ matrix.os && matrix.os || 'ubuntu-24.04' }}
timeout-minutes: 25
Expand Down Expand Up @@ -173,16 +173,16 @@ jobs:

test_tier2:
name: Test tier2
needs: [test_tier1, style_check]
# needs: [test_tier1, style_check]
strategy:
fail-fast: true
fail-fast: false
max-parallel: 16
matrix:
include:
# FIXME(sparc): this takes much longer to run than any other job, put
# it first to make sure it gets a head start.
- target: sparc64-unknown-linux-gnu
- target: aarch64-linux-android
# - target: aarch64-linux-android
- target: aarch64-unknown-linux-musl
- target: aarch64-unknown-linux-musl
env: { RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1 }
Expand All @@ -199,25 +199,25 @@ jobs:
- target: i686-unknown-linux-musl
env: { RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1 }
artifact-tag: new-musl
- target: loongarch64-unknown-linux-gnu
- target: loongarch64-unknown-linux-musl
- target: loongarch64-unknown-linux-musl
env: { RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1 }
artifact-tag: new-musl
- target: powerpc64-unknown-linux-gnu
- target: powerpc64le-unknown-linux-gnu
- target: powerpc64le-unknown-linux-musl
- target: powerpc64le-unknown-linux-musl
env: { RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1 }
artifact-tag: new-musl
- target: riscv64gc-unknown-linux-gnu
- target: s390x-unknown-linux-gnu
- target: wasm32-unknown-emscripten
- target: wasm32-wasip1
- target: wasm32-wasip2
- target: x86_64-apple-darwin
os: macos-15-intel
- target: x86_64-linux-android
# - target: loongarch64-unknown-linux-gnu
# - target: loongarch64-unknown-linux-musl
# - target: loongarch64-unknown-linux-musl
# env: { RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1 }
# artifact-tag: new-musl
# - target: powerpc64-unknown-linux-gnu
# - target: powerpc64le-unknown-linux-gnu
# - target: powerpc64le-unknown-linux-musl
# - target: powerpc64le-unknown-linux-musl
# env: { RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1 }
# artifact-tag: new-musl
# - target: riscv64gc-unknown-linux-gnu
# - target: s390x-unknown-linux-gnu
# - target: wasm32-unknown-emscripten
# - target: wasm32-wasip1
# - target: wasm32-wasip2
# - target: x86_64-apple-darwin
# os: macos-15-intel
# - target: x86_64-linux-android
# FIXME: Exec format error (os error 8)
# - target: x86_64-unknown-linux-gnux32
- target: x86_64-unknown-linux-musl
Expand Down Expand Up @@ -267,55 +267,55 @@ jobs:
path: ${{ env.ARCHIVE_PATH }}
retention-days: 5

test_tier2_vm:
name: Test tier2 VM
needs: [test_tier1, style_check]
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- target: x86_64-pc-solaris
- target: x86_64-unknown-netbsd
timeout-minutes: 25
steps:
- uses: actions/checkout@v6
- name: test on Solaris
uses: vmactions/solaris-vm@v1.1.8
if: contains(matrix.target, 'solaris')
with:
release: "11.4-gcc"
usesh: true
mem: 4096
copyback: false
prepare: |
set -x
source <(curl -s https://raw.githubusercontent.com/psumbera/solaris-rust/refs/heads/main/sh.rust-web-install)
rustc --version
uname -a
run: |
export PATH=$HOME/.rust_solaris/bin:$PATH
./ci/run.sh ${{ matrix.target }}
# test_tier2_vm:
# name: Test tier2 VM
# needs: [test_tier1, style_check]
# runs-on: ubuntu-latest
# strategy:
# fail-fast: true
# matrix:
# include:
# - target: x86_64-pc-solaris
# - target: x86_64-unknown-netbsd
# timeout-minutes: 25
# steps:
# - uses: actions/checkout@v6
# - name: test on Solaris
# uses: vmactions/solaris-vm@v1.1.8
# if: contains(matrix.target, 'solaris')
# with:
# release: "11.4-gcc"
# usesh: true
# mem: 4096
# copyback: false
# prepare: |
# set -x
# source <(curl -s https://raw.githubusercontent.com/psumbera/solaris-rust/refs/heads/main/sh.rust-web-install)
# rustc --version
# uname -a
# run: |
# export PATH=$HOME/.rust_solaris/bin:$PATH
# ./ci/run.sh ${{ matrix.target }}

- name: Test on NetBSD
uses: vmactions/netbsd-vm@v1
if: contains(matrix.target, 'netbsd')
with:
release: "10.1"
usesh: true
mem: 4096
copyback: false
prepare: |
set -x
/usr/sbin/pkg_add curl
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \
--profile minimal --default-toolchain nightly -y
run: |
set -x
. "$HOME/.cargo/env"
which rustc
rustc -Vv
./ci/run.sh ${{ matrix.target }}
# - name: Test on NetBSD
# uses: vmactions/netbsd-vm@v1
# if: contains(matrix.target, 'netbsd')
# with:
# release: "10.1"
# usesh: true
# mem: 4096
# copyback: false
# prepare: |
# set -x
# /usr/sbin/pkg_add curl
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \
# --profile minimal --default-toolchain nightly -y
# run: |
# set -x
# . "$HOME/.cargo/env"
# which rustc
# rustc -Vv
# ./ci/run.sh ${{ matrix.target }}

ctest_msrv:
name: Check ctest MSRV
Expand Down Expand Up @@ -357,7 +357,7 @@ jobs:
- style_check
- test_tier1
- test_tier2
- test_tier2_vm
# - test_tier2_vm
- verify_build
- ctest_msrv
- docs
Expand Down
48 changes: 27 additions & 21 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ fn main() {
//
// On CI, we detect the actual FreeBSD version and match its ABI exactly,
// running tests to ensure that the ABI is correct.
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_FREEBSD_VERSION");
// Allow overriding the default version for testing
let which_freebsd = if let Ok(version) = env::var("RUST_LIBC_UNSTABLE_FREEBSD_VERSION") {
//
// The env allows overriding the default version for testing
let which_freebsd = if let Some(version) = env_value("RUST_LIBC_UNSTABLE_FREEBSD_VERSION") {
let vers = version.parse().unwrap();
println!("cargo:warning=setting FreeBSD version to {vers}");
vers
Expand Down Expand Up @@ -100,14 +100,11 @@ fn main() {
}

let musl_v1_2_3 = env_flag("RUST_LIBC_UNSTABLE_MUSL_V1_2_3");
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_MUSL_V1_2_3");
// loongarch64 and ohos have already updated
if musl_v1_2_3 || target_arch == "loongarch64" || target_env == "ohos" {
// FIXME(musl): enable time64 api as well
set_cfg("musl_v1_2_3");
}
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS");
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_GNU_TIME_BITS");
if target_env == "gnu"
&& target_os == "linux"
&& target_ptr_width == "32"
Expand All @@ -116,16 +113,16 @@ fn main() {
{
let defaultbits = "32".to_string();
let (timebits, filebits) = match (
env::var("RUST_LIBC_UNSTABLE_GNU_TIME_BITS"),
env::var("RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS"),
env_value("RUST_LIBC_UNSTABLE_GNU_TIME_BITS"),
env_value("RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS"),
) {
(Ok(_), Ok(_)) => panic!("Do not set both RUST_LIBC_UNSTABLE_GNU_TIME_BITS and RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS"),
(Err(_), Err(_)) => (defaultbits.clone(), defaultbits.clone()),
(Ok(tb), Err(_)) if tb == "64" => (tb.clone(), tb.clone()),
(Ok(tb), Err(_)) if tb == "32" => (tb, defaultbits.clone()),
(Ok(_), Err(_)) => panic!("Invalid value for RUST_LIBC_UNSTABLE_GNU_TIME_BITS, must be 32 or 64"),
(Err(_), Ok(fb)) if fb == "32" || fb == "64" => (defaultbits.clone(), fb),
(Err(_), Ok(_)) => panic!("Invalid value for RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS, must be 32 or 64"),
(Some(_), Some(_)) => panic!("Do not set both RUST_LIBC_UNSTABLE_GNU_TIME_BITS and RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS"),
(None, None) => (defaultbits.clone(), defaultbits.clone()),
(Some(tb), None) if tb == "64" => (tb.clone(), tb.clone()),
(Some(tb), None) if tb == "32" => (tb, defaultbits.clone()),
(Some(_), None) => panic!("Invalid value for RUST_LIBC_UNSTABLE_GNU_TIME_BITS, must be 32 or 64"),
(None, Some(fb)) if fb == "32" || fb == "64" => (defaultbits.clone(), fb),
(None, Some(_)) => panic!("Invalid value for RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS, must be 32 or 64"),
};
let valid_bits = ["32", "64"];
assert!(
Expand Down Expand Up @@ -287,7 +284,7 @@ fn emcc_version_code() -> Option<u64> {
/// environment, in `(minor, patch)` form. Currently the only major version supported by Rust
/// is 7.
fn vxworks_version_code() -> Option<(u32, u32)> {
let version = env::var("WIND_RELEASE_ID").ok()?;
let version = env_value("WIND_RELEASE_ID")?;

let mut pieces = version.trim().split(['.']);

Expand All @@ -305,12 +302,21 @@ fn set_cfg(cfg: &str) {
println!("cargo:rustc-cfg={cfg}");
}

/// Return true if the env is set to a value other than `0`.
/// Return true if the env is set to a value other than `0`. Sets `rerun-if-changed`.
fn env_flag(key: &str) -> bool {
match env_value(key) {
Some(x) if x == "0" => false,
None => false,
Some(_) => true,
}
}

/// Return the value if set. Sets `rerun-if-changed`.
fn env_value(key: &str) -> Option<String> {
println!("cargo:rerun-if-env-changed={key}");
match env::var(key) {
Ok(x) if x == "0" => false,
Err(VarError::NotPresent) => false,
Err(VarError::NotUnicode(_)) => panic!("non-unicode var for `{key}`"),
Ok(_) => true,
Ok(v) => Some(v),
Err(VarError::NotPresent) => None,
Err(VarError::NotUnicode(_)) => panic!("non-unicode env value `{key}`"),
}
}
2 changes: 2 additions & 0 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export RUSTFLAGS="${EXTRA_RUSTFLAGS:-} ${RUSTFLAGS:-}"

echo "RUSTFLAGS: '$RUSTFLAGS'"

export CC_ENABLE_DEBUG_OUTPUT=1

# For logging
uname -a

Expand Down
Loading
Loading