Serialize HW tests

This commit is contained in:
cpq committed 2023-02-13 03:10:09 +00:00
1 parent 5aebed95a4
commit 6f011fce3b
5 files changed
+109 -105

No files matched your search

-30
View File
@@ -1,30 +0,0 @@
#!/bin/bash
#
# This script is used by the Github Actions
# o must be run with one parameter: a glob pattern
# o write "MATCH=1" (changed files match a pattern) or "MATCH=0" to $GITHUB_OUTPUT
#
# Usage in github actions:
# <job_name>:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with: { fetch-depth: 2 } # Important for git diff to work
# - id: check
# run: /bin/bash check.sh '.*'
# - if: steps.check.outputs.MATCH == 1
# run: .....
# List all files changed by the last commit, and compare with the passed
# pattern argument. If at least one file matches the pattern, write
# MATCH=1. If no files match, write MATCH=0.
for FILE in $(git --no-pager diff --name-only HEAD~1 HEAD) ; do
if [[ "$FILE" =~ $1 ]] ; then
echo FILE "$FILE" matches "$1" # Log for debugging
echo MATCH=1 >> $GITHUB_OUTPUT # Set output
exit 0 # And exit early
else
echo FILE "$FILE" DOES NOT match "$1" # Log for debugging
fi
done
echo MATCH=0 >> $GITHUB_OUTPUT
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
#
# Usage: $0 PATTERN
# If files in the last commit match PATTERN, exit 0. Else, exit 1
#
# Usage in github actions:
# <job_name>:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with: { fetch-depth: 2 } # Important for git diff to work
# - run: if ./match_changed_files.sh '.*' ; then echo RUN=1 >> $GITHUB_ENV ; fi
# - if: ${{ env.RUN == 1 }}
# run: echo yohoo!
CHANGED_FILES=`git --no-pager diff --name-only HEAD~1 HEAD | xargs`
echo "Pattern: [$1], files: $CHANGED_FILES"
for FILE in $CHANGED_FILES; do [[ "$FILE" =~ $1 ]] && exit 0; done
exit 1