-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (47 loc) · 1.71 KB
/
Copy pathci.yml
File metadata and controls
55 lines (47 loc) · 1.71 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
name: CI
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
workflow_dispatch:
jobs:
build-and-test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
# Installs the exact SDK requested by global.json (10.0.303, rollForward latestFeature)
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
- name: Compute version
id: ver
shell: pwsh
run: |
if ($env:GITHUB_REF -match '^refs/tags/v(\d+\.\d+\.\d+)$') {
$version = $Matches[1]
} else {
$version = "0.${{ github.run_number }}.0"
}
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Restore
run: dotnet restore TaskManager.slnx
# CI=true makes ContinuousIntegrationBuild deterministic (set in Directory.Build.props);
# TreatWarningsAsErrors turns any warning into a failed run.
- name: Build
run: >
dotnet build TaskManager.slnx -c Release --no-restore --nologo
-p:Version=${{ steps.ver.outputs.version }}
-p:SourceRevisionId=${{ github.sha }}
# MTP-native coverage: no --nologo (rejected by the test platform), explicit output file
- name: Unit tests with coverage
run: >
dotnet test tests/TaskManager.UnitTests -c Release --no-build
--coverage --coverage-output-format cobertura
--coverage-output ${{ github.workspace }}/artifacts/coverage/coverage.cobertura.xml
- name: Upload coverage artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage
path: artifacts/coverage/*.cobertura.xml
if-no-files-found: error