Skip to content

Commit 67131da

Browse files
tianjianjiangclaude
andcommitted
ci: fix CodeQL build failures by using correct Python version
The CodeQL workflow was failing for Swift and C++ analyses because: 1. The workflow sets up Python 3.12 via actions/setup-python 2. But xcodebuild doesn't inherit this Python in its environment 3. The Makefile uses hardcoded python3 which resolves to Xcode's bundled Python 3.9 4. This causes build failures when the Makefile is executed during the Data target build phase Changes: - Add Python 3.12 setup step to CodeQL workflow - Pass PYTHON environment variable to xcodebuild command - Update Makefile to use $(PYTHON) variable instead of hardcoded python3 - Allows environment to override Python executable while maintaining backward compatibility This ensures CodeQL builds use the correct Python version and fixes the cascading Swift/C++ build failures. Fixes: https://github.com/openvanilla/McBopomofo/actions/runs/18998321918 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5634228 commit 67131da

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ jobs:
4848
- name: Checkout repository
4949
uses: actions/checkout@v4
5050

51+
- name: Set up Python
52+
uses: actions/setup-python@v6
53+
with:
54+
python-version: '3.12'
55+
5156
- name: Initialize CodeQL
5257
uses: github/codeql-action/init@v4
5358
with:
@@ -56,7 +61,7 @@ jobs:
5661

5762
- name: Build project
5863
run: |
59-
xcodebuild -scheme McBopomofoInstaller -configuration Debug build ARCHS=arm64 ONLY_ACTIVE_ARCH=YES
64+
PYTHON=$(which python3) xcodebuild -scheme McBopomofoInstaller -configuration Debug build ARCHS=arm64 ONLY_ACTIVE_ARCH=YES
6065
6166
- name: Perform CodeQL Analysis
6267
uses: github/codeql-action/analyze@v4

Source/Data/Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1+
PYTHON ?= python3
2+
13
.PHONY: sort clean
24

35
all: data.txt data-plain-bpmf.txt associated-phrases-v2.txt
46

57
install: all
68

79
data-plain-bpmf.txt: curation/compilers/plain_bpmf_compiler.py BPMFBase.txt BPMFPunctuations.txt
8-
python3 -m curation.compilers.plain_bpmf_compiler BPMFBase.txt BPMFPunctuations.txt data-plain-bpmf.txt
10+
$(PYTHON) -m curation.compilers.plain_bpmf_compiler BPMFBase.txt BPMFPunctuations.txt data-plain-bpmf.txt
911

1012
data.txt: curation/compilers/main_compiler.py BPMFBase.txt BPMFMappings.txt BPMFPunctuations.txt \
1113
PhraseFreq.txt phrase.occ Symbols.txt Macros.txt\
1214
heterophony1.list heterophony2.list heterophony3.list
13-
python3 -m curation.compilers.main_compiler \
15+
$(PYTHON) -m curation.compilers.main_compiler \
1416
--heterophony1 heterophony1.list \
1517
--heterophony2 heterophony2.list \
1618
--heterophony3 heterophony3.list \
@@ -23,10 +25,10 @@ data.txt: curation/compilers/main_compiler.py BPMFBase.txt BPMFMappings.txt BPMF
2325
--output data.txt
2426

2527
associated-phrases-v2.txt: data.txt curation/builders/phrase_deriver.py associated-punctuation.txt
26-
python3 -m curation.builders.phrase_deriver $< $@ associated-punctuation.txt
28+
$(PYTHON) -m curation.builders.phrase_deriver $< $@ associated-punctuation.txt
2729

2830
PhraseFreq.txt: curation/builders/frequency_builder.py phrase.occ exclusion.txt
29-
python3 -m curation.builders.frequency_builder
31+
$(PYTHON) -m curation.builders.frequency_builder
3032

3133
clean:
3234
rm -f data.txt data-plain-bpmf.txt phrase.list
@@ -68,7 +70,7 @@ tidy:
6870
@sed -i '' -e 's/1/˙/g;s/2/ˊ/g;s/3/ˇ/g;s/4/ˋ/g' BPMFMappings.txt
6971

7072
_phrase.occ: phrase.list
71-
@python3 scripts/count_occurrences.py phrase.list > tmp && mv tmp phrase.occ
73+
@$(PYTHON) scripts/count_occurrences.py phrase.list > tmp && mv tmp phrase.occ
7274

7375
phrase.list: BPMFBase.txt BPMFMappings.txt
7476
awk 'length($$1)<4{print $$1}' BPMFBase.txt > tmp

0 commit comments

Comments
 (0)