Fix job changed-files in ci.yml (#1730)

* Fix job changed-files in ci.yml

When there are multiple crates, it would be in multiple lines, breaking github output

* Fix job changed-files in ci.yml

When no crate is changed, command cut will fail.

* Fix job unit-tests in ci.yml

If noo crate is changed, do not run cargo-nextest.

* Fix ci.yml syntax
This commit is contained in:
Jiahao XU 2024-06-12 19:47:41 +10:00 committed by GitHub
parent 2feac66e14
commit 4d7a91aa4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -64,9 +64,9 @@ jobs:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
set -euxo pipefail
crates_changed="$(echo "$ALL_CHANGED_FILES" | grep crates | cut -d / -f 2)"
crates_changed="$(echo "$ALL_CHANGED_FILES" | grep crates | cut -d / -f 2 || echo)"
has_detect_target_changed="$(echo "$crates_changed" | grep -q detect-targets && echo true || echo false)"
echo "crates_changed=$crates_changed" | tee -a "$GITHUB_OUTPUT"
echo "crates_changed=${crates_changed//$'\n'/ }" | tee -a "$GITHUB_OUTPUT"
echo "has_detect_target_changed=$has_detect_target_changed" | tee -a "$GITHUB_OUTPUT"
unit-tests:
@ -108,6 +108,7 @@ jobs:
echo "CARGO_NEXTEST_ADDITIONAL_ARGS=$ARGS" | tee -a "$GITHUB_ENV"
- run: just unit-tests
if: env.CARGO_NEXTEST_ADDITIONAL_ARGS != ''
env:
GITHUB_TOKEN: ${{ secrets.CI_TEST_GITHUB_TOKEN }}
CI_UNIT_TEST_GITHUB_TOKEN: ${{ secrets.CI_UNIT_TEST_GITHUB_TOKEN }}