Repository navigation
63 lines (51 loc) · 2.31 KB
/
Copy pathdotnet.yml
File metadata and controls
63 lines (51 loc) · 2.31 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
name: .NET
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # depth is needed for nbgv
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
10.0.x
- uses: dotnet/nbgv@master
with:
setAllVars: true
# deliberately before restore/build, so the version is legible even when a later step
# fails. Cutting a release means tagging with exactly what a *main* run prints - a PR
# run builds refs/pull/N/merge, whose height includes the branch commits and the merge,
# so its number is not the one that will ship
- name: Report computed version
run: |
$version = nbgv get-version --variable NuGetPackageVersion
if ($env:GITHUB_REF -eq 'refs/heads/main') {
"### Computed package version: ``$version``" >> $env:GITHUB_STEP_SUMMARY
"Tag the release with exactly this." >> $env:GITHUB_STEP_SUMMARY
} else {
"### Computed package version: ``$version``" >> $env:GITHUB_STEP_SUMMARY
"_This is a ``$env:GITHUB_REF`` build - **not** the version that would ship. Read the release version off a main run._" >> $env:GITHUB_STEP_SUMMARY
}
Write-Output "Computed package version: $version (ref: $env:GITHUB_REF)"
- name: Restore dependencies
run: dotnet restore Build.csproj
- name: Build
run: dotnet build Build.csproj --no-restore -c Release
- name: Test .NET 8
run: dotnet test Build.csproj --no-build --verbosity normal -c Release -f net8.0 --filter FullyQualifiedName!~Integration
- name: Test .NET 10
run: dotnet test Build.csproj --no-build --verbosity normal -c Release -f net10.0 --filter FullyQualifiedName!~Integration
# the job already builds net48, but the *.output.netfx.* interceptor goldens are only
# compared at test time - so without this, a netfx golden can be wrong and CI stays green
- name: Test .NET Framework 4.8
run: dotnet test Build.csproj --no-build --verbosity normal -c Release -f net48 --filter FullyQualifiedName!~Integration