From 6a0a597f73e4a327f6d41516a16b938900e26906 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Mon, 27 Jul 2026 13:23:53 +0200 Subject: [PATCH] CI: Run Python tests and packaging on GitHub Actions This uses a build matrix to easily run for all the Python targets we want it for. --- .github/workflows/test.yml | 88 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c5093e2fe2..fbdd86e8a0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -220,6 +220,94 @@ jobs: run: | make linkcheck-raw + test-python: + runs-on: ${{ matrix.os }} + needs: [decide-runs] + if: needs.decide-runs.outputs.rust-changed == 'true' || needs.decide-runs.outputs.python-changed == 'true' + strategy: + fail-fast: false + matrix: + include: + - python-version: "3.9" + os: ubuntu-latest + - python-version: "3.10" + os: ubuntu-latest + - python-version: "3.11" + os: ubuntu-latest + - python-version: "3.12" + os: ubuntu-latest + - python-version: "3.9" + os: windows-latest + steps: + - *checkout + + - name: Set up Rust + uses: dtolnay/rust-toolchain@stable + + - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 + + - name: Set up Python + id: setup_python + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: | + glean-core/python/requirements_dev.txt + + - name: Python tests + if: runner.os != 'Windows' + run: | + make test-python + + - name: "Python tests (Windows)" + if: runner.os == 'Windows' + run: | + python3 -m venv venv + .\venv\Scripts\pip install --upgrade wheel setuptools + .\venv\Scripts\pip install -r glean-core\python\requirements_dev.txt + .\venv\Scripts\pip install -e . + + .\venv\Scripts\py.test -v glean-core\python\tests + + packaging-python-aarch64: + runs-on: ubuntu-latest + needs: [decide-runs] + if: needs.decide-runs.outputs.rust-changed == 'true' || needs.decide-runs.outputs.python-changed == 'true' + steps: + - *checkout + + - name: Set up Rust + uses: dtolnay/rust-toolchain@stable + + - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 + + - name: Set up Python + id: setup_python + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 + with: + python-version: "3.13" + cache: 'pip' + cache-dependency-path: | + glean-core/python/requirements_dev.txt + + - name: Setup Python env + run: | + make setup-python + .venv3.13/bin/pip install ziglang==0.15.2 + - name: Install additional targets + run: | + rustup target add aarch64-unknown-linux-gnu + rustup target add aarch64-pc-windows-gnullvm + - name: Build Python packages + run: | + . .venv3.13/bin/activate + + TARGETS="aarch64-unknown-linux-gnu aarch64-pc-windows-gnullvm" + for target in $TARGETS; do + make build-python-wheel GLEAN_BUILD_TARGET="$target" GLEAN_BUILD_EXTRA="--zig" + done + lint-yaml: runs-on: ubuntu-latest needs: [decide-runs]