Skip to content

Commit d7a8de6

Browse files
committed
Add self-test workflow
1 parent 29745f7 commit d7a8de6

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Test action
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
good-fixtures:
10+
runs-on: ubuntu-latest
11+
name: Good fixtures pass
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: ./
15+
id: vet
16+
with:
17+
tools-glob: "fixtures/good/**/*.json"
18+
fail-on: error
19+
- name: Verify outputs
20+
shell: bash
21+
run: |
22+
set -euo pipefail
23+
test "${{ steps.vet.outputs.errors }}" = "0"
24+
test "${{ steps.vet.outputs.warnings }}" = "0"
25+
echo "good fixtures: ${{ steps.vet.outputs.total-tools }} tools, all clean"
26+
- uses: actions/upload-artifact@v4
27+
with:
28+
name: good-report
29+
path: agentvet-report.json
30+
31+
bad-fixtures:
32+
runs-on: ubuntu-latest
33+
name: Bad fixtures fail with fail-on=error
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: ./
37+
id: vet
38+
continue-on-error: true
39+
with:
40+
tools-glob: "fixtures/bad/**/*.json"
41+
fail-on: error
42+
- name: Verify the action failed and counted issues
43+
shell: bash
44+
run: |
45+
set -euo pipefail
46+
if [ "${{ steps.vet.outcome }}" != "failure" ]; then
47+
echo "expected action to fail on bad fixtures"
48+
exit 1
49+
fi
50+
test "${{ steps.vet.outputs.errors }}" -gt "0"
51+
echo "bad fixtures correctly failed with ${{ steps.vet.outputs.errors }} error(s)"
52+
- uses: actions/upload-artifact@v4
53+
with:
54+
name: bad-report
55+
path: agentvet-report.json
56+
57+
bad-fixtures-warn-only:
58+
runs-on: ubuntu-latest
59+
name: Bad fixtures pass with fail-on=none
60+
steps:
61+
- uses: actions/checkout@v4
62+
- uses: ./
63+
id: vet
64+
with:
65+
tools-glob: "fixtures/bad/**/*.json"
66+
fail-on: none
67+
- name: Verify report-only mode does not fail
68+
shell: bash
69+
run: |
70+
set -euo pipefail
71+
test "${{ steps.vet.outputs.errors }}" -gt "0"
72+
echo "report-only mode: ${{ steps.vet.outputs.errors }} error(s) recorded but build did not fail"

0 commit comments

Comments
 (0)