Skip to content

tests

tests #1325

Workflow file for this run

name: tests
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
schedule:
- cron: '30 19 * * *'
workflow_dispatch:
permissions: read-all
jobs:
tests:
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Install fish shell
uses: fish-shop/install-fish-shell@3747447de14883c8cf12dda17f3ed7662511d48b # v1.0.23
- name: Create passing tests
run: |
for count in (seq 1 3)
echo '@test "passing test" (true) $status -eq 0' >> passing.fish
end
shell: fish {0}
- name: Test passing tests
id: passing-tests
continue-on-error: true
uses: ./
with:
patterns: 'passing.fish'
title: 'Passing tests summary'
- name: Check passing tests outcome
run: |
if test "${{ steps.passing-tests.outcome }}" != "success"
echo "Action is expected to succeed for file with passing tests"
exit 1
end
shell: fish {0}
- name: Check passing tests output parameters
env:
TOTAL: ${{ steps.passing-tests.outputs.total }}
PASSED: ${{ steps.passing-tests.outputs.passed }}
FAILED: ${{ steps.passing-tests.outputs.failed }}
run: |
set failures 0
set expected_total 3
if test "$TOTAL" != "$expected_total"
echo "Output parameter 'total' should equal $expected_total (got '$TOTAL')"
set failures (math $failures + 1)
else
echo "Output parameter 'total' equals expected value $expected_total"
end
set expected_passes 3
if test "$PASSED" != "$expected_passes"
echo "Output parameter 'passed' should equal $expected_passes (got '$PASSED')"
set failures (math $failures + 1)
else
echo "Output parameter 'passed' equals expected value $expected_passes"
end
set expected_failures 0
if test "$FAILED" != "$expected_failures"
echo "Output parameter 'failed' should equal $expected_failures (got '$FAILED')"
set failures (math $failures + 1)
else
echo "Output parameter 'failed' equals expected value $expected_failures"
end
exit $failures
shell: fish {0}
- name: Create failing tests
run: |
for count in (seq 1 3)
echo '@test "failing test" (false) $status -eq 0' >> failing.fish
end
shell: fish {0}
- name: Test failing tests
id: failing-tests
continue-on-error: true
uses: ./
with:
patterns: 'failing.fish'
title: 'Failing tests summary'
- name: Check failing tests outcome
run: |
if test "${{ steps.failing-tests.outcome }}" != "failure"
echo "Action is expected to fail for file with failing tests"
exit 1
end
shell: fish {0}
- name: Check failing tests output parameters
env:
TOTAL: ${{ steps.failing-tests.outputs.total }}
PASSED: ${{ steps.failing-tests.outputs.passed }}
FAILED: ${{ steps.failing-tests.outputs.failed }}
run: |
set failures 0
set expected_total 3
if test "$TOTAL" != "$expected_total"
echo "Output parameter 'total' should equal $expected_total (got '$TOTAL')"
set failures (math $failures + 1)
else
echo "Output parameter 'total' equals expected value $expected_total"
end
set expected_passes 0
if test "$PASSED" != "$expected_passes"
echo "Output parameter 'passed' should equal $expected_passes (got '$PASSED')"
set failures (math $failures + 1)
else
echo "Output parameter 'passed' equals expected value $expected_passes"
end
set expected_failures 3
if test "$FAILED" != "$expected_failures"
echo "Output parameter 'failed' should equal $expected_failures (got '$FAILED')"
set failures (math $failures + 1)
else
echo "Output parameter 'failed' equals expected value $expected_failures"
end
exit $failures
shell: fish {0}
- name: Test mixed passing/failing tests
id: mixed-tests
continue-on-error: true
uses: ./
with:
patterns: 'passing.fish failing.fish'
title: 'Mixed tests summary'
- name: Check mixed passing/failing tests outcome
run: |
if test "${{ steps.mixed-tests.outcome }}" != "failure"
echo "Action is expected to fail for file with failing tests"
exit 1
end
shell: fish {0}
- name: Check mixed passing/failing tests output parameters
env:
TOTAL: ${{ steps.mixed-tests.outputs.total }}
PASSED: ${{ steps.mixed-tests.outputs.passed }}
FAILED: ${{ steps.mixed-tests.outputs.failed }}
run: |
set failures 0
set expected_total 6
if test "$TOTAL" != "$expected_total"
echo "Output parameter 'total' should equal $expected_total (got '$TOTAL')"
set failures (math $failures + 1)
else
echo "Output parameter 'total' equals expected value $expected_total"
end
set expected_passes 3
if test "$PASSED" != "$expected_passes"
echo "Output parameter 'passed' should equal $expected_passes (got '$PASSED')"
set failures (math $failures + 1)
else
echo "Output parameter 'passed' equals expected value $expected_passes"
end
set expected_failures 3
if test "$FAILED" != "$expected_failures"
echo "Output parameter 'failed' should equal $expected_failures (got '$FAILED')"
set failures (math $failures + 1)
else
echo "Output parameter 'failed' equals expected value $expected_failures"
end
exit $failures
shell: fish {0}