-
Notifications
You must be signed in to change notification settings - Fork 4
301 lines (261 loc) · 12.5 KB
/
dotnetcore.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
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
name: snapx
on:
push:
branches:
- develop
- master
pull_request:
branches:
- develop
# NOTE: Remember to update docker images if you update .NET sdks
env:
GITVERSION_VERSION: 5.10.3
MSVS_TOOLSET_VERSION: 16
SNAPX_DOTNET_FRAMEWORK_VERSION: net6.0
DOTNET_NET60_VERSION: 6.0.402
DOTNET_NET70_VERSION: 7.0.100-rc.2.22477.23
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: 1
SNAPX_CI_BUILD: 1
SNAPX_CORERUN_ALLOW_ELEVATED_CONTEXT: 1
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
SNAPX_VERSION: ${{ steps.set-version.outputs.SNAPX_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Add dotnet tools to environment path
shell: pwsh
run: echo "${HOME}/.dotnet/tools" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- id: set-version
name: Setup GitVersion and set build version
shell: pwsh
run: |
dotnet tool update GitVersion.Tool --global --version ${{ env.GITVERSION_VERSION }}
$SNAPX_VERSION = (dotnet gitversion /showVariable NugetVersionv2) | out-string
echo "::set-output name=SNAPX_VERSION::$SNAPX_VERSION"
linux:
runs-on: ${{ matrix.os }}
name: Bootstrap ${{ matrix.rid }}-${{ matrix.configuration }}
needs: [setup]
strategy:
matrix:
configuration: [Debug, Release]
rid: [linux-x64, linux-arm64]
os: [ubuntu-latest]
env:
SNAPX_VERSION: ${{ needs.setup.outputs.SNAPX_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: true
submodules: true
- uses: azure/docker-login@v1
name: Docker login github packages
with:
login-server: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.SNAPX_DOCKER_READ_PAT }}
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: |
${{ env.DOTNET_NET60_VERSION }}
${{ env.DOTNET_NET70_VERSION }}
- name: Build native
shell: pwsh
run: ./build.ps1 Bootstrap-Unix -Version ${{ env.SNAPX_VERSION }} -Configuration ${{ matrix.configuration }} -CIBuild -NetCoreAppVersion ${{ env.SNAPX_DOTNET_FRAMEWORK_VERSION }} -Rid ${{ matrix.rid }}
- name: Test native
if: matrix.rid != 'linux-arm64'
shell: pwsh
run: ./build.ps1 Run-Native-UnitTests -Version ${{ env.SNAPX_VERSION }} -Configuration ${{ matrix.configuration }} -CIBuild -NetCoreAppVersion ${{ env.SNAPX_DOTNET_FRAMEWORK_VERSION }} -Rid ${{ matrix.rid }}
- name: Test .NET
if: matrix.rid != 'linux-arm64'
shell: pwsh
run: ./build.ps1 Run-Dotnet-UnitTests -Version ${{ env.SNAPX_VERSION }} -Configuration ${{ matrix.configuration }} -CIBuild -NetCoreAppVersion ${{ env.SNAPX_DOTNET_FRAMEWORK_VERSION }} -Rid ${{ matrix.rid }}
- name: Collect artifacts
env:
SNAPX_UNIX_SETUP_ZIP_REL_DIR: build/dotnet/${{ matrix.rid }}/Snap.Installer/${{ env.SNAPX_DOTNET_FRAMEWORK_VERSION }}/${{ matrix.configuration }}/publish
SNAPX_UNIX_CORERUN_REL_DIR: build/native/Unix/${{ matrix.rid }}/${{ matrix.configuration }}/Snap.CoreRun
SNAPX_UNIX_CORERUN_TESTS_REL_DIR: build/native/Unix/${{ matrix.rid }}/${{ matrix.configuration }}/Snap.CoreRun.Tests
SNAPX_UNIX_PAL_REL_DIR: build/native/Unix/${{ matrix.rid }}/${{ matrix.configuration }}/Snap.CoreRun.Pal
run: |
mkdir -p ${{ github.workspace }}/artifacts/${{ env.SNAPX_UNIX_SETUP_ZIP_REL_DIR }}
cp ${{ github.workspace }}/${{ env.SNAPX_UNIX_SETUP_ZIP_REL_DIR }}/Setup-${{ matrix.rid }}.zip ${{ github.workspace }}/artifacts/${{ env.SNAPX_UNIX_SETUP_ZIP_REL_DIR }}/Setup-${{ matrix.rid }}.zip
mkdir -p ${{ github.workspace }}/artifacts/${{ env.SNAPX_UNIX_CORERUN_REL_DIR }}
cp ${{ github.workspace }}/${{ env.SNAPX_UNIX_CORERUN_REL_DIR }}/corerun ${{ github.workspace }}/artifacts/${{ env.SNAPX_UNIX_CORERUN_REL_DIR }}/corerun
mkdir -p ${{ github.workspace }}/artifacts/${{ env.SNAPX_UNIX_CORERUN_TESTS_REL_DIR }}
cp ${{ github.workspace }}/${{ env.SNAPX_UNIX_CORERUN_TESTS_REL_DIR }}/corerun ${{ github.workspace }}/artifacts/${{ env.SNAPX_UNIX_CORERUN_TESTS_REL_DIR }}/corerun
cp ${{ github.workspace }}/${{ env.SNAPX_UNIX_CORERUN_TESTS_REL_DIR }}/corerun_demoapp ${{ github.workspace }}/artifacts/${{ env.SNAPX_UNIX_CORERUN_TESTS_REL_DIR }}/corerun_demoapp
cp ${{ github.workspace }}/${{ env.SNAPX_UNIX_CORERUN_TESTS_REL_DIR }}/corerun_tests ${{ github.workspace }}/artifacts/${{ env.SNAPX_UNIX_CORERUN_TESTS_REL_DIR }}/corerun_tests
cp ${{ github.workspace }}/${{ env.SNAPX_UNIX_CORERUN_TESTS_REL_DIR }}/test.ico ${{ github.workspace }}/artifacts/${{ env.SNAPX_UNIX_CORERUN_TESTS_REL_DIR }}/test.ico
mkdir -p ${{ github.workspace }}/artifacts/${{ env.SNAPX_UNIX_PAL_REL_DIR }}
cp ${{ github.workspace }}/${{ env.SNAPX_UNIX_PAL_REL_DIR }}/libpal.so ${{ github.workspace }}/artifacts/${{ env.SNAPX_UNIX_PAL_REL_DIR }}/libpal.so
- name: Upload artifacts
if: success()
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-${{ matrix.rid }}-${{ matrix.configuration }}
path: ${{ github.workspace }}/artifacts/**/*
windows:
runs-on: ${{ matrix.os }}
name: Bootstrap ${{ matrix.rid }}-${{ matrix.configuration }}
needs: [setup]
strategy:
matrix:
configuration: [Debug, Release]
rid: [win-x86, win-x64]
os: [windows-latest]
env:
SNAPX_VERSION: ${{ needs.setup.outputs.SNAPX_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: true
submodules: true
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: |
${{ env.DOTNET_NET60_VERSION }}
${{ env.DOTNET_NET70_VERSION }}
- name: Build native
run: ./build.ps1 Bootstrap-Windows -Version ${{ env.SNAPX_VERSION }} -Configuration ${{ matrix.configuration }} -CIBuild -NetCoreAppVersion ${{ env.SNAPX_DOTNET_FRAMEWORK_VERSION }} -Rid ${{ matrix.rid }}
- name: Test native
shell: pwsh
run: ./build.ps1 Run-Native-UnitTests -Version ${{ env.SNAPX_VERSION }} -Configuration ${{ matrix.configuration }} -CIBuild -NetCoreAppVersion ${{ env.SNAPX_DOTNET_FRAMEWORK_VERSION }} -Rid ${{ matrix.rid }}
- name: Test .NET
shell: pwsh
run: ./build.ps1 Run-Dotnet-UnitTests -Version ${{ env.SNAPX_VERSION }} -Configuration ${{ matrix.configuration }} -CIBuild -NetCoreAppVersion ${{ env.SNAPX_DOTNET_FRAMEWORK_VERSION }} -Rid ${{ matrix.rid }}
- name: Collect artifacts
env:
SNAPX_WINDOWS_SETUP_ZIP_REL_DIR: build/dotnet/${{ matrix.rid }}/Snap.Installer/${{ env.SNAPX_DOTNET_FRAMEWORK_VERSION }}/${{ matrix.configuration }}/publish
SNAPX_WINDOWS_CORERUN_REL_DIR: build/native/Windows/${{ matrix.rid }}/${{ matrix.configuration }}/Snap.CoreRun/${{ matrix.configuration }}
SNAPX_WINDOWS_PAL_REL_DIR: build/native/Windows/${{ matrix.rid }}/${{ matrix.configuration }}/Snap.CoreRun.Pal/${{ matrix.configuration }}
run: |
mkdir -p ${{ github.workspace }}/artifacts/${{ env.SNAPX_WINDOWS_SETUP_ZIP_REL_DIR }}
cp ${{ github.workspace }}/${{ env.SNAPX_WINDOWS_SETUP_ZIP_REL_DIR }}/Setup-${{ matrix.rid }}.zip ${{ github.workspace }}/artifacts/${{ env.SNAPX_WINDOWS_SETUP_ZIP_REL_DIR }}/Setup-${{ matrix.rid }}.zip
mkdir -p ${{ github.workspace }}/artifacts/${{ env.SNAPX_WINDOWS_CORERUN_REL_DIR }}
cp ${{ github.workspace }}/${{ env.SNAPX_WINDOWS_CORERUN_REL_DIR }}/corerun.exe ${{ github.workspace }}/artifacts/${{ env.SNAPX_WINDOWS_CORERUN_REL_DIR }}/corerun.exe
mkdir -p ${{ github.workspace }}/artifacts/${{ env.SNAPX_WINDOWS_PAL_REL_DIR }}
cp ${{ github.workspace }}/${{ env.SNAPX_WINDOWS_PAL_REL_DIR }}/pal.dll ${{ github.workspace }}/artifacts/${{ env.SNAPX_WINDOWS_PAL_REL_DIR }}/pal.dll
- name: Upload artifacts
if: success()
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-${{ matrix.rid }}-${{ matrix.configuration }}
path: ${{ github.workspace }}/artifacts/**/*
#test-linux-arm64:
# name: Test ${{ matrix.rid }}-${{ matrix.configuration }}
# runs-on: [self-hosted, linux, ARM64]
# needs: [setup, linux]
# strategy:
# matrix:
# include:
# - rid: linux-arm64
# configuration: Debug
# - rid: linux-arm64
# configuration: Release
# env:
# SNAPX_UNIX_CORERUN_TESTS_REL_DIR: build/native/Unix/${{ matrix.rid }}/${{ matrix.configuration }}/Snap.CoreRun.Tests
# SNAPX_VERSION: ${{ needs.setup.outputs.SNAPX_VERSION }}
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
#
# - name: Download ubuntu-latest-${{ matrix.rid }}-${{ matrix.configuration }} artifacts
# uses: actions/download-artifact@v3
# with:
# name: ubuntu-latest-${{ matrix.rid }}-${{ matrix.configuration }}
# path: ${{ github.workspace }}
#
# - name: Setup .NET
# uses: actions/[email protected]
# with:
# dotnet-version: |
# ${{ env.DOTNET_NET60_VERSION }}
# ${{ env.DOTNET_NET70_VERSION }}
#
# - name: Test native
# run: |
# chmod +x ${{ env.SNAPX_UNIX_CORERUN_TESTS_REL_DIR }}/corerun_tests
# ./${{ env.SNAPX_UNIX_CORERUN_TESTS_REL_DIR }}/corerun_tests
#
# - name: Test .NET
# shell: pwsh
# run: ./build.ps1 Run-Dotnet-UnitTests -Version ${{ env.SNAPX_VERSION }} -Configuration ${{ matrix.configuration }} -CIBuild -NetCoreAppVersion ${{ env.SNAPX_DOTNET_FRAMEWORK_VERSION }} -Rid ${{ matrix.rid }}
publish:
if: success() && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')
runs-on: ubuntu-latest
name: Publish
needs: [setup, windows, linux] # todo: enable me when github actions supports arm64: test-linux-arm64
env:
SNAPX_VERSION: ${{ needs.setup.outputs.SNAPX_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: true
- name: Download ubuntu-latest-linux-arm64-Release artifacts
uses: actions/download-artifact@v3
with:
name: ubuntu-latest-linux-arm64-Release
path: ${{ github.workspace }}
- name: Download ubuntu-latest-linux-x64-Release artifacts
uses: actions/download-artifact@v3
with:
name: ubuntu-latest-linux-x64-Release
path: ${{ github.workspace }}
- name: Download windows-latest-win-x86-Release artifacts
uses: actions/download-artifact@v3
with:
name: windows-latest-win-x86-Release
path: ${{ github.workspace }}
- name: Download windows-latest-win-x64-Release artifacts
uses: actions/download-artifact@v3
with:
name: windows-latest-win-x64-Release
path: ${{ github.workspace }}
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: |
${{ env.DOTNET_NET60_VERSION }}
${{ env.DOTNET_NET70_VERSION }}
- name: Add dotnet tools to environment path
shell: pwsh
run: echo "${HOME}/.dotnet/tools" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Build nupkgs
shell: pwsh
run: ./build.ps1 -Target Snapx -CIBuild -Version ${{ env.SNAPX_VERSION }} -Configuration Release
- name: Push nuget packages
shell: pwsh
run: |
$nupkgs = Get-ChildItem ".\${{ env.GITHUB_WORKSPACE }}\nupkgs" -Filter *.nupkg | Select-Object -ExpandProperty FullName
$nupkgs | ForEach-Object {
dotnet nuget push $_ --source nuget.org --api-key ${{ secrets.PETERSUNDE_NUGET_ORG_API_KEY }}
if($LASTEXITCODE -ne 0)
{
Write-Error "Error uploading nupkg: $_"
}
}
- name: Create github release tag
if: github.ref == 'refs/heads/master'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.SNAPX_VERSION }}
release_name: Release v${{ env.SNAPX_VERSION }}
draft: true
prerelease: false