-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (89 loc) · 3.23 KB
/
ci.yml
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
# Copyright (c) Stéphane ANDRE.
# Licensed under the MIT license.
# This continuous integration pipeline is triggered anytime a user pushes code to main branch.
# This pipeline builds the solution and runs unit tests
name: Build
on:
push:
branches:
- main
paths:
- .github/workflows/ci.yml
- .github/GitVersion.yml
- 'src/**'
workflow_dispatch:
jobs:
# GitVersion
gitversion:
timeout-minutes: 5
runs-on: windows-latest
outputs:
full_version: ${{ steps.gitversion.outputs.SemVer }}
suffix_label: ${{ steps.gitversion.outputs.PreReleaseTag }}
steps:
# Checkout
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Install Git version
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v1.1.1
with:
versionSpec: '5.x'
# Check Git version
- name: Check Git Semantic Version
id: gitversion
uses: gittools/actions/gitversion/execute@v1.1.1 # https://github.com/GitTools/actions/blob/main/docs/examples/github/gitversion/execute/usage-examples.md
with:
useConfigFile: true
configFilePath: .\.github\GitVersion.yml
disableNormalization: true
# Build and test
build-and-tests:
runs-on: windows-latest
name: Build all projects
needs: [ gitversion ]
env:
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET 8.0.201
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.201
- name: Add NuGet Feed
shell: pwsh
run: |
$userName = "${{ vars.PRIVATE_NUGET_API_USERNAME }}"
$token = "${{ secrets.PRIVATE_NUGET_API_KEY }}"
if ($userName -eq '' || $token -eq '') {
dotnet nuget add source ${{ vars.PRIVATE_NUGET_API_SOURCE }} -n NuGetFeed
} else {
dotnet nuget add source ${{ vars.PRIVATE_NUGET_API_SOURCE }} -u $userName -p $token -n NuGetFeed
}
- name: NuGet Restore
run: dotnet restore .\src\MyNetWpf.sln
- name: Build Packages
run: dotnet build .\src\MyNetWpf.sln -c Release /p:DebugType=embedded /p:GitVersion=${{ needs.gitversion.outputs.full_version }} /p:VersionSuffix=${{ needs.gitversion.outputs.suffix_label }}
- name: Run Tests
run: dotnet test .\src\MyNetWpf.sln --configuration Release --logger GitHubActions --no-build --no-restore --blame-crash --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover --no-build
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: NuGet
path: ./Artifacts/
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: TestApp
path: |
./build/MyNet.Wpf.TestApp/Release/**
!./build/MyNet.Wpf.TestApp/Release/*.xml
!./build/MyNet.Wpf.TestApp/Release/*.pdb