-
Notifications
You must be signed in to change notification settings - Fork 0
270 lines (251 loc) Β· 9.11 KB
/
ci.yml
File metadata and controls
270 lines (251 loc) Β· 9.11 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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
name: β‘ CI Pipeline
# Comprehensive CI orchestrator that runs lint, type checks, tests, and coverage.
# Orchestrates multiple quality checks in parallel for efficient CI execution.
#
# Dependencies:
# - SocketDev/socket-registry/.github/workflows/lint.yml
# - SocketDev/socket-registry/.github/workflows/types.yml
# - SocketDev/socket-registry/.github/workflows/test.yml
# - SocketDev/socket-registry/.github/actions/setup-and-install
# - actions/checkout@v5.0.0
# - actions/upload-artifact@v4.4.0
on:
workflow_call:
inputs:
coverage-artifact-name:
description: 'Name for coverage artifacts (e.g., "coverage-report")'
required: false
type: string
default: 'coverage-report'
coverage-path:
description: 'Path to coverage output (e.g., "coverage/")'
required: false
type: string
default: 'coverage/'
coverage-report-script:
description: 'Script to generate coverage report (e.g., "pnpm run coverage:percent --json")'
required: false
type: string
default: ''
coverage-script:
description: 'Script to run tests with coverage (e.g., "pnpm run test:unit:coverage")'
required: false
type: string
default: ''
coverage-timeout-minutes:
description: 'Timeout for coverage job in minutes'
required: false
type: number
default: 15
debug:
description: 'Enable debug output (e.g., "1" for verbose logging)'
required: false
type: string
default: '0'
fail-fast:
description: 'Cancel all matrix jobs if one fails'
required: false
type: boolean
default: false
lint-node-version:
description: 'Node.js version for linting'
required: false
type: string
default: '22'
lint-script:
description: 'Lint command (e.g., "pnpm run lint-ci")'
required: false
type: string
default: 'pnpm run lint-ci'
lint-setup-script:
description: 'Setup script before linting'
required: false
type: string
default: ''
lint-timeout-minutes:
description: 'Timeout for lint job in minutes'
required: false
type: number
default: 10
max-parallel:
description: 'Maximum parallel test jobs'
required: false
type: number
default: 4
node-versions:
description: 'Node.js versions for testing (e.g., ''[20, 22, 24]'')'
required: false
type: string
default: '[20, 22, 24]'
os-versions:
description: 'Operating systems for testing (e.g., ''["ubuntu-latest", "windows-latest"]'')'
required: false
type: string
default: '["ubuntu-latest", "windows-latest"]'
retention-days:
description: 'Days to retain artifacts'
required: false
type: number
default: 7
run-coverage:
description: 'Include coverage reporting job'
required: false
type: boolean
default: true
run-lint:
description: 'Include lint check job'
required: false
type: boolean
default: true
run-test:
description: 'Include test matrix job'
required: false
type: boolean
default: true
run-type-check:
description: 'Include type check job'
required: false
type: boolean
default: true
test-script:
description: 'Test command (e.g., "pnpm run test-ci")'
required: false
type: string
default: 'pnpm run test-ci'
test-setup-script:
description: 'Setup script before tests (e.g., "pnpm run build")'
required: false
type: string
default: ''
test-timeout-minutes:
description: 'Timeout for test jobs in minutes'
required: false
type: number
default: 15
type-check-node-version:
description: 'Node.js version for type checking'
required: false
type: string
default: '22'
type-check-script:
description: 'Type check command (e.g., "pnpm run type-ci")'
required: false
type: string
default: 'pnpm run type-ci'
type-check-setup-script:
description: 'Setup script before type checking'
required: false
type: string
default: ''
type-check-timeout-minutes:
description: 'Timeout for type check job in minutes'
required: false
type: number
default: 10
working-directory:
description: 'Working directory (e.g., "packages/core" for monorepos)'
required: false
type: string
default: '.'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
lint:
if: inputs.run-lint
name: π§Ή Lint Check
uses: SocketDev/socket-registry/.github/workflows/lint.yml@a912e5bd8ec469d2ee13abf592a6b2e5898c006c # main
with:
debug: ${{ inputs.debug }}
lint-script: ${{ inputs.lint-script }}
node-version: ${{ inputs.lint-node-version }}
setup-script: ${{ inputs.lint-setup-script }}
timeout-minutes: ${{ inputs.lint-timeout-minutes }}
working-directory: ${{ inputs.working-directory }}
type-check:
if: inputs.run-type-check
name: π Type Check
uses: SocketDev/socket-registry/.github/workflows/types.yml@a912e5bd8ec469d2ee13abf592a6b2e5898c006c # main
with:
debug: ${{ inputs.debug }}
node-version: ${{ inputs.type-check-node-version }}
setup-script: ${{ inputs.type-check-setup-script }}
timeout-minutes: ${{ inputs.type-check-timeout-minutes }}
type-script: ${{ inputs.type-check-script }}
working-directory: ${{ inputs.working-directory }}
test:
if: inputs.run-test
name: π§ͺ Test Matrix
uses: SocketDev/socket-registry/.github/workflows/test.yml@a912e5bd8ec469d2ee13abf592a6b2e5898c006c # main
with:
debug: ${{ inputs.debug }}
fail-fast: ${{ inputs.fail-fast }}
max-parallel: ${{ inputs.max-parallel }}
node-versions: ${{ inputs.node-versions }}
os-versions: ${{ inputs.os-versions }}
setup-script: ${{ inputs.test-setup-script }}
test-script: ${{ inputs.test-script }}
timeout-minutes: ${{ inputs.test-timeout-minutes }}
working-directory: ${{ inputs.working-directory }}
test-coverage:
if: inputs.run-coverage && inputs.coverage-script != ''
name: π Coverage Report
runs-on: ubuntu-latest
timeout-minutes: ${{ inputs.coverage-timeout-minutes }}
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@51be85d39d3b4a42dd9d4712948b9d30a2e04794 # main
with:
debug: ${{ inputs.debug }}
node-version: ${{ inputs.type-check-node-version }}
working-directory: ${{ inputs.working-directory }}
- name: Run setup script
if: inputs.test-setup-script != ''
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.test-setup-script }}
- name: Run tests with coverage
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.coverage-script }}
- name: Generate coverage report
if: inputs.coverage-report-script != ''
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.coverage-report-script }}
- name: Upload coverage artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ inputs.coverage-artifact-name }}
path: ${{ inputs.working-directory }}/${{ inputs.coverage-path }}
retention-days: ${{ inputs.retention-days }}
ci-summary:
name: β
CI Summary
runs-on: ubuntu-latest
needs: [lint, type-check, test, test-coverage]
if: always()
steps:
- name: Check all jobs passed
run: |
# Check each job that was actually run.
failed=0
if [ "${{ inputs.run-lint }}" == "true" ] && [ "${{ needs.lint.result }}" != "success" ] && [ "${{ needs.lint.result }}" != "skipped" ]; then
echo "β Lint check failed"
failed=1
fi
if [ "${{ inputs.run-type-check }}" == "true" ] && [ "${{ needs.type-check.result }}" != "success" ] && [ "${{ needs.type-check.result }}" != "skipped" ]; then
echo "β Type check failed"
failed=1
fi
if [ "${{ inputs.run-test }}" == "true" ] && [ "${{ needs.test.result }}" != "success" ] && [ "${{ needs.test.result }}" != "skipped" ]; then
echo "β Tests failed"
failed=1
fi
if [ "${{ inputs.run-coverage }}" == "true" ] && [ "${{ needs.test-coverage.result }}" != "success" ] && [ "${{ needs.test-coverage.result }}" != "skipped" ]; then
echo "β Coverage failed"
failed=1
fi
if [ $failed -eq 1 ]; then
exit 1
else
echo "β
CI Pipeline Passed"
fi