-
Notifications
You must be signed in to change notification settings - Fork 9
255 lines (248 loc) · 9.08 KB
/
Copy pathnodejs.yml
File metadata and controls
255 lines (248 loc) · 9.08 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
name: Node CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
# Security audit - quick check for critical vulnerabilities
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Security audit (runtime deps only)
# The published package only ships @aws-sdk/client-s3 as a
# runtime dep — dev-tree vulns (artillery's transitive uuid,
# vitest's vite, etc.) don't reach consumers. Gate on runtime
# exposure only; track dev-tree vulns separately via Dependabot.
run: npm audit --audit-level critical --omit=dev
# Core tests - build, lint, type-check, unit tests
test:
name: "Core Tests"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22, 24, 26]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Type check
run: npm run type-check
- name: Build
run: npm run build
- name: Unit tests
run: npm run test:unit
- name: Coverage
run: npm run test:coverage
if: matrix.node-version == 24
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v7
if: matrix.node-version == 24
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
# Examples smoke test - boots each example on a free port and asserts
# health/200/404 paths. Catches example regressions (route syntax,
# error handler shape) that unit tests can't see.
smoke-tests:
name: "Examples Smoke"
runs-on: ubuntu-latest
needs: [test]
# Dependabot PRs don't receive repo secrets, so configure-aws-credentials
# fails with "aws-region not supplied". Skip AWS-integration jobs for them;
# they still run on push to master and on non-Dependabot PRs.
if: github.actor != 'dependabot[bot]'
steps:
- uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Use Node.js 24
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run smoke tests
run: npm run test:smoke
# Validation tests - comprehensive functionality testing
validation-tests:
name: "Validation Tests"
runs-on: ubuntu-latest
needs: [test]
# See "Examples Smoke": skip on Dependabot PRs (no AWS secrets).
if: github.actor != 'dependabot[bot]'
steps:
- uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Use Node.js 24
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run validation tests
run: make validation-local
- name: Upload validation test results
uses: actions/upload-artifact@v7
if: always()
with:
name: validation-test-results
path: |
test-results-*.json
load-test-results-*.json
*.log
if-no-files-found: ignore
# Performance tests - load testing with Artillery
performance-tests:
name: "Performance Tests"
runs-on: ubuntu-latest
needs: [test]
# See "Examples Smoke": skip on Dependabot PRs (no AWS secrets).
if: github.actor != 'dependabot[bot]'
steps:
- uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Use Node.js 24
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run conformance gate
run: make conformance-local
- name: Run load tests
run: make artillery-local
- name: Upload performance test results
uses: actions/upload-artifact@v7
if: always()
with:
name: performance-test-results
path: |
load-test-results-*.json
*.log
if-no-files-found: ignore
# Create version tag and draft release on merge to master
create-tag-and-draft-release:
name: "Create Tag and Draft Release"
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
needs: [test, smoke-tests, validation-tests, performance-tests]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get package version
id: package-version
run: echo "version=v$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Check if tag exists
id: check-tag
run: |
if git rev-parse "${{ steps.package-version.outputs.version }}" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Create and push tag
if: steps.check-tag.outputs.exists == 'false'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "${{ steps.package-version.outputs.version }}" -m "Release ${{ steps.package-version.outputs.version }}"
git push origin "${{ steps.package-version.outputs.version }}"
- name: Get merge commit message
id: commit-message
run: |
# Get the commit message and escape it for JSON
COMMIT_MSG=$(git log -1 --pretty=format:"%B" | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/\\n/g')
echo "message=$COMMIT_MSG" >> $GITHUB_OUTPUT
- name: Create draft release
if: steps.check-tag.outputs.exists == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# The tag was created and pushed in the previous step, so the
# release attaches to it directly. Do not pass --target: that sets
# target_commitish, which must be a branch or commit SHA (a tag name
# is rejected with "target_commitish is invalid").
gh release create "${{ steps.package-version.outputs.version }}" \
--title "Release ${{ steps.package-version.outputs.version }}" \
--notes "${{ steps.commit-message.outputs.message }}" \
--draft
# Package verification - ensure package contents are correct
package-verification:
name: "Package Verification"
runs-on: ubuntu-latest
needs: [test]
# Run across the full matrix: packaging is version-sensitive (ESM
# resolution and install/import behavior differ between Node versions),
# and this job needs no AWS credentials, so the extra coverage is cheap.
strategy:
matrix:
node-version: [22, 24, 26]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Create package (verification only)
run: npm pack
- name: Verify package contents
run: |
echo "📦 Package contents:"
tar -tzf s3proxy-*.tgz | sort
echo ""
echo "📊 Package size:"
ls -lh s3proxy-*.tgz
echo ""
echo "🔍 Verifying required files are present:"
tar -tzf s3proxy-*.tgz | grep -E "(package\.json|README\.md|LICENSE|dist/)" || exit 1
- name: Test package installation
run: |
mkdir test-install
cd test-install
npm init -y
npm install ../s3proxy-*.tgz
node -e "import('s3proxy').then(pkg => { console.log('✅ Package installs correctly:', Object.keys(pkg)); }).catch(err => { console.error('❌ Package import failed:', err); process.exit(1); })"
- name: Cleanup verification artifacts
run: rm -f s3proxy-*.tgz