mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 14:28:42 +00:00
Fix detect-targets
on Linux and add CI testing (#1344)
* Testing: Add `detect-targets/src/main.rs` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix `detect-targets` linux: `guess_host_triple` could return wrong libc info so it has to check it manually instead of simply providing alternatives like other OSes. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix `get_ld_flavor` for Alpine's gcompat glibc Its output is different from regular glibc, so we need to hardcode that particular cases. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix detection of alpine specific musl target Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Add ci testing for Alpine Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Add CI test for detect-targets on ubuntu Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Refactor `get_ld_flavor` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix shellcheck Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Add more CI test for ubuntu and fixed typo in it Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Rm distro specific target as it breaks `cargo-install` fallback Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Make sure all binaries are built in CI Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Add `package.metadata.binstall` for `detect-targets` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix justfile Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix `detect-targets-{alpine, ubuntu}-test` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix `detect-targets-ubuntu-test` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix `debug-targets-ubuntu-test` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * `set -exuo pipefail` in `detect-targets-ubuntu-test` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Simplify `detect-targets-*-test`: Use `Swatinem/rust-cache@v2` directly instead of using `just-setup` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Rm dup steps in `detect-targets-ubuntu-test` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Add `ls` to detect-targets-alpine-test for debugging Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * FIx `detect-targets-alpine-test` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix `get_ld_flavor` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix `linux::detect_targets` on ubuntu & glibc system Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * FIx `linux::detect_targets` glibc checking Check dynlib suffix Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> --------- Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
d657fbe518
commit
76a692224d
7 changed files with 159 additions and 85 deletions
35
.github/workflows/ci.yml
vendored
35
.github/workflows/ci.yml
vendored
|
@ -131,6 +131,39 @@ jobs:
|
|||
CARGO_PROFILE_RELEASE_LTO: no
|
||||
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 4
|
||||
|
||||
detect-targets-alpine-test:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
|
||||
TARGET: x86_64-unknown-linux-musl
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install x86_64-unknown-linux-musl target
|
||||
run: rustup target add $TARGET
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Build detect-targets
|
||||
run: |
|
||||
pip3 install -r zigbuild-requirements.txt
|
||||
cd crates/detect-targets && cargo zigbuild --target $TARGET
|
||||
- name: Run test in alpine
|
||||
run: |
|
||||
docker run --rm \
|
||||
--mount src="$PWD/target/$TARGET/debug/detect-targets",dst=/usr/local/bin/detect-targets,type=bind \
|
||||
--mount src="$PWD/test-detect-targets-musl.sh",dst=/usr/local/bin/test.sh,type=bind \
|
||||
alpine test.sh "$TARGET"
|
||||
|
||||
detect-targets-ubuntu-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Build detect-targets
|
||||
run: cargo build --bin detect-targets
|
||||
- name: Run test in ubuntu
|
||||
run: |
|
||||
set -exuo pipefail
|
||||
[ "$(./target/debug/detect-targets)" = "$(printf '%s\n%s' x86_64-unknown-linux-gnu x86_64-unknown-linux-musl)" ]
|
||||
|
||||
# Dummy job to have a stable name for the "all tests pass" requirement
|
||||
tests-pass:
|
||||
name: Tests pass
|
||||
|
@ -139,6 +172,8 @@ jobs:
|
|||
- cross-check
|
||||
- lint
|
||||
- release-builds
|
||||
- detect-targets-alpine-test
|
||||
- detect-targets-ubuntu-test
|
||||
if: always() # always run even if dependencies fail
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue