mirror of
https://github.com/jmcorgan/fips.git
synced 2026-10-30 07:37:36 +00:00
Local CI builds and lints only for the Linux host, so a change that breaks the macOS, Windows or FreeBSD build, such as a Unix-only item used without a cfg gate, passes it and the internal builder and first goes red on GitHub's non-Linux jobs. testing/cross-check/check.sh runs cargo check --workspace --all-targets for x86_64-apple-darwin, x86_64-pc-windows-gnu and x86_64-unknown-freebsd, with zig cc and zig ar as the C compiler and archiver for crates that build C. All three share one target directory, target/cross-check/, reused between runs, so the host-side build scripts and proc macros are built once. It can be run on its own, or by testing/ci-local.sh with --cross-check, which adds it to the build stage after clippy and records one result per target. It is off by default because it needs zig. A missing Rust target is installed with rustup target add. The targets are deliberately not listed in rust-toolchain.toml, since rustup would then fetch them for every cargo call in the repository, the package builds included, and fail all of them when its download server is unreachable. When the check is asked for, a missing zig or a target that cannot be installed fails the run with a message naming it. The check is local-only by design, since GitHub CI builds and tests on real macOS, Windows and FreeBSD runners; the parity guard's header says so. The shellcheck guard now lints the three new scripts.
25 lines
721 B
Bash
Executable File
25 lines
721 B
Bash
Executable File
#!/bin/bash
|
|
# C compiler for testing/cross-check/check.sh: zig cc for the zig target named
|
|
# in $ZTARGET.
|
|
#
|
|
# The cc crate passes its own --target=<rust triple> (and, for Apple targets,
|
|
# -mmacosx-version-min), which zig does not accept in that form; they are
|
|
# dropped and replaced by zig's -target. zig is ${ZIG:-zig}, which check.sh
|
|
# sets to the absolute path it found.
|
|
set -u
|
|
|
|
if [[ -z "${ZTARGET:-}" ]]; then
|
|
echo "zig-cc: ZTARGET is not set; this wrapper is meant to be run by testing/cross-check/check.sh" >&2
|
|
exit 2
|
|
fi
|
|
|
|
args=()
|
|
for a in "$@"; do
|
|
case "$a" in
|
|
--target=*|-mmacosx-version-min=*) continue ;;
|
|
esac
|
|
args+=("$a")
|
|
done
|
|
|
|
exec "${ZIG:-zig}" cc -target "$ZTARGET" "${args[@]}"
|