-
Notifications
You must be signed in to change notification settings - Fork 16
106 lines (89 loc) · 2.94 KB
/
dotnetBuild.yml
File metadata and controls
106 lines (89 loc) · 2.94 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
name: Build and Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
defaults:
run:
shell: pwsh
jobs:
automerge:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: fastify/github-action-merge-dependabot@v3.11.2
with:
use-github-auto-merge: true
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: "./global.json"
dotnet-version: |
8.x
9.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -p:ContinuousIntegrationBuild=True --no-restore --configuration Release
- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal --logger trx --results-directory ./TestResults
- name: Create Failed Tests Playlist
if: failure()
uses: BenjaminMichaelis/trx-to-vsplaylist@v3
with:
trx-file-path: './TestResults/*.trx'
test-outcomes: 'Failed'
artifact-name: 'failed-tests-playlist'
- name: Pack Analyzer
run: dotnet pack IntelliTect.Analyzer/IntelliTect.Analyzer/IntelliTect.Analyzer.csproj --configuration Release --no-build --output ./nupkg
- name: Upload NuGet Package
uses: actions/upload-artifact@v7
with:
name: analyzer-nupkg
path: ./nupkg/*.nupkg
analyzer-compat:
name: Analyzer SDK Compat (${{ matrix.sdk }})
runs-on: ubuntu-latest
needs: build-and-test
strategy:
matrix:
sdk: ['8.0.x', '9.0.x']
steps:
- name: Setup .NET ${{ matrix.sdk }}
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ matrix.sdk }}
- name: Download NuGet Package
uses: actions/download-artifact@v8
with:
name: analyzer-nupkg
path: ./nupkg
- name: Verify analyzer loads without CS9057
run: |
mkdir test-project && cd test-project
dotnet new console
# Add local package source and install the just-built analyzer
dotnet nuget add source (Resolve-Path ../nupkg) --name local
$pkg = Get-ChildItem ../nupkg/*.nupkg | Select-Object -First 1
$version = [regex]::Match($pkg.Name, '(\d+\.\d+\.\d+.*)\.nupkg$').Groups[1].Value
dotnet add package IntelliTect.Analyzers --version $version --source local
# Build and check for CS9057 (analyzer references newer compiler than SDK provides)
$output = dotnet build 2>&1
$output | Write-Output
if ($LASTEXITCODE -ne 0) {
Write-Error "Build failed (exit code $LASTEXITCODE)"
exit $LASTEXITCODE
}
if ($output -match 'CS9057') {
Write-Error "CS9057 detected: Analyzer references a Roslyn version newer than this SDK supports"
exit 1
}