-
-
Notifications
You must be signed in to change notification settings - Fork 8
230 lines (196 loc) · 10.5 KB
/
Copy pathci.yml
File metadata and controls
230 lines (196 loc) · 10.5 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
name: CI
on:
# push is scoped to the same branches as pull_request (not '**'): a push to a branch with
# an open PR fires both events on the same commit, double-running the windows-latest/macos-26
# jobs below for no extra coverage. Pushes to a WIP feature branch with no PR yet now build
# nothing until a PR is opened — direct pushes to main/develop/v2.1 still get their own run.
# paths-ignore skips the whole workflow when every changed file is docs/README — those never
# affect the build/test matrix. (Only skips if ALL changed files match; a PR mixing docs with
# code still runs CI.) GitHub Pages serves /docs via the legacy Jekyll builder tied to repo
# settings, not an Actions workflow, so this doesn't affect the docs site build either.
push:
branches: [main, develop, v2.1]
paths-ignore: &docs-only ['docs/**', 'README.md']
pull_request:
branches: [main, develop, v2.1]
paths-ignore: *docs-only
# Cancel a still-running CI run for the same PR/branch when a new commit lands, instead of
# letting superseded windows-latest/macos-26 jobs run to completion — those two runner classes
# are what GitHub actually charges for. Keyed by PR number (not head_ref): two different forks
# can share a branch name (e.g. both named "fix"), and head_ref alone would let one contributor's
# push cancel another contributor's unrelated run.
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build-and-test:
runs-on: windows-latest
# Build only WinPrint.Maui's Windows head on this job — the macOS job builds AND UI-tests MacCatalyst,
# so cross-compiling it here is redundant. With the MacCatalyst TFM dropped (honored by every MSBuild
# tool below, incl. jb cleanupcode and dotnet format) we install just the maui-windows workload and skip
# the multi-minute Apple/Android pack download.
env:
WinPrintWindowsOnly: 'true'
steps:
- name: Checkout source
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5
with:
dotnet-version: '10.0.x'
- name: Install MAUI workloads
# maui-windows only — the MacCatalyst head isn't built on this job (see WinPrintWindowsOnly).
run: dotnet workload install maui-windows
- name: Cache NuGet packages
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.slnx', 'Directory.Build.props', 'Directory.Build.targets', 'global.json') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Restore
run: dotnet restore WinPrint.slnx /p:Configuration=Debug
- name: Build analyzer
# Pre-build the WinPrint.Analyzers project so the solution build doesn't
# race two TargetFramework builds against the same Analyzer DLL output.
run: dotnet build tools/WinPrint.Analyzers/WinPrint.Analyzers.csproj --no-restore /p:Configuration=Debug
- name: Build
run: dotnet build WinPrint.slnx --no-restore /p:Configuration=Debug /p:DefineConstants="CI_BUILD" /p:WriteVersionInfoToBuildLog=false
- name: Restore .NET tools
run: dotnet tool restore
- name: Verify code style
shell: bash
# Single source of truth for the style gate — the same script agents run locally
# before pushing (see scripts/verify-style.sh for the WinPrintCleanup rationale).
run: scripts/verify-style.sh --ci
# Core + every front end's unit tests, plus the UI tests that run on a Windows desktop session:
# TUI (headless render). The MAUI Appium UI tests run on the macOS job below;
# MAUI unit tests (pure geometry) run here.
- name: Test (Core)
run: dotnet test tests/WinPrint.Core.UnitTests/WinPrint.Core.UnitTests.csproj --configuration Debug --no-build --verbosity normal
- name: Test (TUI unit)
run: dotnet test tests/WinPrint.TUI.UnitTests/WinPrint.TUI.UnitTests.csproj --configuration Debug --no-build --verbosity normal
- name: Test (TUI UI)
run: dotnet test tests/WinPrint.TUI.UITests/WinPrint.TUI.UITests.csproj --configuration Debug --no-build --verbosity normal
- name: Test (MAUI unit)
run: dotnet test tests/WinPrint.Maui.UnitTests/WinPrint.Maui.UnitTests.csproj --configuration Debug --no-build --verbosity normal
# Native AOT publish smoke for wp (issue #66). Gates trim/AOT regressions on PRs without waiting for release.
aot-publish:
name: AOT publish (${{ matrix.runtime }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
runtime: linux-x64
framework: net10.0
# Native arm64 runner — AOT links natively (cross-AOT to aarch64 from an x64 runner
# fails: "ld.bfd: unrecognised emulation mode: aarch64linux"). This leg was missing,
# so a linux-arm64 AOT break only surfaced at release time; cover it in PR CI now.
- os: ubuntu-24.04-arm
runtime: linux-arm64
framework: net10.0
- os: macos-26
runtime: osx-arm64
framework: net10.0
- os: windows-latest
runtime: win-x64
framework: net10.0-windows
# Native Windows arm64 runner (free for public repos) — gates the win-arm64 AOT TUI
# build on PRs so a regression surfaces here, not only at release (issue #187).
- os: windows-11-arm
runtime: win-arm64
framework: net10.0-windows
steps:
- name: Checkout source
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5
with:
dotnet-version: '10.0.x'
- name: Cache NuGet packages
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.slnx', 'Directory.Build.props', 'Directory.Build.targets', 'global.json') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Publish wp (Native AOT)
shell: bash
run: |
publishDir="artifacts/aot-ci/${{ matrix.runtime }}"
dotnet publish src/WinPrint.TUI/WinPrint.TUI.csproj \
-c Release \
-f "${{ matrix.framework }}" \
-r "${{ matrix.runtime }}" \
--self-contained true \
-o "$publishDir"
- name: Smoke (version)
shell: bash
run: |
wp="artifacts/aot-ci/${{ matrix.runtime }}/wp"
if [ "${{ runner.os }}" = "Windows" ]; then
wp="artifacts/aot-ci/${{ matrix.runtime }}/wp.exe"
fi
"$wp" --version
- name: Smoke (headless --cat)
shell: bash
run: |
wp="artifacts/aot-ci/${{ matrix.runtime }}/wp"
if [ "${{ runner.os }}" = "Windows" ]; then
wp="artifacts/aot-ci/${{ matrix.runtime }}/wp.exe"
fi
"$wp" tui testfiles/oneline.txt --cat --width 40 --height 10 | head -5
# MAUI UI automation: Appium (mac2 driver) against the MacCatalyst app. Needs a macOS host with Xcode,
# Appium, and the built app — hence a separate job from the Windows build/test matrix.
#
# Runner: macos-26 (NOT macos-latest). The .NET 10 maui workload's Microsoft.MacCatalyst pack hard-
# requires the MacCatalyst 26.5 SDK (Xcode 26.5) — its ILLink 'Setup' step version-checks the SDK and
# fails with MT0180/NETSDK1144 on anything older, regardless of trim/link mode. macos-latest is still
# macOS 15, whose newest Xcode is 26.3, so the build can never satisfy the gate there. macos-26 ships
# Xcode 26.5 (its default), which pairs with this SDK. Bump both together when the SDK requires a newer
# Xcode (the error names the exact version).
#
# Gating: build, Appium session, app activation, and the File-menu UI assertions all pass on macos-26.
# If the Appium menu-bar tests prove timing-flaky in practice, re-add continue-on-error rather than
# leaving a red gate.
maui-ui-tests:
runs-on: macos-26
steps:
- name: Checkout source
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5
with:
dotnet-version: '10.0.x'
- name: Install MAUI workloads
run: dotnet workload install maui
- name: Cache NuGet packages
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.slnx', 'Directory.Build.props', 'Directory.Build.targets', 'global.json') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Select Xcode 26.5
# Pin explicitly rather than rely on the image default so the MacCatalyst SDK <-> Xcode pairing is
# deterministic across image refreshes. 26.5 is the macos-26 default today; this is a no-op now but
# guards against a future default bump leaving the SDK requirement unmet.
run: sudo xcode-select -s /Applications/Xcode_26.5.app
- name: Build MacCatalyst app
# Compile-check the MacCatalyst app on every PR (it doesn't build on the Windows/Linux legs).
# MtouchLink=None asks for the lightest link mode; with Xcode 26.5 present the Apple linker's
# SDK check (MT0180) passes.
run: dotnet build src/WinPrint.Maui/WinPrint.Maui.csproj -c Debug -f net10.0-maccatalyst -p:MtouchLink=None
- name: Test (MAUI UI)
# The UI tests self-guard by OS and no-op where they don't apply (the Windows-only checkbox/layout
# tests skip on macOS), so this mainly asserts the test project builds and runs. The MacCatalyst
# File-menu enablement that used to be Appium-driven here is now covered by WinPrint.Core.UnitTests
# (AppViewModelPrintEnablementTests), which is deterministic and needs no running app.
run: dotnet test tests/WinPrint.Maui.UITests/WinPrint.Maui.UITests.csproj --configuration Debug --verbosity normal