Skip to content

Commit

Permalink
Fix unit test & integration CI and the release CI (rust-lang#469)
Browse files Browse the repository at this point in the history
* Fix integration test: Make sure `cargo build cargo-binstall` would not fail due to binary already present
* Disable feature `zlib-ng` for release build
* Disable build-std for release build on aarch64-unknown-linux-gnu
* Fix clippy warning in unit test CI
* Fix compile-settings.jq
* Fix caching: Rm `restores-keys`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
  • Loading branch information
NobodyXu authored Oct 8, 2022
1 parent 5d51541 commit 98b6225
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
16 changes: 12 additions & 4 deletions .github/scripts/compile-settings.jq
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
if $matrix.target != "aarch64-unknown-linux-gnu" then {
# Use build-std to build a std library optimized for size and abort immediately on abort,
# so that format string for `unwrap`/`expect`/`unreachable`/`panic` can be optimized out.
#
# Disable it on aarch64-unknown-linux-gnu as it caused the build to fail.
release_build_std_args: "-Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort"
} else {
release_build_std_args: ""
} end
|
if $for_release then {
output: "release",
profile: "release",
# Use build-std to build a std library optimized for size and abort immediately on abort,
# so that format string for `unwrap`/`expect`/`unreachable`/`panic` can be optimized out.
args: ($matrix.release_build_args // "-Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort"),
features: ($matrix.release_features // ["zlib-ng", "static", "rustls", "trust-dns", "fancy-no-backtrace", "log_release_max_level_debug"]),
args: ($matrix.release_build_args // .release_build_std_args),
features: ($matrix.release_features // ["static", "rustls", "trust-dns", "fancy-no-backtrace", "log_release_max_level_debug"]),
} else {
output: "debug",
profile: "dev",
Expand Down
8 changes: 5 additions & 3 deletions .github/scripts/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ if [ "$2" = "Windows" ]; then
"./$1" --log-level debug --no-confirm $crates
else
export CARGO_HOME=/tmp/cargo-home-for-test
export PATH="$CARGO_HOME/bin:$PATH"
export PATH="$CARGO_HOME/bin:/tmp/t/bin:$PATH"

mkdir -p "$CARGO_HOME/bin"
mkdir -p "/tmp/t/bin"
# Copy it to bin to test use of env var `CARGO`
cp "./$1" "$CARGO_HOME/bin/cargo-binstall"
cp "./$1" "/tmp/t/bin/cargo-binstall"

# Install binaries using cargo-binstall
# shellcheck disable=SC2086
cargo binstall --log-level debug --no-confirm $crates

rm -r /tmp/t
fi

# Test that the installed binaries can be run
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ jobs:
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}-${{ env.COUTPUT }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo-${{ matrix.target }}-
${{ runner.os }}-cargo-

- name: Install musl-tools
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
Expand Down
2 changes: 1 addition & 1 deletion crates/bin/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl UIThreadInner {
self.confirm_rx
.recv()
.await
.unwrap_or(Err(BinstallError::UserAbort))
.unwrap_or_else(|| Err(BinstallError::UserAbort))
}
}

Expand Down

0 comments on commit 98b6225

Please sign in to comment.