Skip to content

Commit 4a3f1f6

Browse files
codexByron
authored andcommitted
ci: run fixture suites with GixPython on supported interpreters
The CLI and Gix test suites now both need GixPython for scripted fixtures. Install the released GixPython 0.2.0 dependency and explicitly select each job's backend, verifying that `gix.testtools` imports before pytest runs. Run the full matrix on Python 3.11+ and retain installation/import smoke jobs for Python 3.8–3.10 across Linux, macOS and Windows. Keep a Python 3.12 Gix job on each platform alongside the CLI combinations. Prepare stable Rust and cache Cargo dependencies, build outputs and pip wheels for both backends, because Linux and Windows build GixPython from source. Keep build outputs outside pip's temporary directory. Add Bash, Rust, Cargo and compiler/Python headers to Alpine, and prepare fixture tooling in the minimum-Git CLI workflow too. Actionlint and whitespace checks passed. Matrix inspection confirms 19 CLI fixture jobs, three Gix jobs and nine older-interpreter smoke jobs. The complete fixture suites passed locally on macOS with CPython 3.12; hosted CI and the other interpreter/platform combinations have not been executed for this update.
1 parent 1e92aac commit 4a3f1f6

4 files changed

Lines changed: 96 additions & 21 deletions

File tree

‎.github/workflows/alpine-test.yml‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ permissions:
1212
jobs:
1313
test:
1414
runs-on: ubuntu-latest
15+
env:
16+
GIT_PYTHON_BACKEND: cli
1517

1618
container:
1719
image: alpine:latest
@@ -23,8 +25,8 @@ jobs:
2325
steps:
2426
- name: Prepare Alpine Linux
2527
run: |
26-
apk add sudo git git-daemon python3 py3-pip py3-virtualenv
27-
echo 'Defaults env_keep += "CI GITHUB_* RUNNER_*"' >/etc/sudoers.d/ci_env
28+
apk add sudo git git-daemon bash rust cargo build-base python3 python3-dev py3-pip py3-virtualenv
29+
echo 'Defaults env_keep += "CI GITHUB_* RUNNER_* GIT_PYTHON_BACKEND"' >/etc/sudoers.d/ci_env
2830
addgroup -g 127 docker
2931
adduser -D -u 1001 runner # TODO: Check if this still works on GHA as intended.
3032
adduser runner docker
@@ -64,6 +66,7 @@ jobs:
6466
run: |
6567
. .venv/bin/activate
6668
pip install ./smmap ./gitdb '.[test]'
69+
python -c 'from gix import testtools'
6770
6871
- name: Show POSIX file ownership
6972
run: |

‎.github/workflows/git-cli.yml‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ permissions:
1212
jobs:
1313
git-2-52:
1414
runs-on: ubuntu-latest
15+
env:
16+
GIT_PYTHON_BACKEND: cli
1517
steps:
1618
- uses: actions/checkout@v7
1719
- uses: actions/checkout@v7
@@ -27,8 +29,24 @@ jobs:
2729
run: |
2830
make -j2 prefix="$RUNNER_TEMP/git" NO_GETTEXT=YesPlease NO_TCLTK=YesPlease NO_PERL=YesPlease NO_CURL=YesPlease install
2931
echo "$RUNNER_TEMP/git/bin" >> "$GITHUB_PATH"
32+
- name: Prepare Rust for fixture tooling
33+
run: |
34+
rustup update stable
35+
rustup default stable
36+
echo "CARGO_TARGET_DIR=$RUNNER_TEMP/gix-target" >> "$GITHUB_ENV"
37+
- name: Cache GixPython builds
38+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
39+
with:
40+
path: |
41+
~/.cargo/registry
42+
~/.cargo/git
43+
${{ runner.temp }}/gix-target
44+
~/.cache/pip
45+
key: minimum-git-gix-${{ runner.os }}-${{ hashFiles('gix-requirements.txt') }}
3046
- name: Install GitPython and test dependencies
31-
run: python -m pip install ./smmap ./gitdb '.[test]'
47+
run: |
48+
python -m pip install ./smmap ./gitdb '.[test]'
49+
python -c 'from gix import testtools'
3250
- name: Verify native format and safety contracts
3351
env:
3452
GIT_CONFIG_NOSYSTEM: '1'

‎.github/workflows/pythonpackage.yml‎

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
matrix:
2020
os-type: [ubuntu, macos, windows]
21-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t", "3.15", "3.15t"]
21+
python-version: ["3.11", "3.12", "3.13", "3.14", "3.14t", "3.15", "3.15t"]
2222
backend: [cli]
2323
exclude:
2424
- os-type: macos
@@ -27,13 +27,21 @@ jobs:
2727
python-version: "3.15t"
2828
include:
2929
- build-docs: true # We ensure documentation builds, except on very old interpreters.
30-
- python-version: "3.8"
31-
build-docs: false
3230
- experimental: false
3331
- python-version: "3.15"
3432
experimental: true
3533
- python-version: "3.15t"
3634
experimental: true
35+
- os-type: ubuntu
36+
python-version: "3.12"
37+
backend: gix
38+
build-docs: false
39+
experimental: false
40+
- os-type: macos
41+
python-version: "3.12"
42+
backend: gix
43+
build-docs: false
44+
experimental: false
3745
- os-type: windows
3846
python-version: "3.12"
3947
backend: gix
@@ -43,6 +51,8 @@ jobs:
4351
fail-fast: false
4452

4553
runs-on: ${{ matrix.os-type }}-latest
54+
env:
55+
GIT_PYTHON_BACKEND: ${{ matrix.backend }}
4656

4757
defaults:
4858
run:
@@ -58,20 +68,32 @@ jobs:
5868
with:
5969
python-version: ${{ matrix.python-version }}
6070
allow-prereleases: ${{ matrix.experimental }}
61-
cache: ${{ matrix.backend == 'gix' && 'pip' || '' }}
71+
cache: pip
6272
cache-dependency-path: |
6373
pyproject.toml
6474
requirements.txt
6575
test-requirements.txt
6676
gix-requirements.txt
6777
68-
- name: Prepare Rust for GixPython's Windows source build
69-
if: matrix.backend == 'gix'
78+
- name: Prepare Rust for GixPython source builds
79+
id: rust
7080
run: |
71-
# GixPython 0.1.0 publishes macOS wheels only and needs Rust >= 1.89.
81+
# GixPython 0.2.0 publishes macOS wheels only and needs Rust >= 1.89.
7282
rustup toolchain install stable --profile minimal
7383
rustup default stable
7484
rustc --version
85+
echo "version=$(rustc --version)" >> "$GITHUB_OUTPUT"
86+
87+
- name: Cache GixPython Cargo dependencies and build output
88+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
89+
with:
90+
path: |
91+
~/.cargo/registry
92+
~/.cargo/git
93+
${{ runner.temp }}/gix-target
94+
key: gix-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ steps.rust.outputs.version }}-${{ hashFiles('gix-requirements.txt') }}
95+
restore-keys: |
96+
gix-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ steps.rust.outputs.version }}-
7597
7698
- name: Set up WSL (Windows)
7799
if: matrix.os-type == 'windows'
@@ -111,10 +133,12 @@ jobs:
111133
- name: Install project and test dependencies
112134
run: |
113135
pip install ./smmap ./gitdb ".[${EXTRAS}]"
114-
python -c 'import os; from git import _backend; print("Backend:", _backend.name); assert _backend.name == os.environ["EXPECTED_BACKEND"]'
136+
python -c 'import os; from gix import testtools; from git import _backend; print("Backend:", _backend.name); assert _backend.name == os.environ["EXPECTED_BACKEND"]'
115137
env:
116138
EXTRAS: ${{ matrix.backend == 'gix' && 'test,gix' || 'test' }}
117139
EXPECTED_BACKEND: ${{ matrix.backend }}
140+
# Keep Cargo output when pip removes its temporary source directory.
141+
CARGO_TARGET_DIR: ${{ runner.temp }}/gix-target
118142

119143
- name: Show POSIX file ownership
120144
# Linux and macOS only. On Windows, Git Bash's `ls -ld` reports a
@@ -213,3 +237,23 @@ jobs:
213237
run: |
214238
pip install --group doc
215239
make -C doc html
240+
241+
import-smoke:
242+
name: install/import (${{ matrix.os }}, ${{ matrix.python }})
243+
runs-on: ${{ matrix.os }}
244+
strategy:
245+
fail-fast: false
246+
matrix:
247+
os: [ubuntu-latest, macos-latest, windows-latest]
248+
python: ["3.8", "3.9", "3.10"]
249+
env:
250+
GIT_PYTHON_BACKEND: cli
251+
steps:
252+
- uses: actions/checkout@v7
253+
- uses: actions/setup-python@v7
254+
with:
255+
python-version: ${{ matrix.python }}
256+
- name: Install the supported runtime
257+
run: python -m pip install .
258+
- name: Import the installed package
259+
run: python -I -c "import git; from git import _backend; assert _backend.name == 'cli'; print(git.__version__)"

‎doc/gix-backend.md‎

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ uv pip install --python .tox/gix/bin/python --editable '.[test,gix]'
1818

1919
GixPython 0.1.0 publishes macOS wheels. On Windows and Linux, installation
2020
builds the released source distribution and requires Rust 1.89 or newer and
21-
a platform C/C++ toolchain. Windows CI uses the runner's MSVC tools and a
22-
stable Rust toolchain, with pip's built-wheel cache enabled.
21+
a platform C/C++ toolchain. The full-suite Gix CI jobs prepare a stable Rust
22+
toolchain and cache pip's built wheels, Cargo dependencies and compilation
23+
output.
2324

2425
Python extras add dependencies; they do not leave a runtime feature bit.
2526
Set `GIT_PYTHON_BACKEND=cli` or `GIT_PYTHON_BACKEND=gix` before importing
@@ -851,16 +852,25 @@ Add each conversion with a no-subprocess check and a Git parity check where
851852
practical, in its own commit. Update this ledger when a limitation changes;
852853
the runtime report's reason should point to the corresponding entry.
853854

854-
## Windows validation
855+
## CI coverage
855856

856-
The [Python package workflow](../.github/workflows/pythonpackage.yml) adds a
857-
Windows/Python 3.12 Gix job while preserving all 28 CLI combinations and their
858-
existing check names. It installs `.[test,gix]`, verifies the selected backend
859-
and runs the full suite
860-
with the same coverage and pytest options. Every job retains JUnit results
857+
The [Python package workflow](../.github/workflows/pythonpackage.yml) adds one
858+
Python 3.12 Gix job each on Ubuntu, macOS and Windows, preserving all 28 CLI
859+
combinations and their existing check names. It installs `.[test,gix]`, verifies
860+
the selected backend and runs the full suite with the same coverage and pytest
861+
options. Every job retains JUnit results
861862
and `--backend-report` operation counts under its `tests-OS-PYTHON-BACKEND`
862-
artifact, and prints the 30 slowest test durations. The extra Gix job does not
863-
duplicate the documentation build.
863+
artifact, and prints the 30 slowest test durations. The extra Gix jobs do not
864+
duplicate the documentation build. Their check names include `gix`, such as
865+
`test (ubuntu, 3.12, gix)`.
866+
867+
On platforms without a matching wheel, pip builds the official source release.
868+
`CARGO_TARGET_DIR` keeps compilation output outside pip's temporary source
869+
directory. The Cargo cache distinguishes OS, architecture, Python and Rust
870+
versions and `gix-requirements.txt`; a release change can reuse dependencies
871+
from the same platform and toolchain.
872+
873+
## Windows validation
864874

865875
Local Windows checks use CPython 3.12.13, Git 2.55.0.windows.3 and GixPython
866876
0.1.0 built from the released source distribution. The installed extension

0 commit comments

Comments
 (0)