Skip to content

Commit

Permalink
fixup! ci: Reduce redundant commands in build.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Nov 20, 2024
1 parent 7c0c954 commit 7b99124
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,24 @@ if [ "$TOOLCHAIN" = "nightly" ] ; then
fi

test_target() {
build_cmd="${1}"
target="${2}"
no_std="${3}"
target="${1}"
no_dist="${2:0}"

RUSTFLAGS="${RUSTFLAGS:-}"

# The basic command that is run each time
cmd="cargo +$rust $build_cmd --target $target"
cmd="cargo +$rust build --target $target"

# If there is a std component, fetch it:
if [ "${no_std}" != "1" ]; then
if [ "${no_dist}" == "0" ]; then
# If we can't download a `core`, we need to build it
cmd="$cmd -Zbuild-std=core,alloc"

# FIXME: With `build-std` feature, `compiler_builtins` emits a lof of lint warnings.
RUSTFLAGS="${RUSTFLAGS:-} -Aimproper_ctypes_definitions"
export RUSTFLAGS
else
# Otherwise it is available for download; fetch it:

# FIXME: rustup often fails to download some artifacts due to network
# issues, so we retry this N times.
N=5
Expand All @@ -42,12 +49,6 @@ test_target() {
n=$((n+1))
sleep 1
done

# FIXME: With `build-std` feature, `compiler_builtins` emits a lof of lint warnings.
RUSTFLAGS="${RUSTFLAGS:-} -Aimproper_ctypes_definitions"
export RUSTFLAGS

cmd="$cmd -Zbuild-std=core,alloc"
fi

# Test with expected combinations of features
Expand Down Expand Up @@ -152,9 +153,9 @@ for target in $targets; do
if echo "$target" | grep -q "$filter"; then
if [ "${OS}" = "windows" ]; then
TARGET="$target" ./ci/install-rust.sh
test_target build "$target"
test_target "$target"
else
test_target build "$target"
test_target "$target"
fi

test_run=1
Expand Down Expand Up @@ -231,7 +232,7 @@ x86_64-wrs-vxworks \
if [ "${rust}" = "nightly" ] && [ "${OS}" = "linux" ]; then
for target in $rust_linux_no_core_targets; do
if echo "$target" | grep -q "$filter"; then
test_target build "$target" 1
test_target "$target" 1
fi

test_run=1
Expand All @@ -247,7 +248,7 @@ i386-apple-ios \
if [ "${rust}" = "nightly" ] && [ "${OS}" = "macos" ]; then
for target in $rust_apple_no_core_targets; do
if echo "$target" | grep -q "$filter"; then
test_target build "$target" 1
test_target "$target" 1
fi

test_run=1
Expand Down

0 comments on commit 7b99124

Please sign in to comment.