Skip to content

Commit e512e5b

Browse files
committed
Build the macOS shim from source in CI
Until now a change to native/swift did not reach the macOS job at all. That job loaded the committed dylib, so the pixel baselines described whatever was last rebuilt, and a Swift change could not turn it red however wrong it was -- it only went red on the ABI version check, and only until the binaries PR was merged. The Linux job has built from source all along and has not had that gap. Only the runner architecture is built, since this is the only place it is loaded. What ships is still loaded and still checked by the native job, which is now the only thing testing the committed binaries and says so.
1 parent 5597981 commit e512e5b

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

.github/workflows/test.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,25 @@ jobs:
109109
mkdir -p src/DiffEngineViewer.Linux/runtimes/linux-x64/native
110110
cp native/build/linux-x64/libdiffengine_viewer.so src/DiffEngineViewer.Linux/runtimes/linux-x64/native/
111111
112+
# Same reason as the Linux build above, and the same trade. Before it, a change to
113+
# native/swift did not reach this job at all until build-native had run and its binaries PR
114+
# had been merged, so the macOS baselines described the previous rebuild and a Swift change
115+
# could not go red here however wrong it was.
116+
#
117+
# Only this runner's own architecture, because this is the only thing that loads it. The
118+
# committed universal binary is still loaded and still checked, by the native job below —
119+
# which is the job that exists to prove what actually ships.
120+
#
121+
# Not cached: this is six Swift files against system frameworks, twenty-odd seconds, and a
122+
# stale cache here would reintroduce exactly the staleness the step removes.
123+
- name: Build native renderer
124+
if: runner.os == 'macOS'
125+
run: |
126+
swift build -c release --package-path native/swift
127+
mkdir -p src/DiffEngineViewer.Mac/runtimes/osx-arm64/native
128+
cp "$(swift build -c release --package-path native/swift --show-bin-path)/libdiffengine_viewer.dylib" \
129+
src/DiffEngineViewer.Mac/runtimes/osx-arm64/native/
130+
112131
# Release-NotWindows drops the WinForms tray and its tests from the solution.
113132
- name: Build
114133
run: dotnet build src --configuration Release-NotWindows
@@ -152,10 +171,11 @@ jobs:
152171
if-no-files-found: ignore
153172
retention-days: 14
154173

155-
# The jobs above only ever load the x64 natives, and the Linux one rebuilds its own from source.
156-
# This job exists so the arm64 binaries are actually loaded somewhere, which is what catches a
157-
# wrong architecture, a file corrupted by a text mode checkout, or an unsatisfied runtime
158-
# dependency.
174+
# Neither job above loads a committed binary any more: both build the shim from source so their
175+
# pixel baselines track it. That leaves nothing testing what actually ships, which is this job.
176+
# It loads the committed binaries as they are, which is what catches a wrong architecture, a file
177+
# corrupted by a text mode checkout, an unsatisfied runtime dependency, or simply a rebuild that
178+
# was never merged.
159179
#
160180
# It runs DiffEngineViewer.Tests rather than the whole suite: that is where the native smoke test
161181
# lives, it takes seconds, and it gives the screen and IPC tests some cross architecture coverage

0 commit comments

Comments
 (0)