Repository navigation
146 lines (124 loc) · 4.44 KB
/
Copy pathnet48-compatibility.yml
File metadata and controls
146 lines (124 loc) · 4.44 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
name: net48 Compatibility
on:
# Remove `pull_request` for post-merge validation only, or remove `push` for PR validation only.
# Test and coverage behavior is identical for every enabled trigger.
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
permissions:
contents: read
id-token: write
concurrency:
group: net48-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
test:
name: ${{ github.event_name == 'pull_request' && 'PR net48 Build & Test' || 'CI net48 Build & Test' }}
runs-on: windows-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 1
lfs: true
- name: Setup .NET SDK
uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.0.x
- name: Restore .NET tools
run: dotnet tool restore
- name: Generate code
run: dotnet run --project CodeGen
- name: Run the complete net48 test suite with coverage
shell: pwsh
run: |
Import-Module ./Build/test-projects.psm1 -Force
$testProjectPaths = @(Get-TestProjectPaths)
New-Item -ItemType Directory -Force -Path Artifacts/Coverage | Out-Null
foreach ($testProject in $testProjectPaths) {
$projectName = [IO.Path]::GetFileNameWithoutExtension($testProject)
# Keep compiler servers outside dotCover's process tree. Roslyn's VBCSCompiler has a
# 10-minute idle timeout, which can otherwise delay coverage-session finalization.
Write-Host "Building $projectName at $([DateTime]::UtcNow.ToString('O'))"
dotnet build $testProject `
--configuration Release `
--framework net48 `
-p:ContinuousIntegrationBuild=true
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
$testArguments = @(
$testProject,
'--configuration', 'Release',
'--framework', 'net48',
'--no-build',
'--no-restore',
'--logger', 'trx',
'--results-directory', 'Artifacts/TestResults'
)
Write-Host "Testing $projectName with coverage at $([DateTime]::UtcNow.ToString('O'))"
dotnet tool run dotCover -- cover-dotnet `
--TargetWorkingDir $PWD.Path `
--Output "Artifacts/Coverage/$projectName.coverage.xml" `
--ReportType DetailedXML `
--Filters '+:module=UnitsNet*;-:module=*Tests' `
--ProcessFilters '-:VBCSCompiler*' `
--LogFile "Artifacts/Coverage/$projectName.dotcover.log" `
--ReturnTargetExitCode `
-- test @testArguments
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: net48-test-results
path: Artifacts/TestResults/*.trx
if-no-files-found: ignore
retention-days: 30
# publish-net48-test-results.yml defines the "Publish net48 Test Results"
# workflow_run workflow that publishes these results with checks: write. Keeping that permission
# out of this workflow lets fork PRs execute contributor code with a read-only token.
- name: Upload workflow event
if: always()
uses: actions/upload-artifact@v7
with:
name: net48-event
path: ${{ github.event_path }}
retention-days: 30
- name: Upload coverage to Codecov
if: ${{ success() && hashFiles('Artifacts/Coverage/*.coverage.xml') != '' }}
uses: codecov/codecov-action@v6
with:
directory: Artifacts/Coverage
fail_ci_if_error: ${{ github.event_name != 'pull_request' }}
flags: net48
name: net48-clr4
plugins: noop
use_oidc: true
- name: Upload coverage reports
if: always()
uses: actions/upload-artifact@v7
with:
name: net48-coverage
path: Artifacts/Coverage/*.coverage.xml
if-no-files-found: ignore
retention-days: 30
- name: Upload dotCover logs
if: ${{ failure() || cancelled() }}
uses: actions/upload-artifact@v7
with:
name: net48-dotcover-logs
path: Artifacts/Coverage/*.dotcover.log
if-no-files-found: ignore
retention-days: 30