@@ -5,9 +5,11 @@ permissions:
55
66on :
77 push :
8- branches : [ main, master ]
8+ branches :
9+ - " **"
910 pull_request :
10- branches : [ main, master ]
11+ branches :
12+ - main
1113
1214env :
1315 PYTHON_VERSION : " 3.14"
1820
1921jobs :
2022 test :
23+ if : github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main' && github.ref != 'refs/heads/nightly')
2124 runs-on : ubuntu-latest
2225
2326 steps :
@@ -26,13 +29,13 @@ jobs:
2629 - name : Install uv
2730 uses : astral-sh/setup-uv@v4
2831 with :
29- version : " latest"
32+ version : latest
3033 enable-cache : true
3134
3235 - name : Set up Python
3336 uses : actions/setup-python@v5
3437 with :
35- python-version : " ${{ env.PYTHON_VERSION }}"
38+ python-version : ${{ env.PYTHON_VERSION }}
3639
3740 - name : Install wx build deps
3841 run : |
@@ -74,38 +77,194 @@ jobs:
7477 - name : Export requirements from uv.lock (include dev extra)
7578 run : uv export --format requirements-txt --locked --no-hashes --extra dev -o requirements.lock.txt
7679
77- - name : Populate wheelhouse from lock (build/download wheels)
80+ - name : Check wheelhouse status
81+ id : wheelhouse_check
82+ run : |
83+ mkdir -p "${WHEEL_CACHE_DIR}"
84+
85+ if ls "${WHEEL_CACHE_DIR}"/wxPython*.whl >/dev/null 2>&1; then
86+ echo "wxPython wheel found in cache, skipping wheel build"
87+ echo "needs_build=false" >> "$GITHUB_OUTPUT"
88+ else
89+ echo "wxPython wheel missing, wheelhouse build required"
90+ echo "needs_build=true" >> "$GITHUB_OUTPUT"
91+ fi
92+
93+ - name : Build wheelhouse from lock
94+ if : steps.wheelhouse_check.outputs.needs_build == 'true'
7895 run : |
7996 mkdir -p "${WHEEL_CACHE_DIR}"
8097 python -m pip wheel -w "${WHEEL_CACHE_DIR}" -r requirements.lock.txt
8198
8299 - name : Upgrade build tooling
83100 run : uv pip install -U pip setuptools wheel
84101
85- - name : Install dependencies
86- run : uv sync --extra dev --find-links "${WHEEL_CACHE_DIR}"
102+ - name : Install dependencies from wheelhouse (fallback on build)
103+ run : |
104+ if uv sync --extra dev --find-links "${WHEEL_CACHE_DIR}" --no-build; then
105+ echo "Dependencies installed from wheelhouse without builds"
106+ else
107+ echo "Wheel-only install failed, falling back to normal uv sync"
108+ uv sync --extra dev --find-links "${WHEEL_CACHE_DIR}"
109+ fi
110+
111+ - name : Run tests (--all)
112+ run : xvfb-run -a ./scripts/runtest.sh --all
113+
114+ update :
115+ if : github.event_name == 'push' && github.ref == 'refs/heads/nightly'
116+ runs-on : ubuntu-latest
117+
118+ steps :
119+ - uses : actions/checkout@v4
120+
121+ - name : Install uv
122+ uses : astral-sh/setup-uv@v4
123+ with :
124+ version : latest
125+ enable-cache : true
87126
88- - name : Run tests
127+ - name : Set up Python
128+ uses : actions/setup-python@v5
129+ with :
130+ python-version : ${{ env.PYTHON_VERSION }}
131+
132+ - name : Install wx build deps
89133 run : |
90- if [ "${{ github.ref }}" != "refs/heads/main" ]; then
91- echo "Running branch tests (--all)"
92- xvfb-run -a ./scripts/runtest.sh --all
134+ sudo apt-get update
135+ sudo apt-get install -y \
136+ build-essential pkg-config gettext \
137+ libgtk-3-dev libglib2.0-dev \
138+ libjpeg-dev libpng-dev libtiff-dev libtiff6 \
139+ libnotify-dev libsm-dev \
140+ libsdl2-dev \
141+ libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
142+ libglu1-mesa-dev freeglut3-dev \
143+ libx11-dev libxext-dev libxinerama-dev libxi-dev libxrandr-dev \
144+ libxss-dev libxtst-dev xvfb
145+
146+ if ! sudo apt-get install -y libwebkit2gtk-4.0-dev; then
147+ sudo apt-get install -y libwebkit2gtk-4.1-dev
148+ fi
149+
150+ - name : Cache pip
151+ uses : actions/cache@v4
152+ with :
153+ path : ${{ env.PIP_CACHE_DIR }}
154+ key : pip-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('**/uv.lock', '**/pyproject.toml') }}
155+ restore-keys : |
156+ pip-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-
157+
158+ - name : Cache wheelhouse
159+ uses : actions/cache@v4
160+ with :
161+ path : ${{ env.WHEEL_CACHE_DIR }}
162+ key : wheel-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-${{ hashFiles('**/uv.lock', '**/pyproject.toml') }}
163+ restore-keys : |
164+ wheel-${{ runner.os }}-py${{ env.PYTHON_VERSION }}-
165+
166+ - name : Initialize venv UV
167+ run : uv venv
168+
169+ - name : Export requirements from uv.lock (include dev extra)
170+ run : uv export --format requirements-txt --locked --no-hashes --extra dev -o requirements.lock.txt
171+
172+ - name : Check wheelhouse status
173+ id : wheelhouse_check
174+ run : |
175+ mkdir -p "${WHEEL_CACHE_DIR}"
176+
177+ if ls "${WHEEL_CACHE_DIR}"/wxPython*.whl >/dev/null 2>&1; then
178+ echo "wxPython wheel found in cache, skipping wheel build"
179+ echo "needs_build=false" >> "$GITHUB_OUTPUT"
93180 else
94- echo "Running main tests (--update) "
95- xvfb-run -a ./scripts/runtest.sh --update
181+ echo "wxPython wheel missing, wheelhouse build required "
182+ echo "needs_build=true" >> "$GITHUB_OUTPUT"
96183 fi
97184
185+ - name : Build wheelhouse from lock
186+ if : steps.wheelhouse_check.outputs.needs_build == 'true'
187+ run : |
188+ mkdir -p "${WHEEL_CACHE_DIR}"
189+ python -m pip wheel -w "${WHEEL_CACHE_DIR}" -r requirements.lock.txt
190+
191+ - name : Upgrade build tooling
192+ run : uv pip install -U pip setuptools wheel
193+
194+ - name : Install dependencies from wheelhouse (fallback on build)
195+ run : |
196+ if uv sync --extra dev --find-links "${WHEEL_CACHE_DIR}" --no-build; then
197+ echo "Dependencies installed from wheelhouse without builds"
198+ else
199+ echo "Wheel-only install failed, falling back to normal uv sync"
200+ uv sync --extra dev --find-links "${WHEEL_CACHE_DIR}"
201+ fi
202+
203+ - name : Run tests and update README (--update)
204+ run : xvfb-run -a ./scripts/runtest.sh --update
205+
98206 - name : Commit and push updated README
99- if : github.ref == 'refs/heads/main' && github.event_name == 'push'
100207 run : |
101208 git config --global user.name "github-actions"
102209 git config --global user.email "github-actions@github.com"
103210
104211 git add README.md
105212
106213 if git diff --cached --quiet; then
107- echo "No changes to commit"
214+ echo "No README changes to commit"
108215 else
109216 git commit -m "chore: update badges [skip ci]"
110217 git push
111- fi
218+ fi
219+
220+ - name : Build (placeholder)
221+ run : echo "Build scripts are not ready yet."
222+
223+ release :
224+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
225+ runs-on : ubuntu-latest
226+
227+ steps :
228+ - uses : actions/checkout@v4
229+ with :
230+ fetch-depth : 0
231+
232+ - name : Set up Python
233+ uses : actions/setup-python@v5
234+ with :
235+ python-version : ${{ env.PYTHON_VERSION }}
236+
237+ - name : Build (placeholder)
238+ run : echo "Build scripts are not ready yet."
239+
240+ - name : Read version from pyproject.toml
241+ id : version
242+ run : |
243+ version=$(python -c "import tomllib; from pathlib import Path; data = tomllib.loads(Path('pyproject.toml').read_text()); project = data.get('project', {}); version = project.get('version', '').strip(); print(version) if version else (_ for _ in ()).throw(SystemExit('Missing project.version in pyproject.toml'))")
244+ echo "version=${version}" >> "$GITHUB_OUTPUT"
245+
246+ - name : Create and push tag
247+ env :
248+ VERSION : ${{ steps.version.outputs.version }}
249+ run : |
250+ tag="v${VERSION}"
251+
252+ if git rev-parse "$tag" >/dev/null 2>&1; then
253+ echo "Tag $tag already exists"
254+ else
255+ git tag "$tag"
256+ git push origin "$tag"
257+ fi
258+
259+ - name : Create published release with autogenerated notes
260+ env :
261+ GH_TOKEN : ${{ github.token }}
262+ VERSION : ${{ steps.version.outputs.version }}
263+ run : |
264+ tag="v${VERSION}"
265+
266+ if gh release view "$tag" >/dev/null 2>&1; then
267+ echo "Release $tag already exists"
268+ else
269+ gh release create "$tag" --generate-notes --title "$tag"
270+ fi
0 commit comments