-
Notifications
You must be signed in to change notification settings - Fork 0
269 lines (225 loc) · 8.18 KB
/
ci.yml
File metadata and controls
269 lines (225 loc) · 8.18 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
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
name: CI
on:
push:
branches:
- main
- release/**
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
- release/**
jobs:
build:
name: Build
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run uno-check (wasm)
run: |
dotnet tool install --global uno.check
uno-check -v --ci --non-interactive --fix `
--skip xcode --skip gtk3 --skip vswin --skip vswinworkloads --skip unosdk `
--skip dotnetnewunotemplates --skip vsmac --skip androidsdk --skip openjdk --skip androidemulator `
--tfm net10.0-browserwasm
- uses: dotnet/nbgv@f088059084cb5d872e9d1a994433ca6440c2bf72 # v0.4.2
with:
toolVersion: 3.6.139
setAllVars: true
- name: Build
run: |
cd src
dotnet build -c Release -p:PackageVersion=$env:NBGV_SemVer2 -p:Version=$env:NBGV_SemVer2 "-p:InformationalVersion=$env:NBGV_SemVer2+$env:NBGV_BuildingRef" "/p:PackageOutputPath=$env:GITHUB_WORKSPACE\artifacts"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: NuGet
path: .\artifacts
- name: Create Test Results Directory
shell: pwsh
run: New-Item -ItemType Directory -Force -Path artifacts/test-results
- name: Test
shell: pwsh
run: |
cd src
dotnet run --project Uno.DevTools.Telemetry.Tests/Uno.DevTools.Telemetry.Tests.csproj --configuration Release -- --report-trx --results-directory ../artifacts/test-results
- name: Upload Test Results
uses: actions/upload-artifact@v4
with:
name: test-results
path: artifacts/test-results/*.trx
- name: Publish Test Results
uses: dorny/test-reporter@v2
if: always()
with:
name: Unit Tests
path: artifacts/test-results/*.trx
reporter: dotnet-trx
# WebAssembly Runtime Tests
# Tests telemetry functionality in actual browser environment using Uno.UI.RuntimeTests.Engine
# Follows official guide: https://github.com/unoplatform/uno.ui.runtimetests.engine
wasm-tests:
name: WASM Runtime Tests
runs-on: ubuntu-latest
if: true # Enabled - tests are now working
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Free disk space (Linux)
uses: ./.github/actions/host-cleanup-linux
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Run uno-check (wasm)
run: |
dotnet tool install --global uno.check
uno-check -v --ci --non-interactive --fix \
--skip xcode --skip gtk3 --skip vswin --skip vswinworkloads --skip unosdk \
--skip dotnetnewunotemplates --skip vsmac --skip androidsdk --skip openjdk --skip androidemulator \
--tfm net10.0-browserwasm
- name: Install Uno.UI.RuntimeTests.Engine.Wasm.Runner
run: dotnet tool install -g Uno.UI.RuntimeTests.Engine.Wasm.Runner --version 2.0.0-dev.37
- name: Install Chromium via Playwright
run: npx playwright install chromium
- name: Publish WASM Test Project
run: |
cd src/Uno.DevTools.Telemetry.WasmTests/Uno.DevTools.Telemetry.WasmTests
# Disable trimming as required by RuntimeTests.Engine (uses reflection for test discovery)
dotnet publish -c Release -f net10.0-browserwasm -p:PublishTrimmed=false -o ./publish
- name: Run WASM Runtime Tests
run: |
cd src/Uno.DevTools.Telemetry.WasmTests/Uno.DevTools.Telemetry.WasmTests
# Run tests using the official Uno.UI.RuntimeTests.Engine.Wasm.Runner tool
uno-runtimetests-wasm --app-path ./publish/wwwroot --output ./wasm-test-results.xml --timeout 300
- name: Upload WASM Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: wasm-test-results
path: src/Uno.DevTools.Telemetry.WasmTests/Uno.DevTools.Telemetry.WasmTests/wasm-test-results.xml
- name: Publish WASM Test Results
uses: dorny/test-reporter@v2
if: always()
with:
name: WASM Tests
path: src/Uno.DevTools.Telemetry.WasmTests/Uno.DevTools.Telemetry.WasmTests/wasm-test-results.xml
reporter: dotnet-nunit
sign:
name: Sign Package
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) }}
runs-on: windows-latest
environment: PackageSign
permissions:
id-token: write # Required for requesting the JWT
needs:
- build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: NuGet
path: artifacts\NuGet
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Setup SignClient
run: dotnet tool install --tool-path . sign --version 0.9.1-beta.25278.1
# Login to Azure using a ServicePrincipal configured to authenticate against a GitHub Action
- name: 'Az CLI login'
uses: azure/login@v1
with:
allow-no-subscriptions: true
client-id: ${{ secrets.SIGN_AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.SIGN_AZURE_TENANT_ID }}
subscription-id: ${{ secrets.SIGN_AZURE_SUBSCRIPTION_ID }}
# Run the signing command
- name: Sign artifacts
shell: pwsh
run: >
./sign code azure-key-vault
artifacts\NuGet\*.nupkg
--publisher-name "Uno.Devtools.Telemetry"
--description-url "https://github.com/${{ env.GITHUB_REPOSITORY }}"
--description "Uno.Devtools.Telemetry"
--azure-key-vault-managed-identity true
--azure-key-vault-url "${{ secrets.SIGN_KEY_VAULT_URL }}"
--azure-key-vault-certificate "${{ secrets.SIGN_KEY_VAULT_CERTIFICATE_ID }}"
--verbosity information
- name: Upload Signed Artifacts
uses: actions/upload-artifact@v4
with:
name: NuGet-Signed
path: .\artifacts\NuGet
publish_dev:
name: Publish Dev
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
runs-on: windows-latest
environment: Development
needs:
- sign
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: NuGet-Signed
path: artifacts
- name: NuGet Push
shell: pwsh
run: |
dotnet nuget push artifacts\*.nupkg -s https://api.nuget.org/v3/index.json -k "${{ secrets.NUGET_ORG_API_KEY }}" --skip-duplicate
publish_prod:
name: Publish Production
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/') }}
runs-on: windows-latest
environment: Production
needs:
- sign
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: NuGet-Signed
path: artifacts
- name: NuGet Push
shell: pwsh
run: |
dotnet nuget push artifacts\*.nupkg -s https://api.nuget.org/v3/index.json -k "${{ secrets.NUGET_ORG_API_KEY }}" --skip-duplicate
tag_release:
name: Tag Release
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/') }}
runs-on: windows-latest
permissions:
contents: write
needs:
- publish_prod
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dotnet/nbgv@f088059084cb5d872e9d1a994433ca6440c2bf72 # v0.4.2
id: nbgv
with:
toolVersion: 3.6.139
setAllVars: true
- name: Tag and push to GitHub
shell: pwsh
run: |
git config user.email "info@platform.uno"
git config user.name "Uno DevOps"
git rev-parse --verify "refs/tags/$env:NBGV_SemVer2" 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Host "Tag $env:NBGV_SemVer2 already exists, skipping."
} else {
git tag $env:NBGV_SemVer2
git push origin $env:NBGV_SemVer2
}