fix(ci): move Swift CodeQL to macos-latest - #12
Merged
Merged
Conversation
GitHub-hosted ubuntu runners refuse Swift CodeQL extraction: Swift analysis is only supported on macOS runner images. Please migrate to a macOS runner. Pre-existing config bug from when codeql.yml was first added — flipping the runs-on to macos-latest is the documented fix (https://codeql.github.com/docs/codeql-overview/supported-languages-and-frameworks/). Closes #11
… binaryTargets After moving the runner to macos-latest the autobuild step still failed: error: emit-module command failed with exit code 1 Sources/Pilot/Pilot.swift:25:8: error: no such module 'PilotC' CodeQL's swift autobuild invokes swiftc directly without running `swift package resolve` first, so the manifest's .binaryTarget (PilotC, the XCFramework) is never downloaded. Replace autobuild with the same `swift build` the ci.yml test job already runs successfully — that resolves the manifest, fetches the artifact, and produces an indexable build the extractor can attach to.
With `swift package resolve` running after codeql-action/init, swift downloaded Pilot.xcframework.zip OK but the compile then failed with `error: no such module 'PilotC'` — the tracer interposes between resolve and compile in a way that hides the freshly-resolved module from the swift search path. Splitting the resolve out into its own step before the tracer init puts the XCFramework on disk first, so the observed `swift build` step is a no-op resolve + clean compile.
Auto-tracing the swift build still couldn't see the resolved .binaryTarget (PilotC, the XCFramework) even with a pre-tracer `swift package resolve` — the documented limitation when `swift build` is auto-instrumented under codeql-action. `build-mode: manual` disables the auto-trace; the database is populated from the explicit `swift build` step instead. This is the official escape hatch for compiled languages whose build flow autobuild can't follow.
The CodeQL tracer (build-mode: manual) wraps `swift build` and forces a clean recompile to observe the Swift frontend. SwiftPM's internal build plan injects the .binaryTarget (PilotC XCFramework) modulemap dir into the compile's header search path, but that injection does not survive the tracer's re-invocation of the compiler — producing `no such module 'PilotC'` (Sources/Pilot/Pilot.swift:25) even though the pre-resolve and a plain `swift build` both succeed. Make the traced build self-contained: locate the resolved XCFramework's macOS-slice Headers dir (carries PilotC's module.modulemap) under .build/artifacts and pass it explicitly via `-Xswiftc -I`, so PilotC resolves regardless of how the tracer re-spawns the compiler. Validated locally on macOS (Apple Swift 6.3.2): full clean pre-resolve + forced clean recompile with the explicit header path compiles Pilot + PilotC successfully. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11.
GitHub-hosted ubuntu runners refuse Swift CodeQL extraction:
```
Swift analysis is only supported on macOS runner images.
Please migrate to a macOS runner.
```
Pre-existing config bug from when codeql.yml was first added. The documented fix is to flip the runner to macOS, which I've done.
Stays on the `-latest` tag so the runner image moves forward as GitHub upgrades it.
Test plan