-
-
Notifications
You must be signed in to change notification settings - Fork 23
233 lines (199 loc) · 7.97 KB
/
cicd.yml
File metadata and controls
233 lines (199 loc) · 7.97 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
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
name: CICD
on:
workflow_dispatch:
push:
branches:
- 'main'
- 'alpha'
- 'beta'
pull_request:
types: [opened, reopened, synchronize]
permissions:
id-token: write
contents: write
actions: write
checks: write
issues: write
pull-requests: write
jobs:
build-test:
name: Build & Test
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v6
- name: Setup .NET Core
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Build
run: dotnet build -c Release
- name: Test Avalonia
run: dotnet test tests/KubeUI.Avalonia.Tests/KubeUI.Avalonia.Tests.csproj -c Release --no-build --collect:"XPlat Code Coverage" --logger "trx;LogFileName=test-results.trx"
- name: Test Kubernetes E2E
run: dotnet test tests/KubeUI.Kubernetes.Tests/KubeUI.Kubernetes.Tests.csproj -c Release --no-build --collect:"XPlat Code Coverage" --logger "trx;LogFileName=test-results.trx"
env:
KUBEUI_RUN_KIND_TESTS: 1
- name: Test Report
uses: dorny/test-reporter@v3
if: (!cancelled())
with:
name: KubeUI Tests
path: tests/**/TestResults/*.trx
reporter: dotnet-trx
- name: Test Summary
uses: EnricoMi/publish-unit-test-result-action@v2
if: (!cancelled())
with:
check_name: KubeUI Tests
comment_mode: always
files: tests/*/TestResults/*.trx
- name: Coverage
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: tests/*/TestResults/*/coverage.cobertura.xml
fail_ci_if_error: false
# - name: Run Benchmark
# working-directory: benchmarks/KubeUI.Benchmarks
# run: dotnet run -c Release
semantic-release:
name: Bump Version
needs: [build-test]
runs-on: ubuntu-latest
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
new_release_version: ${{ (steps.semantic.outputs.new_release_published && steps.semantic.outputs.new_release_version) || '0.0.1-alpha.1' }}
new_release_notes: ${{ steps.semantic.outputs.new_release_notes }}
steps:
- uses: actions/checkout@v6
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v6.0.0
id: semantic
with:
dry_run: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-matrix:
name: Publish Installer ${{ matrix.rid }}
runs-on: ${{ matrix.runs-on }}
needs: [semantic-release]
environment: production
strategy:
matrix:
include:
- rid: win-x64
fileName: KubeUI.Desktop.exe
runs-on: windows-latest
packParam: --icon src/KubeUI.Avalonia/Assets/icon.ico --azureTrustedSignFile metadata.json --verbose --signExclude \.dll$
- rid: win-arm64
fileName: KubeUI.Desktop.exe
runs-on: windows-latest
packParam: --icon src/KubeUI.Avalonia/Assets/icon.ico --azureTrustedSignFile metadata.json --verbose --signExclude \.dll$
- rid: linux-x64
fileName: KubeUI.Desktop
runs-on: ubuntu-latest
packParam: --icon docs/icon-512.png
- rid: linux-arm64
fileName: KubeUI.Desktop
runs-on: ubuntu-latest
packParam: --icon docs/icon-512.png
- rid: osx-x64
fileName: KubeUI.Desktop
runs-on: macos-latest
packParam: --icon src/KubeUI.Avalonia/Assets/icon.icns --plist src/KubeUI.Desktop/info.plist
- rid: osx-arm64
fileName: KubeUI.Desktop
runs-on: macos-latest
packParam: --icon src/KubeUI.Avalonia/Assets/icon.icns --plist src/KubeUI.Desktop/info.plist
steps:
- uses: actions/checkout@v6
with:
submodules: 'true'
- uses: actions/setup-dotnet@v5
with:
dotnet-version: '9.x.x'
- name: Setup .NET Core
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Install Velopack
shell: pwsh
run: |
$csprojPath = "src/KubeUI.Avalonia/KubeUI.Avalonia.csproj"
[xml]$csprojXml = Get-Content -Path $csprojPath
$velopackVersion = $csprojXml.Project.ItemGroup.PackageReference |
Where-Object { $_.Include -eq "Velopack" } |
Select-Object -ExpandProperty Version
dotnet tool install -g vpk --version $velopackVersion
- name: Install Velopack Deps
if: matrix.runs-on == 'ubuntu-latest'
run: sudo apt install libfuse2
- name: Publish
working-directory: src/KubeUI.Desktop
run: dotnet publish -c Release -r ${{ matrix.rid }} -o bin/publish -p:Version=${{ needs.semantic-release.outputs.new_release_version }}
- name: Replace single file
if: matrix.runs-on == 'macos-latest'
uses: richardrigutins/replace-in-files@v3
with:
files: 'src/KubeUI.Desktop/info.plist'
search-text: '{{version}}'
replacement-text: ${{ needs.semantic-release.outputs.new_release_version }}
- name: Azure Login
if: matrix.runs-on == 'windows-latest'
uses: azure/login@v3
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Write metadata.json
if: matrix.runs-on == 'windows-latest'
shell: pwsh
run: |
[System.Text.Encoding]::UTF8.GetBytes($env:SECRET) | Set-Content -Path metadata.json -AsByteStream
env:
SECRET: ${{ secrets.AZURETRUSTEDSIGNFILE }}
- name: Write CHANGELOG.md
shell: pwsh
run: |
if([string]::IsNullOrEmpty($env:CHANGELOG)){
"N/A" | Out-File -FilePath CHANGELOG.md
} else {
$env:CHANGELOG | Out-File -FilePath CHANGELOG.md
(Get-Content -Path CHANGELOG.md -Raw) -replace '&', 'and' | Set-Content -Path CHANGELOG.md -NoNewline -Encoding utf8
}
env:
CHANGELOG: ${{ needs.semantic-release.outputs.new_release_notes }}
- name: Download Releases
if: needs.semantic-release.outputs.new_release_published == 'true'
run: |
vpk download github --repoUrl https://github.com/${{ github.repository }} --token ${{ secrets.GITHUB_TOKEN }} -c ${{ matrix.rid }} --pre -o packed
- name: Create Package
run: |
vpk pack --packTitle KubeUI -u KubeUI -v ${{ needs.semantic-release.outputs.new_release_version }} -p src/KubeUI.Desktop/bin/publish -c ${{ matrix.rid }} -e ${{ matrix.fileName }} -o packed ${{ matrix.packParam }} --packAuthors "Ivan Josipovic" --releaseNotes CHANGELOG.md
- name: Remove unnecessary assets
shell: pwsh
run: |
Remove-Item -Path packed/assets.*
Remove-Item -Path packed/RELEASES-*
Get-ChildItem -Path packed -Filter "*.nupkg" -File | Where-Object { $_.Name -notlike "*${{ needs.semantic-release.outputs.new_release_version }}*" } | Remove-Item
- name: Upload Artifacts
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.rid }}-artifacts
path: packed
release:
if: needs.semantic-release.outputs.new_release_published == 'true'
name: Create Release
needs: [semantic-release, publish-matrix]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Download artifacts
uses: actions/download-artifact@v8
with:
path: dist/
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v6.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}