Skip to content

Commit

Permalink
Move grep install to action, alias to ggrep
Browse files Browse the repository at this point in the history
Instead of trying to workaround macOS stuborness, try aliasing ggrep on Linux and Windows instead.
  • Loading branch information
kzu committed Jul 11, 2024
1 parent fe37f7a commit 6a5a7d8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ jobs:
run: dotnet build -m:1 -bl:build.binlog
working-directory: samples/dotnet

- name: ⚙ GNU grep
if: matrix.os == 'macOS-latest'
working-directory: samples/dotnet
run: |
brew install grep
echo 'export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"' >> .bash_profile
- name: 🧪 test
uses: ./.github/workflows/test
with:
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,26 @@ inputs:
runs:
using: "composite"
steps:
- name: ⚙ GNU grep
shell: bash --noprofile --norc {0}
if: runner.os == 'macOS'
working-directory: samples/dotnet
run: brew install grep

- name: ⚙ GNU alias
shell: bash --noprofile --norc {0}
if: runner.os != 'macOS'
working-directory: samples/dotnet
run: echo "alias ggrep='grep'" >> .bash_profile

- name: 🧪 test
shell: bash --noprofile --norc {0}
env:
LC_ALL: en_US.utf8
working-directory: ${{ inputs.working-directory }}
run: |
[ -f .bash_profile ] && source .bash_profile
grep -V
ggrep -V
counter=0
exitcode=0
reset="\e[0m"
Expand All @@ -38,7 +50,7 @@ runs:
exit 0
fi
# cat output, get failed test names, remove trailing whitespace, sort+dedupe, join as FQN~TEST with |, remove trailing |.
filter=$(cat ./output.log | grep -o -P '(?<=\sFailed\s)[\w\._]*' | sed 's/ *$//g' | sort -u | awk 'BEGIN { ORS="|" } { print("FullyQualifiedName~" $0) }' | grep -o -P '.*(?=\|$)')
filter=$(cat ./output.log | ggrep -o -P '(?<=\sFailed\s)[\w\._]*' | sed 's/ *$//g' | sort -u | awk 'BEGIN { ORS="|" } { print("FullyQualifiedName~" $0) }' | ggrep -o -P '.*(?=\|$)')
((counter++))
done
exit $exitcode

0 comments on commit 6a5a7d8

Please sign in to comment.