-
Notifications
You must be signed in to change notification settings - Fork 12
191 lines (156 loc) · 5.7 KB
/
build.yaml
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: "Build"
on:
push:
branches: ["main"]
paths-ignore:
- "**/*.md"
- "**/*.gitignore"
- "**/*.gitattributes"
pull_request:
branches: ["main"]
paths-ignore:
- "**/*.md"
- "**/*.gitignore"
- "**/*.gitattributes"
workflow_dispatch: {}
jobs:
build-linux:
name: "Build: Linux"
runs-on: ubuntu-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
DOTNET_ADD_GLOBAL_TOOLS_TO_PATH: false
DOTNET_MULTILEVEL_LOOKUP: 0
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: true
TERM: xterm
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Trunk Check
uses: trunk-io/trunk-action@v1
- name: "Setup: .NET Core 3.1 SDK"
uses: actions/setup-dotnet@v2
with:
dotnet-version: 3.1.x
- name: "Setup: .NET Core 6.0 SDK"
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: "Setup: GitVersion"
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: "5.x"
- name: "Compute: Version"
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.7
with:
useConfigFile: true
- name: "Display: version outputs"
run: |
echo "Version: ${{ steps.gitversion.outputs.SemVer }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
- name: "Restore: packages"
run: dotnet restore src/NClap.sln
- name: "Build: Linux (release)"
run: |
dotnet-gitversion /updateprojectfiles
dotnet build src/NClap.sln --no-restore -c Release
- name: "Package (release)"
run: dotnet pack src/NClap.sln --no-build --no-restore -c Release
- name: "Install: mono"
run: |
sudo apt install -y gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt install -y mono-devel
- name: "Test: .NET Framework 4.6.1 (via mono)"
run: dotnet test src/Tests/UnitTests/bin/Release/net461/NClap.Tests.dll
- name: "Test: .NET Core 3.1"
run: dotnet test src/NClap.sln --no-build --no-restore -c Release --verbosity normal -f netcoreapp3.1
- name: "Test: .NET 6.0 (with coverage)"
run: dotnet test src/NClap.sln --no-build --no-restore -c Release --verbosity normal -f net6.0 --collect:"XPlat Code Coverage" --results-directory ./coverage
- name: "Test: Generate Code Coverage Report"
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage/**/coverage.cobertura.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: "80 90"
# - name: "Test: Add Coverage PR Comment"
# uses: marocchino/sticky-pull-request-comment@v2
# if: github.event_name == 'pull_request'
# with:
# recreate: true
# path: code-coverage-results.md
- name: "Upload: Binaries"
uses: actions/upload-artifact@v3
with:
name: linux-binaries
path: src/NClap/bin/Release
- name: "Upload: Package files"
uses: actions/upload-artifact@v3
with:
name: linux-packages
path: src/NClap/bin/Release/*.nupkg
build-windows:
name: "Build: Windows"
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Setup: .NET Core 3.1 SDK"
uses: actions/setup-dotnet@v2
with:
dotnet-version: 3.1.x
- name: "Setup: .NET Core 6.0 SDK"
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: "Setup: GitVersion"
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: "5.x"
- name: "Compute: Version"
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.7
with:
useConfigFile: true
- name: "Display: version outputs"
run: |
echo "Version: ${{ steps.gitversion.outputs.SemVer }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
- name: "Restore: packages"
run: dotnet restore src/NClap.sln
- name: "Build: Windows (release)"
run: |
dotnet-gitversion /updateprojectfiles
dotnet build src/NClap.sln --no-restore -c Release
- name: "Package (release)"
run: dotnet pack src/NClap.sln --no-build --no-restore -c Release
- name: "Test: .NET Framework 4.6.1"
run: dotnet test src/Tests/UnitTests/bin/Release/net461/NClap.Tests.dll
- name: "Test: .NET Core 3.1"
run: dotnet test src/NClap.sln --no-build --no-restore -c Release -f netcoreapp3.1
- name: "Test: .NET 6.0"
run: dotnet test src/NClap.sln --no-build --no-restore -c Release -f net6.0
- name: "Upload: Binaries"
uses: actions/upload-artifact@v3
with:
name: windows-binaries
path: src\NClap\bin\Release
- name: "Upload: Package files"
uses: actions/upload-artifact@v3
with:
name: windows-packages
path: src\NClap\bin\Release\*.nupkg