mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-16 15:46:36 +00:00
Only run detect-targets
test if changed
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
2d126668bd
commit
0f7928f65f
1 changed files with 55 additions and 4 deletions
59
.github/workflows/ci.yml
vendored
59
.github/workflows/ci.yml
vendored
|
@ -34,6 +34,41 @@ env:
|
|||
CARGO_PROFILE_CHECK_ONLY_CODEGEN_UNITS: 4
|
||||
|
||||
jobs:
|
||||
changed-files:
|
||||
runs-on: ubuntu-latest
|
||||
name: Test changed-files
|
||||
permissions:
|
||||
pull-requests: read
|
||||
|
||||
outputs:
|
||||
crates_changed: ${{ steps.list-changed-files.outputs.crates_changed }}
|
||||
has_detect_target_changed: ${{ steps.list-changed-files.outputs.has_detect_target_changed }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v44
|
||||
with:
|
||||
dir_names: true
|
||||
dir_names_exclude_current_dir: true
|
||||
dir_names_max_depth: 2
|
||||
|
||||
- name: List all changed files
|
||||
id: list-changed-files
|
||||
env:
|
||||
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
echo $ALL_CHANGED_FILES
|
||||
crates_changed="$(echo $ALL_CHANGED_FILES | grep crates | cut -d / -f 2)"
|
||||
has_detect_target_changed="$(echo $crates_changed | grep -q detect-targets && echo true)"
|
||||
echo "crates_changed=$crates_changed" | tee -a "$GITHUB_OUTPUT"
|
||||
echo "has_detect_target_changed=$has_detect_target_changed" | tee -a "$GITHUB_OUTPUT"
|
||||
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
@ -161,6 +196,8 @@ jobs:
|
|||
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 4
|
||||
|
||||
detect-targets-build:
|
||||
needs: changed-files
|
||||
if: needs.changed-files.outputs.has_detect_target_changed == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
|
||||
|
@ -186,7 +223,10 @@ jobs:
|
|||
|
||||
detect-targets-alpine-test:
|
||||
runs-on: ubuntu-latest
|
||||
needs: detect-targets-build
|
||||
needs:
|
||||
- detect-targets-build
|
||||
- changed-files
|
||||
if: needs.changed-files.outputs.has_detect_target_changed == 'true'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
@ -203,7 +243,10 @@ jobs:
|
|||
alpine /bin/ash -c "apk update && apk add bash && test.sh x86_64-unknown-linux-musl"
|
||||
|
||||
detect-targets-ubuntu-test:
|
||||
needs: detect-targets-build
|
||||
needs:
|
||||
- detect-targets-build
|
||||
- changed-files
|
||||
if: needs.changed-files.outputs.has_detect_target_changed == 'true'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
@ -223,7 +266,10 @@ jobs:
|
|||
[ "$(./detect-targets)" = "$(printf 'x86_64-unknown-linux-gnu\nx86_64-unknown-linux-musl')" ]
|
||||
|
||||
detect-targets-more-glibc-test:
|
||||
needs: detect-targets-build
|
||||
needs:
|
||||
- detect-targets-build
|
||||
- changed-files
|
||||
if: needs.changed-files.outputs.has_detect_target_changed == 'true'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
@ -248,7 +294,10 @@ jobs:
|
|||
${{ matrix.container }} detect-targets )" = "$(printf 'x86_64-unknown-linux-gnu\nx86_64-unknown-linux-musl')" ]
|
||||
|
||||
detect-targets-nix-test:
|
||||
needs: detect-targets-build
|
||||
needs:
|
||||
- detect-targets-build
|
||||
- changed-files
|
||||
if: needs.changed-files.outputs.has_detect_target_changed == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
|
@ -264,6 +313,8 @@ jobs:
|
|||
nixos/nix /detect-targets )" = x86_64-unknown-linux-musl ]
|
||||
|
||||
detect-targets-android-check:
|
||||
needs: changed-files
|
||||
if: needs.changed-files.outputs.has_detect_target_changed == 'true'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue