-
-
Notifications
You must be signed in to change notification settings - Fork 8
390 lines (321 loc) · 11.9 KB
/
Copy pathbuild.yml
File metadata and controls
390 lines (321 loc) · 11.9 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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
name: build
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup .NET SDK (main)
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Restore
run: dotnet restore GSharp.sln
- name: Restore .NET local tools
# Brings in `dotnet-ilverify`, which Compiler.Tests invokes via
# `IlVerifier.Verify` to mechanically validate every assembly emitted
# by gsc against ECMA-335. The manifest is at .config/dotnet-tools.json.
run: dotnet tool restore
- name: Show Nerdbank.GitVersioning version
# Surface the version nbgv will stamp on assemblies / NuGet packages so
# that, when a build from `main` is green, the printed NuGetPackageVersion
# can be used directly as the `vX.Y.Z` release tag.
run: |
dotnet tool install --global nbgv || dotnet tool update --global nbgv
export PATH="$PATH:$HOME/.dotnet/tools"
nbgv get-version
{
echo "### Nerdbank.GitVersioning"
echo ''
echo '```'
nbgv get-version
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
- name: Build
# Build the solution explicitly with the static project graph so each
# project (notably Compiler, which is referenced by Compiler.Tests) is
# built exactly once. A bare `dotnet build` schedules projects in
# parallel against a shared OutputPath and can race on
# GenerateRuntimeConfigurationFiles writing `gsc.runtimeconfig.json`.
run: dotnet build GSharp.sln --configuration Release --no-restore -graph
- name: Test
env:
# Cs2Gs.Tests launches many nested SDK builds; reusable MSBuild
# workers eventually exhaust the test host's resources (#2407).
MSBUILDDISABLENODEREUSE: 1
run: dotnet test GSharp.sln --configuration Release --no-build --logger "trx" --results-directory TestResults
- name: Upload test results
if: always()
uses: actions/upload-artifact@v5
with:
name: test-results
path: TestResults/**/*.trx
- name: Upload NuGet packages
uses: actions/upload-artifact@v5
with:
name: nuget-packages
# Include .snupkg symbol packages alongside .nupkg so they survive
# to the publish job (dotnet nuget push / gh release upload need
# them co-located in ./nupkgs to pick them up).
path: out/bin/Release/nupkgs/*
e2e:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup .NET SDK (main)
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Setup .NET 8 (for multitarget tests)
uses: actions/setup-dotnet@v5
with:
dotnet-version: '8.0.x'
- name: Restore
run: dotnet restore GSharp.sln
- name: Install netcoredbg
run: |
URL=$(curl -sSL https://api.github.com/repos/Samsung/netcoredbg/releases/latest \
| grep -oP '"browser_download_url":\s*"\K[^"]*linux-amd64\.tar\.gz')
curl -sSL "$URL" -o /tmp/netcoredbg.tar.gz
mkdir -p "$HOME/.tools/netcoredbg"
tar -xzf /tmp/netcoredbg.tar.gz -C "$HOME/.tools/netcoredbg" --strip-components=1
echo "$HOME/.tools/netcoredbg" >> "$GITHUB_PATH"
- name: Run end-to-end tests
run: ./build/run-e2e-tests.sh
cs2gs:
# ADR-0138: the C#→G# migration quality gate. Runs the full in-repo corpus
# (L1–L5 + the conformance grid) through translate → compile → ilverify →
# test-parity and gates on the gap ledger: any fingerprint NOT ledgered in
# tools/cs2gs/triage/gaps.json (NEW) or ledgered as resolved but
# reproducing (REGRESSED) fails the job; known-open gaps do not.
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup .NET SDK (main)
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Restore
run: dotnet restore GSharp.sln
- name: Restore .NET local tools
# dotnet-ilverify for the pipeline's stage 3.
run: dotnet tool restore
- name: Build
run: dotnet build GSharp.sln --configuration Release --no-restore -graph
- name: Migrate corpus (ledger-gated)
run: |
set +e
dotnet out/bin/Release/Cs2Gs.Cli/cs2gs.dll migrate \
--diagnostic-run \
--corpus tools/cs2gs/corpus \
--baseline tools/cs2gs/triage/gaps.json \
--out cs2gs-ci-runs \
--config Release | tee cs2gs-migrate.log
exit_code=${PIPESTATUS[0]}
{
echo "### cs2gs corpus migration"
echo ''
echo '```'
cat cs2gs-migrate.log
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
exit "$exit_code"
- name: Upload migration report
if: always()
uses: actions/upload-artifact@v5
with:
name: cs2gs-report
path: |
cs2gs-ci-runs/**/report.html
cs2gs-ci-runs/**/summary.json
cs2gs-ci-runs/**/run.json
vscode-extension:
name: vscode-extension (${{ matrix.os }})
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: src/vscode-gsharp
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: src/vscode-gsharp/package-lock.json
- name: Install dependencies
run: npm ci
- name: Compile
run: npm run compile
- name: Lint
run: npm run lint
- name: Unit Tests
run: npm run test:unit
vsix:
runs-on: ubuntu-latest
needs: vscode-extension
defaults:
run:
working-directory: src/vscode-gsharp
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: src/vscode-gsharp/package-lock.json
- name: Install dependencies
run: npm ci
- name: Compile
run: npm run compile
- name: Stamp version (Nerdbank.GitVersioning)
# The VS Code Marketplace requires a strict major.minor.patch version, so
# use nbgv's SimpleVersion (0.1.<git-height>) which is always clean across
# branches and tags. The change is workspace-only and never committed.
run: |
dotnet tool install --global nbgv || dotnet tool update --global nbgv
export PATH="$PATH:$HOME/.dotnet/tools"
VERSION=$(nbgv get-version -v SimpleVersion)
echo "Extension version: $VERSION"
npm version "$VERSION" --no-git-tag-version --allow-same-version
- name: Package VSIX
run: npx vsce package --no-dependencies -o vscode-gsharp.vsix
- name: Upload VSIX
uses: actions/upload-artifact@v5
with:
name: vscode-gsharp-vsix
path: src/vscode-gsharp/vscode-gsharp.vsix
visual-studio-extension:
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Verify generated assets
shell: pwsh
run: ./src/vs-gsharp/scripts/Sync-SharedAssets.ps1 -Check
- name: Build Visual Studio VSIX
run: msbuild src\vs-gsharp\VsGsharp.sln /restore /t:Build /p:Configuration=Release /m /v:minimal /nologo
- name: Test Visual Studio extension
run: dotnet test src\vs-gsharp\test\VsGsharp.UnitTests\VsGsharp.UnitTests.csproj --configuration Release --no-build
- name: Upload Visual Studio VSIX
uses: actions/upload-artifact@v5
with:
name: visual-studio-gsharp-vsix
path: src/vs-gsharp/src/VsGsharp/bin/Release/net472/GSharp.VisualStudio.vsix
publish:
runs-on: ubuntu-latest
needs: [e2e, vsix, visual-studio-extension]
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Download NuGet packages
uses: actions/download-artifact@v5
with:
name: nuget-packages
path: ./nupkgs
- name: Download VSIX
uses: actions/download-artifact@v5
with:
name: vscode-gsharp-vsix
path: ./vsix
- name: Download Visual Studio VSIX
uses: actions/download-artifact@v5
with:
name: visual-studio-gsharp-vsix
path: ./vsix
- name: Create GitHub Release with all assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" \
|| gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --generate-notes --title "$GITHUB_REF_NAME"
gh release upload "$GITHUB_REF_NAME" ./nupkgs/*.nupkg ./nupkgs/*.snupkg ./vsix/*.vsix --repo "$GITHUB_REPOSITORY" --clobber
- name: Setup .NET SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Push to NuGet
run: dotnet nuget push "./nupkgs/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '24'
- name: Publish to VS Code Marketplace
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: npx --yes @vscode/vsce publish --packagePath ./vsix/vscode-gsharp.vsix
publish-visual-studio-extension:
runs-on: windows-latest
needs: publish
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v5
- name: Download Visual Studio VSIX
uses: actions/download-artifact@v5
with:
name: visual-studio-gsharp-vsix
path: ./vsix
- name: Publish to Visual Studio Marketplace
shell: pwsh
env:
VS_MARKETPLACE_PAT: ${{ secrets.VSCE_PAT }}
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$installPath = & $vswhere -latest -products * `
-requires Microsoft.VisualStudio.Component.VSSDK `
-property installationPath
if (-not $installPath) {
throw "Visual Studio SDK installation not found."
}
$publisher = Join-Path $installPath `
"VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe"
if (-not (Test-Path $publisher)) {
throw "VsixPublisher.exe not found at $publisher."
}
& $publisher publish `
-payload "$PWD\vsix\GSharp.VisualStudio.vsix" `
-publishManifest "$PWD\src\vs-gsharp\vs-publish.json" `
-personalAccessToken $env:VS_MARKETPLACE_PAT
if ($LASTEXITCODE -ne 0) {
throw "Visual Studio Marketplace publishing failed with exit code $LASTEXITCODE."
}