mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 22:30:03 +00:00
Fix ci and improve efficiency (#1744)
* Fix job changed-file in ci.yml * Do not run job e2e-tests on PR which might not have access to GitHub Token in secrets, if opened by non-maintainer * Provide GITHUB_TOKEN fallback if the secrets is not accessible * Fix regex expression passed to sed
This commit is contained in:
parent
250814f530
commit
d524db3784
1 changed files with 7 additions and 6 deletions
13
.github/workflows/ci.yml
vendored
13
.github/workflows/ci.yml
vendored
|
@ -63,7 +63,7 @@ jobs:
|
||||||
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
|
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||||
run: |
|
run: |
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
crates_changed="$(for file in $ALL_CHANGED_FILES; do echo $file; done | grep crates | cut -d / -f 2 || echo)"
|
crates_changed="$(for file in $ALL_CHANGED_FILES; do echo $file; done | grep crates | cut -d / -f 2 | sed 's/bin/cargo-binstall/' || echo)"
|
||||||
has_detect_target_changed="$(echo "$crates_changed" | grep -q detect-targets && echo true || echo false)"
|
has_detect_target_changed="$(echo "$crates_changed" | grep -q detect-targets && echo true || echo false)"
|
||||||
echo "crates_changed=${crates_changed//$'\n'/ }" | 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"
|
echo "has_detect_target_changed=$has_detect_target_changed" | tee -a "$GITHUB_OUTPUT"
|
||||||
|
@ -80,7 +80,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
# just-setup use binstall to install sccache,
|
# just-setup use binstall to install sccache,
|
||||||
# which works better when we provide it with GITHUB_TOKEN.
|
# which works better when we provide it with GITHUB_TOKEN.
|
||||||
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
tools: cargo-nextest
|
tools: cargo-nextest
|
||||||
|
|
||||||
|
@ -98,10 +98,11 @@ jobs:
|
||||||
- run: just unit-tests
|
- run: just unit-tests
|
||||||
if: env.CARGO_NEXTEST_ADDITIONAL_ARGS != ''
|
if: env.CARGO_NEXTEST_ADDITIONAL_ARGS != ''
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.CI_TEST_GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.CI_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
CI_UNIT_TEST_GITHUB_TOKEN: ${{ secrets.CI_UNIT_TEST_GITHUB_TOKEN }}
|
CI_UNIT_TEST_GITHUB_TOKEN: ${{ secrets.CI_UNIT_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
e2e-tests:
|
e2e-tests:
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -165,7 +166,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
# just-setup use binstall to install sccache,
|
# just-setup use binstall to install sccache,
|
||||||
# which works better when we provide it with GITHUB_TOKEN.
|
# which works better when we provide it with GITHUB_TOKEN.
|
||||||
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- run: just avoid-dev-deps
|
- run: just avoid-dev-deps
|
||||||
- run: just check
|
- run: just check
|
||||||
|
@ -189,7 +190,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
# just-setup use binstall to install sccache,
|
# just-setup use binstall to install sccache,
|
||||||
# which works better when we provide it with GITHUB_TOKEN.
|
# which works better when we provide it with GITHUB_TOKEN.
|
||||||
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- run: just toolchain rustfmt,clippy
|
- run: just toolchain rustfmt,clippy
|
||||||
- run: just avoid-dev-deps
|
- run: just avoid-dev-deps
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue