-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend behavior of
fail-on-error
option to setup failures (#226)
* Technically an enhancement, these changes make the action behave as many customers already expect by ignoring any and all failures when the `fail-on-error` input is set to `false`. * Adds logic to handle any failures in "setup" tasks, including downloading the associated binary, verifying the binary, and finding the binary by its expected name after extraction. * The new logic checks these actions and exits with exit code `1` on failure, except if `fail-on-error` input is set to `true`, in which case it returns exit code `0`. * Adds a matrix workflow that tests the action for each `os` and each key binary command (`report` and `done`). Each of these scenarios implicitly tests our setup tasks since they run first in each scenario. * Extends the behavior of `debug: true` to flip the shell-specific debug flag for each `os` including `set -x` for `linux` and `macos` and `Set-PSDebug -Trace 1` for `windows`
- Loading branch information
1 parent
643bc37
commit 1134c89
Showing
2 changed files
with
117 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Test GitHub Action | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test-action: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
action: [report, done] # Note: We're also testing 'install' since it's implicitly in each of these two actions | ||
fail_on_error: [true, false] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up environment (Linux) | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
shell: bash | ||
run: | | ||
echo "Running on Linux" | ||
- name: Set up environment (MacOS) | ||
if: ${{ matrix.os == 'macos-latest' }} | ||
shell: bash | ||
run: | | ||
echo "Running on macOS" | ||
- name: Set up environment (Windows) | ||
if: ${{ matrix.os == 'windows-latest' }} | ||
shell: pwsh | ||
run: | | ||
echo "Running on Windows" | ||
- name: Run Test Action | ||
uses: ./ | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
fail-on-error: ${{ matrix.fail_on_error }} | ||
debug: true | ||
parallel-finished: ${{ matrix.action == 'done' }} # Only set 'parallel-finished' to true when testing 'done' | ||
env: | ||
CI: true | ||
continue-on-error: ${{ matrix.fail_on_error }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters