From a804dffdb57dbea7a5bc1930f15d1a977f55ba3e Mon Sep 17 00:00:00 2001 From: ASuciuX Date: Fri, 8 Dec 2023 02:09:12 +0200 Subject: [PATCH] feat: removed git-diff.sh script, running directly in workflow --- .github/workflows/logging-mutants.yml | 12 +++++++--- .github/workflows/tracking-pr-mutants.yml | 2 ++ mutation-testing/scripts/git-diff.sh | 27 ----------------------- 3 files changed, 11 insertions(+), 30 deletions(-) delete mode 100755 mutation-testing/scripts/git-diff.sh diff --git a/.github/workflows/logging-mutants.yml b/.github/workflows/logging-mutants.yml index ff0100ea31..9cd8f5c432 100644 --- a/.github/workflows/logging-mutants.yml +++ b/.github/workflows/logging-mutants.yml @@ -48,6 +48,12 @@ jobs: - name: Print old commit hash run: cat ./mutation-testing/packages-output/last_commit_hash.txt + - name: Create git.diff file + run: | + last_commit_hash=$(<../packages-output/last_commit_hash.txt) + git diff $last_commit_hash > git.diff + working-directory: ./mutation-testing/scripts + - name: Remove deleted functions from output files run: ./remove-deleted-functions-from-output.sh working-directory: ./mutation-testing/scripts @@ -58,10 +64,10 @@ jobs: - name: Run the mutation testing on the differences run: | - if [ -f ../packages-output/last_commit_hash.txt ]; then - ./git-diff.sh + if [ -f ./packages-output/last_commit_hash.txt ]; then + cargo mutants --no-shuffle -j 2 -vV --in-diff ./scripts/git.diff --output temp/ fi - working-directory: ./mutation-testing/scripts + working-directory: ./mutation-testing - name: Update the content from the stable output run: bash append-match-package.sh diff --git a/.github/workflows/tracking-pr-mutants.yml b/.github/workflows/tracking-pr-mutants.yml index 2e54e8ed5d..0799ef27cd 100644 --- a/.github/workflows/tracking-pr-mutants.yml +++ b/.github/workflows/tracking-pr-mutants.yml @@ -21,6 +21,7 @@ jobs: run: | git branch -av git diff origin/${{ github.base_ref }}.. | tee git.diff + working-directory: ./mutation-testing/scripts - uses: Swatinem/rust-cache@v2 @@ -33,6 +34,7 @@ jobs: - name: Mutants run: | cargo mutants --no-shuffle -j 2 -vV --in-diff git.diff || true + working-directory: ./mutation-testing/scripts - name: Check if we have missed/timeout mutants, and if so, fail the workflow run: | diff --git a/mutation-testing/scripts/git-diff.sh b/mutation-testing/scripts/git-diff.sh deleted file mode 100755 index a54abe69ed..0000000000 --- a/mutation-testing/scripts/git-diff.sh +++ /dev/null @@ -1,27 +0,0 @@ -# script that makes .git for the differences -# it saves the .git on scripts folder - -# add untracked files to git diff -# go to root folder -cd ./../.. - -# # run git status on root -# untracked_files=($(git ls-files --others --exclude-standard)) - -# # for each file untracked -> run git add file path -# echo "${untracked_files[@]}" -# for file in "${untracked_files[@]}"; do -# git add -N "$file" -# done - -# run from mutation-testing folder -cd mutation-testing - - -# get the differences since the last commit -last_commit_hash=$(<./packages-output/last_commit_hash.txt) -git diff $last_commit_hash > ./scripts/git.diff - -# it runs cargo mutants for those specific changed functions and outputs to /temp/mutants.out -# for faster builds: increase number to 4 if at least 16 gb ram and 6 cores CPU -cargo mutants --no-shuffle -j 2 -vV --in-diff ./scripts/git.diff --output temp/