-
Notifications
You must be signed in to change notification settings - Fork 0
218 lines (189 loc) · 7.32 KB
/
regression.yaml
File metadata and controls
218 lines (189 loc) · 7.32 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
name: Connector Regression
on:
workflow_call:
inputs:
connector:
description: 'Connector name (e.g., okta, github, slack)'
required: true
type: string
connector-ref:
description: 'Git ref of the connector to test'
required: false
type: string
default: ''
connector-repo:
description: 'Repository containing the connector (defaults to caller)'
required: false
type: string
default: ''
max-probes:
description: 'Maximum verification probes'
required: false
type: number
default: 100
skip-nilcheck:
description: 'Skip static nil pointer analysis'
required: false
type: boolean
default: false
verbose:
description: 'Enable verbose output'
required: false
type: boolean
default: false
secrets:
RELENG_GITHUB_TOKEN:
description: 'GitHub token with access to private ConductorOne repos'
required: false
outputs:
status:
description: 'Verification status (pass/fail)'
value: ${{ jobs.verify.outputs.status }}
axiom-coverage:
description: 'Axiom coverage achieved'
value: ${{ jobs.verify.outputs.axiom-coverage }}
branch-coverage:
description: 'Branch coverage achieved'
value: ${{ jobs.verify.outputs.branch-coverage }}
jobs:
verify:
name: Verify ${{ inputs.connector }}
runs-on: ubuntu-latest
outputs:
status: ${{ steps.verify.outputs.status }}
axiom-coverage: ${{ steps.verify.outputs.axiom-coverage }}
branch-coverage: ${{ steps.verify.outputs.branch-coverage }}
steps:
- name: Validate connector input
run: |
CONNECTOR="${{ inputs.connector }}"
if [[ ! "$CONNECTOR" =~ ^baton-[a-zA-Z0-9_-]+$ ]]; then
echo "::error::Invalid connector name: must match baton-<name> with alphanumeric/hyphens/underscores"
exit 1
fi
- name: Checkout baton-regression
uses: actions/checkout@v4
with:
repository: ConductorOne/baton-regression
token: ${{ secrets.RELENG_GITHUB_TOKEN || github.token }}
path: baton-regression
- name: Checkout connector
uses: actions/checkout@v4
with:
repository: ${{ inputs.connector-repo || github.repository }}
ref: ${{ inputs.connector-ref || github.sha }}
path: ${{ inputs.connector }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: baton-regression/go.mod
cache-dependency-path: |
baton-regression/go.sum
${{ inputs.connector }}/go.sum
- name: Build baton-regression
working-directory: baton-regression
run: |
go build -tags "sqlmock,satsolver" \
-o bin/baton-regression \
./cmd/baton-regression
- name: Build connector
working-directory: ${{ inputs.connector }}
run: |
CONNECTOR_NAME="${{ inputs.connector }}"
# Handle both "okta" and "baton-okta" formats
if [[ ! "$CONNECTOR_NAME" =~ ^baton- ]]; then
BINARY_NAME="baton-$CONNECTOR_NAME"
else
BINARY_NAME="$CONNECTOR_NAME"
fi
go build -o ../baton-regression/bin/$BINARY_NAME ./cmd/$BINARY_NAME
- name: Run verification
id: verify
working-directory: baton-regression
run: |
set +e
CONNECTOR_NAME="${{ inputs.connector }}"
# Normalize connector name (remove baton- prefix for config lookup)
if [[ "$CONNECTOR_NAME" =~ ^baton- ]]; then
CONFIG_NAME="${CONNECTOR_NAME#baton-}"
else
CONFIG_NAME="$CONNECTOR_NAME"
fi
BINARY_NAME="baton-$CONFIG_NAME"
ARGS="--binary ./bin/$BINARY_NAME"
ARGS="$ARGS --source ../${{ inputs.connector }}"
ARGS="$ARGS --max-probes ${{ inputs.max-probes }}"
ARGS="$ARGS --target-coverage 95"
if [ "${{ inputs.verbose }}" = "true" ]; then
ARGS="$ARGS -v"
fi
echo "Running: ./bin/baton-regression verify $ARGS $CONFIG_NAME"
./bin/baton-regression verify $ARGS $CONFIG_NAME 2>&1 | tee ./reports/verification.log
EXIT_CODE=${PIPESTATUS[0]}
# Parse results from log
if grep -q "Verification PASSED" ./reports/verification.log; then
STATUS="pass"
else
STATUS="fail"
fi
# Extract coverage from log
AXIOM_COV=$(grep -oP 'Axiom Coverage: \K[\d.]+' ./reports/verification.log | tail -1 || echo "0")
BRANCH_COV=$(grep -oP 'Branch Coverage: \K[\d.]+' ./reports/verification.log | tail -1 || echo "0")
echo "status=$STATUS" >> $GITHUB_OUTPUT
echo "axiom-coverage=$AXIOM_COV" >> $GITHUB_OUTPUT
echo "branch-coverage=$BRANCH_COV" >> $GITHUB_OUTPUT
exit $EXIT_CODE
- name: Run nil pointer analysis
id: nilcheck
if: ${{ !inputs.skip-nilcheck }}
working-directory: baton-regression
run: |
set +e
CONNECTOR_NAME="${{ inputs.connector }}"
if [[ "$CONNECTOR_NAME" =~ ^baton- ]]; then
CONFIG_NAME="${CONNECTOR_NAME#baton-}"
else
CONFIG_NAME="$CONNECTOR_NAME"
fi
./bin/baton-regression batch-nilcheck \
-connector $CONFIG_NAME \
-verbose > ./reports/nilcheck.log 2>&1
# Count warnings
WARNINGS=$(grep -c "\[WARN\]" ./reports/nilcheck.log || echo "0")
echo "Nil check found $WARNINGS connectors with warnings"
# Don't fail on nilcheck warnings - just report them
exit 0
- name: Upload reports
if: always()
uses: actions/upload-artifact@v4
with:
name: verification-report-${{ inputs.connector }}
path: |
baton-regression/reports/verification.log
baton-regression/reports/nilcheck.log
retention-days: 30
- name: Post summary
if: always()
working-directory: baton-regression
run: |
echo "## Verification Results: ${{ inputs.connector }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
STATUS="${{ steps.verify.outputs.status }}"
AXIOM_COV="${{ steps.verify.outputs.axiom-coverage }}"
BRANCH_COV="${{ steps.verify.outputs.branch-coverage }}"
if [ "$STATUS" = "pass" ]; then
echo "**Status:** :white_check_mark: PASS" >> $GITHUB_STEP_SUMMARY
else
echo "**Status:** :x: FAIL" >> $GITHUB_STEP_SUMMARY
fi
echo "**Axiom Coverage:** ${AXIOM_COV}%" >> $GITHUB_STEP_SUMMARY
echo "**Branch Coverage:** ${BRANCH_COV}%" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Add nilcheck summary if available
if [ -f ./reports/nilcheck.log ]; then
WARNINGS=$(grep -c "\[WARN\]" ./reports/nilcheck.log || echo "0")
CLEAN=$(grep -c "\[CLEAN\]" ./reports/nilcheck.log || echo "0")
echo "### Static Analysis (Nil Check)" >> $GITHUB_STEP_SUMMARY
echo "- Clean: $CLEAN" >> $GITHUB_STEP_SUMMARY
echo "- Warnings: $WARNINGS" >> $GITHUB_STEP_SUMMARY
fi