-
-
Notifications
You must be signed in to change notification settings - Fork 3
122 lines (113 loc) · 3.79 KB
/
Copy pathtest-action.yml
File metadata and controls
122 lines (113 loc) · 3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Regression tests for the composite action at action/.
# Runs pass and fail scenarios to verify shell logic, output capture, and gates.
# All jobs use from-source to test the action against the branch CLI, not PyPI.
name: Test Action
on:
push:
branches: [main, "[0-9]*.[0-9]*.[0-9]*"]
pull_request:
branches: [main]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
# --- Pass scenarios ---
pass-default:
name: "Pass: default agent"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./action
id: check
with:
from-source: "true"
- name: Verify outputs
env:
SCORE: ${{ steps.check.outputs.score }}
LEVEL: ${{ steps.check.outputs.level }}
VIOLATIONS: ${{ steps.check.outputs.violations }}
RESULT: ${{ steps.check.outputs.result }}
run: |
echo "score=$SCORE"
echo "level=$LEVEL"
echo "violations=$VIOLATIONS"
[ -n "$SCORE" ] || { echo "FAIL: no score output"; exit 1; }
[ -n "$LEVEL" ] || { echo "FAIL: no level output"; exit 1; }
[ -n "$RESULT" ] || { echo "FAIL: no result output"; exit 1; }
pass-explicit-agent:
name: "Pass: explicit agent + exclude-dir"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./action
id: check
with:
agent: claude
exclude-dir: "vendor,dist"
from-source: "true"
- name: Verify agent was applied
env:
SCORE: ${{ steps.check.outputs.score }}
run: |
echo "score=$SCORE"
[ "$SCORE" != "0" ] || { echo "FAIL: score is 0"; exit 1; }
pass-min-score:
name: "Pass: min-score gate"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./action
with:
min-score: "1"
from-source: "true"
# --- Fail scenarios ---
fail-min-score:
name: "Fail: min-score gate rejects low score"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./action
id: should-fail
continue-on-error: true
with:
min-score: "11"
from-source: "true"
- name: Verify failure
if: steps.should-fail.outcome != 'failure'
run: |
echo "Expected failure from min-score=11 but got: ${{ steps.should-fail.outcome }}"
exit 1
fail-strict:
name: "Fail: strict mode on violations"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create fixture with violations
run: |
mkdir -p /tmp/bad-project
# Wall of prose with no heading/structure — triggers CORE:S:0003 and CORE:C:0001
cat > /tmp/bad-project/CLAUDE.md << 'FIXTURE'
This is a project with no structure. You should do things correctly. Make sure to follow all the rules. Do not skip steps. Always verify your work. This is important. Remember to test everything. Do not forget to lint. Always use proper formatting. Keep the code clean. Follow best practices at all times.
FIXTURE
- uses: ./action
id: should-fail
continue-on-error: true
with:
path: /tmp/bad-project
agent: claude
strict: "true"
from-source: "true"
- name: Verify failure
env:
OUTCOME: ${{ steps.should-fail.outcome }}
VIOLATIONS: ${{ steps.should-fail.outputs.violations }}
run: |
echo "outcome=$OUTCOME"
echo "violations=$VIOLATIONS"
if [ "$OUTCOME" != "failure" ]; then
echo "Expected failure from strict mode but got: $OUTCOME"
exit 1
fi
if [ "$VIOLATIONS" = "0" ]; then
echo "Expected violations > 0"
exit 1
fi