Skip to content

Commit d2830e0

Browse files
committed
ci: temporarily run the tox workflow on PR 1's tox.ini
Not for merging. Adds the `tox` workflow, with a `push` trigger limited to this side branch, and a `[gh]` mapping in `tox.ini`, so the workflow can test the tox configuration as it is before the move into `pyproject.toml`.
1 parent 84ed4f2 commit d2830e0

2 files changed

Lines changed: 136 additions & 0 deletions

File tree

‎.github/workflows/tox.yml‎

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: tox
2+
3+
# The main CI does not use tox, so this checks that the tox configuration still
4+
# works, including with new releases of tox and virtualenv. That is too slow to
5+
# run on every push and pull request, so it runs weekly and on demand.
6+
on:
7+
push:
8+
branches: [claude/tox-fix-environments-ci-test] # TEMPORARY: only to test PR 1's tox.ini.
9+
schedule:
10+
- cron: "37 5 * * 1" # Mondays at 05:37 UTC.
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
tox:
18+
name: tox (${{ matrix.python-version }})
19+
20+
strategy:
21+
matrix:
22+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
23+
include:
24+
# setup-python has no builds of these versions for Ubuntu 26.04.
25+
- python-version: "3.8"
26+
os: ubuntu-24.04
27+
- python-version: "3.9"
28+
os: ubuntu-24.04
29+
30+
fail-fast: false
31+
32+
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
33+
timeout-minutes: 60
34+
35+
defaults:
36+
run:
37+
shell: bash --noprofile --norc -exo pipefail {0}
38+
39+
steps:
40+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
41+
with:
42+
fetch-depth: 0
43+
persist-credentials: false
44+
45+
- name: Set up Python ${{ matrix.python-version }}, and Python 3.13 for tox
46+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
47+
with:
48+
# Current tox does not run on some of the versions it tests, so it gets
49+
# its own interpreter. The last version listed becomes the default.
50+
python-version: |
51+
3.13
52+
${{ matrix.python-version }}
53+
allow-prereleases: true
54+
55+
- name: Prepare Rust for GixPython source builds
56+
run: |
57+
# GixPython 0.3.0 publishes macOS wheels only and needs Rust >= 1.89.
58+
rustup toolchain install stable --profile minimal
59+
rustup default stable
60+
rustc --version
61+
62+
- name: Install current Git
63+
run: |
64+
sudo add-apt-repository --yes ppa:git-core/ppa
65+
sudo apt-get update
66+
sudo apt-get install --yes git
67+
68+
- name: Prepare this repo for tests
69+
run: |
70+
./init-tests-after-clone.sh
71+
72+
- name: Set git user identity and command aliases for the tests
73+
run: |
74+
git config --global user.email "travis@ci.com"
75+
git config --global user.name "Travis Runner"
76+
# If we rewrite the user's config by accident, we will mess it up
77+
# and cause subsequent tests to fail
78+
cat test/fixtures/.gitconfig >> ~/.gitconfig
79+
80+
- name: Install tox
81+
# Unpinned on purpose, to find out when a new tox breaks the configuration.
82+
run: |
83+
python3.13 -m pip install tox tox-gh
84+
85+
- name: Show version and platform information
86+
run: |
87+
uname -a
88+
git version
89+
python --version
90+
python3.13 -m tox --version
91+
92+
- name: Run tox
93+
id: tox
94+
run: |
95+
# Fail, rather than skip, if an environment's Python is missing.
96+
python3.13 -m tox --skip-missing-interpreters=false
97+
env:
98+
# tox-gh selects the environments mapped to this version in `[tool.tox.gh.python]`.
99+
TOX_GH_MAJOR_MINOR: ${{ matrix.python-version }}
100+
101+
- name: Check that each tox environment used the expected Python
102+
# Also check if tox failed, so a wrong interpreter is reported either way.
103+
if: ${{ !cancelled() && steps.tox.outcome != 'skipped' }}
104+
run: |
105+
# A pyXY environment must use Python X.Y. Every other environment that
106+
# tox-gh ran in this job must use the job's Python version.
107+
shopt -s nullglob
108+
status=0
109+
count=0
110+
for env in .tox/*/; do # Hidden packaging environments like .pkg are not matched.
111+
name="$(basename "$env")"
112+
case "$name" in
113+
py3*) want="3.${name#py3}" ;;
114+
*) want="$PYTHON_VERSION" ;;
115+
esac
116+
got="$("$env/bin/python" -c 'import sys; print("%d.%d" % sys.version_info[:2])')"
117+
echo "$name: Python $got (expected $want)"
118+
if [[ "$got" != "$want" ]]; then status=1; fi
119+
count=$((count + 1))
120+
done
121+
if ((count == 0)); then echo 'No tox environments found.' >&2; status=1; fi
122+
exit "$status"
123+
env:
124+
PYTHON_VERSION: ${{ matrix.python-version }}

‎tox.ini‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,15 @@ deps = pre-commit
7878
set_env =
7979
SKIP = ruff-format,ruff-check
8080
commands = pre-commit run --all-files
81+
82+
# TEMPORARY: for testing with the tox workflow only.
83+
[gh]
84+
python =
85+
3.8 = py38
86+
3.9 = py39
87+
3.10 = py310
88+
3.11 = py311
89+
3.12 = py312
90+
3.13 = py313, gix, ruff, format, mypy, html, misc
91+
3.14 = py314
92+
3.15 = py315

0 commit comments

Comments
 (0)