Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuschen committed Oct 3, 2024
1 parent ebca87a commit bd8ed3a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/miri-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install Miri
env:
TARGET_BRANCH_COMMIT: ${{ github.event.pull_request.base.sha }}
run: |
echo "Target branch commit: $TARGET_BRANCH_COMMIT"
rustup toolchain install nightly --component miri
rustup override set nightly
cargo miri setup
- name: Test with Miri
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: ./internal/scripts/ci_run_miri.sh
20 changes: 5 additions & 15 deletions internal/scripts/ci_run_miri.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,14 @@ if [[ "$line" == \#* ]]; then
continue
fi


# set contains all changed files comparing to the $TARGET_BRANCH_COMMIT
changes=$(git --no-pager diff --diff-filter=ACM --name-only $TARGET_BRANCH_COMMIT)
if [[ -z $changes ]]; then
# when it's not a pull request,
# the $TARGET_BRANCH_COMMIT will be empty so changes is empty as well,
# skip running 'cargo miri test' as it doesn't make sense.
exit 0
fi

if echo "$changes" | grep -q "$line"; then
if echo "$ALL_CHANGED_FILES" | grep -q "$line"; then
cd "$line" || { echo "Failed to change directory to $line"; exit 1; }
echo "Run cargo miri test under: $(pwd)"
cargo miri test
if [ $? -ne 0 ]; then
echo "Error: cargo miri test failed."
exit 1
fi
# if [ $? -ne 0 ]; then
# echo "Error: cargo miri test failed."
# exit 1
# fi
cd -
else
echo "skip $line because the PR doesn't touch its files"
Expand Down

0 comments on commit bd8ed3a

Please sign in to comment.