Skip to content

Commit

Permalink
Merge pull request #44 from dualBreath/task/40/reduce_time_for_permis…
Browse files Browse the repository at this point in the history
…sions_tests

Task/40 'Permission tests' job runs even if there aren't tests require permission in the repo
  • Loading branch information
denis-tingaikin authored Aug 11, 2023
2 parents 9124f8e + 9b61177 commit ad88a29
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ jobs:
- name: Test with permissions
if: ${{ !contains(matrix.os, 'windows') }}
run: |
count=$(go test ./... --list Perm -tags perm | grep Perm | wc -l)
echo $count
if [ $count -gt 0 ]; then
count=0
while read -r line ; do
[ -n "$(grep -l "Perm" $line)" ] && count=1 && break
done < <(grep -R "build perm" --include="*_test.go" -l .)
if [ $count == 1 ]; then
echo "Found tests with permissions"
sudo -E PATH="$PATH" bash -c "go test -race -run Perm ./... -tags=perm"
fi

0 comments on commit ad88a29

Please sign in to comment.