Skip to content

Commit

Permalink
Add powershell equivalent for watch files check
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Carter committed Jun 26, 2023
1 parent ec7ac44 commit 7a5f1ac
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions .github/workflows/Build_Examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ jobs:
ref: '${{ github.event.pull_request.head.ref }}'
repository: '${{ github.event.pull_request.head.repo.full_name }}'

- name: Check watch files
id: check_watch
- name: Check watch files (bash/zsh)
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'}}
id: check_watch
run: |
# Determine if we need to run the test
RUN_TEST=0
Expand Down Expand Up @@ -86,6 +87,39 @@ jobs:
echo "RUN_TEST=$RUN_TEST" >> $GITHUB_OUTPUT
- name: Check watch files (powershell)
if: ${{ matrix.os == windows-latest }}
run: |
$RUN_TEST = 0
# Always run test on workflow dispatch
if ( $GITHUB_EVENT_NAME -eq "workflow_dispatch" )
{
$RUN_TEST = 1
}
else
{
$WATCH_FILES = "Build_Examples.yml",".c",".cpp",".S",".s",".h",".a",".mk","makefile","Makefile"
$CHANGE_FILES = [string](git diff --ignore-submodules --name-only remotes/origin/main)
# Check for change files by checking for watched file substrings
# For powershell substring: (https://stackoverflow.com/a/31603685)
if ($($WATCH_FILES | %{$CHANGE_FILES.contains($_)}) -contains $true)
{
echo "Match found."
$RUN_TEST = 1
}
}
# End the test early if there wasn't a significant change
if ( $RUN_TEST -eq 0 )
{
echo "Skipping Build"
}
else {
echo "Running Build"
}
echo "RUN_TEST=$RUN_TEST" >> $env:GITHUB_OUTPUT
- name: Install ARM GCC Toolchain (arm-none-eabi-gcc)
uses: carlosperate/arm-none-eabi-gcc-action@v1
id: arm-none-eabi-gcc-action
Expand Down

0 comments on commit 7a5f1ac

Please sign in to comment.