-
Notifications
You must be signed in to change notification settings - Fork 4
310 lines (257 loc) · 9.96 KB
/
nightly.yml
File metadata and controls
310 lines (257 loc) · 9.96 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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
name: Nightly
on:
workflow_dispatch:
pull_request:
paths:
- .github/workflows/nightly.yml
- src/e2e-tests/**
- '!**/*.md'
schedule:
- cron: '0 4 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
defaults:
run:
shell: bash
jobs:
validate-links:
name: Validate Markdown Links
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Validate Links
uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2.8.0
with:
args: --config .github/lychee.toml './**/*.md'
fail: true
jobSummary: false
build:
if: github.repository == 'Open-CMSIS-Pack/vscode-cmsis-solution'
permissions:
contents: write
packages: read
actions: read
runs-on: [ubuntu-latest]
name: 'Build'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v4.3.1
with:
submodules: true
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
node-version-file: package.json
registry-url: https://npm.pkg.github.com
package-manager-cache: false
- name: Install dependencies
env:
GITHUB_TOKEN: ${{ github.token }}
NODE_OPTIONS: --max-old-space-size=8192
run: npm ci
- name: Run build
run: npm run build
- name: Lint check
run: npm run lint
- name: Update version for nightly build
run: |
# Increment patch version by 1 (e.g. 1.64.1 -> 1.64.2)
BASE_VERSION=$(node -p "require('./package.json').version.split('-')[0]")
IFS='.' read -r MAJOR MINOR PATCH <<< "$BASE_VERSION"
if [ -z "$MAJOR" ] || [ -z "$MINOR" ] || [ -z "$PATCH" ]; then
echo "Invalid semver: $BASE_VERSION"
exit 1
fi
if ! [[ "$MAJOR" =~ ^[0-9]+$ && "$MINOR" =~ ^[0-9]+$ && "$PATCH" =~ ^[0-9]+$ ]]; then
echo "Invalid semver components (non-numeric): $BASE_VERSION (MAJOR=$MAJOR, MINOR=$MINOR, PATCH=$PATCH)"
exit 1
fi
NEXT_PATCH_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
# Get commit count: since last tag if exists, otherwise total commits
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -n "$LAST_TAG" ]; then
COMMIT_COUNT=$(git rev-list --count HEAD ^${LAST_TAG})
else
COMMIT_COUNT=$(git rev-list --count HEAD)
fi
# Get short commit SHA
SHORT_SHA=$(git rev-parse --short HEAD)
# Create nightly version: 1.64.2-12-abc1234
NIGHTLY_VERSION="${NEXT_PATCH_VERSION}-${COMMIT_COUNT}-${SHORT_SHA}"
echo "Setting version to ${NIGHTLY_VERSION}"
# Update package.json
npm version "${NIGHTLY_VERSION}" --no-git-tag-version
- name: Remove badges
run: |
sed -i "/https:\/\/qlty\.sh\/gh/d" README.md
sed -i "/https:\/\/securityscorecards\.dev\/viewer/d" README.md
sed -i "/https:\/\/img.shields.io\//d" README.md
- name: Ensure download-tools.sh is executable
working-directory: .github/workflows
run: chmod +x ./download-tools.sh
- name: Download dependencies (win32-x64)
working-directory: .github/workflows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./download-tools.sh win32-x64
- name: Package win32-x64
run: npm run package -- --target win32-x64
- name: Download dependencies (win32-arm64)
working-directory: .github/workflows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./download-tools.sh win32-arm64
- name: Package win32-arm64
run: npm run package -- --target win32-arm64
- name: Download dependencies (linux-x64)
working-directory: .github/workflows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./download-tools.sh linux-x64
- name: Package linux-x64
run: npm run package -- --target linux-x64
- name: Download dependencies (linux-arm64)
working-directory: .github/workflows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./download-tools.sh linux-arm64
- name: Package linux-arm64
run: npm run package -- --target linux-arm64
- name: Download dependencies (darwin-x64)
working-directory: .github/workflows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./download-tools.sh darwin-x64
- name: Package darwin-x64
run: npm run package -- --target darwin-x64
- name: Download dependencies (darwin-arm64)
working-directory: .github/workflows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./download-tools.sh darwin-arm64
- name: Package darwin-arm64
run: npm run package -- --target darwin-arm64
- name: Upload win32-x64 VSIX package
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: vscode-cmsis-solution-nightly-win32-x64
path: ./*win32-x64*.vsix
retention-days: 1
- name: Upload win32-arm64 VSIX package
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: vscode-cmsis-solution-nightly-win32-arm64
path: ./*win32-arm64*.vsix
retention-days: 1
- name: Upload linux-x64 VSIX package
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: vscode-cmsis-solution-nightly-linux-x64
path: ./*linux-x64*.vsix
retention-days: 1
- name: Upload linux-arm64 VSIX package
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: vscode-cmsis-solution-nightly-linux-arm64
path: ./*linux-arm64*.vsix
retention-days: 1
- name: Upload darwin-x64 VSIX package
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: vscode-cmsis-solution-nightly-darwin-x64
path: ./*darwin-x64*.vsix
retention-days: 1
- name: Upload darwin-arm64 VSIX package
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: vscode-cmsis-solution-nightly-darwin-arm64
path: ./*darwin-arm64*.vsix
retention-days: 1
test:
name: 'Test (windows-latest)'
runs-on: windows-latest
needs: build
permissions:
contents: write
packages: read
actions: read
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@c2d88d3ecc89a9ef08eebf45d9637801dcee7eb5 # v4.3.1
with:
submodules: true
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
node-version-file: package.json
registry-url: https://npm.pkg.github.com
package-manager-cache: false
- name: Install dependencies
env:
GITHUB_TOKEN: ${{ github.token }}
NODE_OPTIONS: --max-old-space-size=8192
run: npm ci
- name: Run build
run: npm run build
- name: Download VSIX package
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: vscode-cmsis-solution-nightly-win32-x64
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
node-version: '24'
package-manager-cache: false
- name: Setup vcpkg environment
uses: ARM-software/cmsis-actions/vcpkg@1ab1da03e6e9787dc903bcf041ba541e59b5739f # v1.2
with:
config: './src/e2e-tests/vcpkg-configuration.json'
- name: Activate Arm tool license
run: armlm activate --server https://mdk-preview.keil.arm.com --product KEMDK-COM0
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run Playwright tests
id: tests
run: npm run e2e
- name: Publish Test Results
if: always() && steps.tests.conclusion != 'skipped'
uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2 # v3.0.0
with:
name: Playwright Tests
path: e2e-report/results.xml
reporter: jest-junit
- name: Upload HTML report
if: always() && steps.tests.conclusion != 'skipped'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: e2e-report
path: e2e-report
- name: Upload Screenshots
if: always() && steps.tests.conclusion != 'skipped'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: e2e-screenshots
path: e2e-screenshots