Skip to content

Commit aff0ecb

Browse files
funsaizedclaude
andcommitted
fix(ci): run Swift toolchain setup before CodeQL init
CodeQL manual build-mode wraps every step after init in an x86_64 Rosetta shim, under which `brew install` fails on the Apple Silicon runner ("Cannot install under Rosetta 2 in ARM default prefix"). Move Xcode selection, XcodeGen install, and project generation before init so they run natively; keep only xcodebuild inside the traced region for the extractor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 687434f commit aff0ecb

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,11 @@ jobs:
4040
- name: Check out repository
4141
uses: actions/checkout@v6
4242

43-
- name: Initialize CodeQL
44-
uses: github/codeql-action/init@v3
45-
with:
46-
languages: ${{ matrix.language }}
47-
build-mode: ${{ matrix.build-mode }}
48-
49-
# Manual build for Swift: the Xcode project is generated by XcodeGen
50-
# (project.yml) and is not committed, so CodeQL autobuild cannot find
51-
# it. Mirror the build steps from ci.yml so the extractor can trace it.
43+
# Swift toolchain setup runs BEFORE init so it executes natively.
44+
# CodeQL's manual build-mode tracer wraps every step after init in an
45+
# x86_64/Rosetta shim, under which Homebrew refuses to run on Apple
46+
# Silicon. The Xcode project is generated by XcodeGen (project.yml) and
47+
# is not committed, so it must be generated here.
5248
- name: Select latest stable Xcode
5349
if: matrix.language == 'swift'
5450
uses: maxim-lobanov/setup-xcode@v1
@@ -63,6 +59,14 @@ jobs:
6359
if: matrix.language == 'swift'
6460
run: xcodegen generate
6561

62+
- name: Initialize CodeQL
63+
uses: github/codeql-action/init@v3
64+
with:
65+
languages: ${{ matrix.language }}
66+
build-mode: ${{ matrix.build-mode }}
67+
68+
# Only the actual compilation runs inside the CodeQL tracing region so
69+
# the Swift extractor can observe the build.
6670
- name: Build (no code signing)
6771
if: matrix.language == 'swift'
6872
run: |

0 commit comments

Comments
 (0)