Skip to content

The whole package builds and tests on Linux: files that need an Apple framework are guarded - #20

Merged
Skeyelab merged 2 commits into
mainfrom
linux-whole-package
Dec 3, 2026
Merged

Skeyelab merged 2 commits into
mainfrom
linux-whole-package

Conversation

@Skeyelab

@Skeyelab Skeyelab commented Dec 3, 2026

Copy link
Copy Markdown
Member

Fixes #16

Auto-merge is off on purpose: the design in #16 (option A, guards in the sources) gets a look first.

What changed

  • 64 Swift files each gain two lines: #if canImport(<framework>) on the first line and #endif on the last. Nothing else in them changes.
    • canImport(Network): 19 of MixerLink's 23 files and 35 of MixerLinkTests' 41. Only 2 files import Network; the rest need a type declared in a guarded file.
    • canImport(SwiftUI): AppearanceStyle.swift, MeterGrid.swift, MeterGridTests.swift.
    • canImport(AudioToolbox): CoreAudioIO/InputSession.swift (the module's other files were already inside #if os(...)).
    • canImport(AVFoundation): 6 BroadcastWaveTests files. 3 import it; StemFileTests, StemReadTests and StemRepairTests only borrow info and samples from CrashSafeStemTests.
  • .github/workflows/ci.yml: the Linux job runs whole-package swift build and swift test (it was a list of targets), and is renamed Linux build and tests.
  • Package.swift is unchanged: same products and targets on every platform.

Each guard is true wherever its file compiles today, so Apple builds compile the same sources. That is checked here only by the two macOS jobs.

Linux output (Swift 6.4.3, x86_64, Arch)

Before, on main, whole-package swift build and swift test:

Sources/CoreAudioIO/InputSession.swift:2:8: error: no such module 'AudioToolbox'
error: Build failed

After, swift build:

Build complete! (2.56 secs)

After, swift test (exit 0; 136 tests in 10 test targets, one run per target):

✔ Test run with 15 tests in 3 suites passed after 0.008 seconds.
✔ Test run with 12 tests in 2 suites passed after 0.012 seconds.
✔ Test run with 5 tests in 1 suite passed after 0.136 seconds.
✔ Test run with 12 tests in 3 suites passed after 0.005 seconds.
✔ Test run with 24 tests in 6 suites passed after 0.005 seconds.
✔ Test run with 0 tests in 0 suites passed after 0.001 seconds.
✔ Test run with 11 tests in 2 suites passed after 0.069 seconds.
✔ Test run with 37 tests in 3 suites passed after 0.008 seconds.
✔ Test run with 14 tests in 4 suites passed after 0.004 seconds.
✔ Test run with 6 tests in 1 suite passed after 0.001 seconds.

In that order: Telemetry 15, Shows 12, OSC 5, MixerLink 12 (the routing and preamp map tests), Meters 24, Destinations 0, BroadcastWave 11, AutoGain 37, AudioIO 14, Appearance 6.

SoundcheckKit swift test on Linux with ShowKit pointed at this branch by local path: exit 0, test runs of 49, 0, 34, 70 and 5 tests passed, the same as against #15.

What Linux still doesn't run

  • Destinations: no test runs; every test uses DriveFolderStore, which is Apple-only (Destinations doesn't compile on Linux in 0.2.0 (BookmarkCreationOptions) #13).
  • BroadcastWave: the Stem file, read and repair tests need no Apple framework but are guarded because they share two helpers with a file that uses AVFoundation. Moving the helpers would let them run; not done here.
  • MixerLink: the gain, session and controller logic is pure but reaches the mixer through OSCUDPClient, which is Network. Running it on Linux needs a seam there, not a guard.

Cost to keep in mind

A new file in these modules that needs an Apple framework (or a guarded type) must carry the guard, or the Linux job fails. That job is not a required check today.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VCgWWseQZtUzcSRzjqqQJQ

Skeyelab and others added 2 commits December 3, 2026 01:52
… framework are guarded (#16)

Each file that needs AudioToolbox, AVFoundation, Network or SwiftUI, or a type from such a file, is inside
`#if canImport(<framework>)`. Every guard is true wherever the file compiles today, so Apple builds compile
the same sources. Package.swift is unchanged.

The Linux CI job now runs whole-package `swift build` and `swift test`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VCgWWseQZtUzcSRzjqqQJQ
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VCgWWseQZtUzcSRzjqqQJQ
@codecov

codecov Bot commented Dec 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Skeyelab
Skeyelab merged commit 0c8542e into main Dec 3, 2026
5 checks passed
@Skeyelab
Skeyelab deleted the linux-whole-package branch December 3, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Whole-package swift build and swift test on Linux; run the Linux-capable tests in CI

1 participant