Skip to content

Extend behavior of fail-on-error option to setup failures #55

Extend behavior of fail-on-error option to setup failures

Extend behavior of fail-on-error option to setup failures #55

Workflow file for this run

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: [install, report, done]
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
env:
CI: true
continue-on-error: ${{ matrix.fail_on_error }}
# - name: Simulate Failure Scenarios
# if: ${{ matrix.action == 'install' }}
# shell: ${{ startsWith(matrix.os, 'windows-latest') && 'pwsh' || 'bash' }}
# run: |
# # Fail download step intentionally
# echo "Testing download failure scenario"
# exit 1 # Simulate download failure
# - name: Simulate Report Command Failure
# if: ${{ matrix.action == 'report' }}
# shell: ${{ startsWith(matrix.os, 'windows-latest') && 'pwsh' || 'bash' }}
# run: |
# echo "Testing report command failure"
# ~/bin/coveralls report # Simulated failure
# - name: Simulate Done Command Failure
# if: ${{ matrix.action == 'done' }}
# shell: ${{ startsWith(matrix.os, 'windows-latest') && 'pwsh' || 'bash' }}
# run: |
# echo "Testing done command failure"
# ~/bin/coveralls done # Simulated failure
# - name: Verify Outcome
# shell: ${{ startsWith(matrix.os, 'windows-latest') && 'pwsh' || 'bash' }}
# run: |
# if [[ "${{ matrix.fail_on_error }}" == "true" ]]; then
# # Expect failure exit code
# if [[ $? -eq 0 ]]; then
# echo "Test failed: expected failure but action succeeded."
# exit 1
# else
# echo "Test succeeded: expected failure and action failed as expected."
# fi
# else
# # Expect success exit code
# if [[ $? -ne 0 ]]; then
# echo "Test failed: expected success but action failed."
# exit 1
# else
# echo "Test succeeded: expected success and action succeeded."
# fi
# fi