tests #726
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
name: tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
schedule: | |
- cron: '30 19 * * *' | |
workflow_dispatch: | |
jobs: | |
tests: | |
strategy: | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install fish shell | |
uses: fish-actions/install-fish@v1 | |
- name: Create syntactically valid fish shell function | |
run: | | |
cat << EOF >./valid-syntax.fish | |
function valid-syntax | |
echo "valid-syntax" | |
end | |
EOF | |
- name: Create syntactically invalid fish shell function | |
run: | | |
cat << EOF >./invalid-syntax.fish | |
end | |
EOF | |
- name: Syntax check valid fish file | |
id: check-valid-file | |
continue-on-error: true | |
uses: ./ | |
with: | |
pattern: valid-syntax.fish | |
- name: Syntax check invalid fish file | |
id: check-invalid-file | |
continue-on-error: true | |
uses: ./ | |
with: | |
pattern: invalid-syntax.fish | |
- name: Check outcomes | |
run: | | |
exit_code=0 | |
if [[ "${{ steps.check-valid-file.outcome }}" != "success" ]]; then | |
echo "Action is expected to succeed for file with valid syntax" | |
exit_code=1 | |
fi | |
if [[ "${{ steps.check-invalid-file.outcome }}" != "failure" ]]; then | |
echo "Action is expected to fail for file with invalid syntax" | |
exit_code=1 | |
fi | |
exit ${exit_code} |