Skip to content

Commit 4e3b82c

Browse files
committed
ci(github): de-blocking workflow on lint failure, adding test job
* tox.ini: tox-gh-actions integration * tox.ini: lint removed from envlist, default scope is test-only * workflows: test job added (matrixed) * workflows: lint job is separate without matrix and without blocking workflow on failure * workflows: reusable env lifting steps factored out into ./github/actions
1 parent 17bb7d4 commit 4e3b82c

4 files changed

Lines changed: 73 additions & 19 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Setup base (checkout, python, pip cache, tox)
2+
runs:
3+
using: "composite"
4+
steps:
5+
- uses: actions/checkout@v5
6+
- uses: actions/setup-python@v6
7+
with:
8+
python-version: ${{ inputs.python }}
9+
- uses: actions/cache@v4
10+
with:
11+
path: |
12+
~/.cache/pip
13+
key: ${{ runner.os }}-pip-${{ inputs.python }}
14+
- run: |
15+
python -m pip -q install --upgrade pip "setuptools==65.6.2"
16+
pip -q install "tox<4" tox-gh-actions
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: setup Rust and Poetry
2+
runs:
3+
using: composite
4+
steps:
5+
- name: Cargo cache
6+
uses: actions/cache/@v4
7+
with:
8+
path: "~/.cargo"
9+
key: ${{ runner.os }}-cargo
10+
- name: Poetry cache
11+
uses: actions/cache/@v4
12+
with:
13+
path: "~/.cache/pypoetry"
14+
key: ${{ runner.os }}-poetry-${{ inputs.python }}
15+
restore-keys: |
16+
${{ runner.os }}-poetry-
17+
- name: install Rust and Poetry
18+
run : |
19+
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable --profile minimal
20+
source "$HOME/.cargo/env"
21+
pip -q install poetry>=1.2.0

.github/workflows/main.yml

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,33 @@ on:
77
branches: # CI debugging
88
- "ci/**"
99
jobs:
10-
build:
11-
runs-on: ${{ matrix.os }}
10+
lint:
11+
continue-on-error: true
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: ./github/actions/setup-python-pip-tox
15+
with:
16+
python: 3.12
17+
- name: Lint
18+
run: tox -e lint
19+
test:
1220
strategy:
1321
fail-fast: false
1422
matrix:
1523
os: [ ubuntu-latest ]
16-
python: ["3.12"]
17-
include:
18-
- python: "3.12"
19-
tox_env: "lint"
24+
python:
25+
- "3.12"
26+
- "3.11"
27+
- "3.10"
28+
- "3.9.14"
29+
- "3.8"
30+
runs-on: ${{ matrix.os }}
2031
steps:
21-
- uses: actions/checkout@v2
22-
- name: Set up Python
23-
uses: actions/setup-python@v2
32+
- uses: ./github/actions/setup-python-pip-tox
33+
with:
34+
python: ${{ matrix.python }}
35+
- uses: ./github/actions/setup-rust-poetry
2436
with:
25-
python-version: ${{ matrix.python }}
26-
- name: Install tox
27-
run: |
28-
python -m pip install --upgrade pip setuptools
29-
pip install tox
37+
python: ${{ matrix.python }}
3038
- name: Test
31-
run: |
32-
tox -e ${{ matrix.tox_env }}
33-
39+
run: tox

tox.ini

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
[tox]
22
isolated_build = true
3+
34
# The *-web environments test the latest versions of Django and Flask with the full test suite. For
45
# older version of the web frameworks, just run the tests that are specific to them.
5-
envlist = py3{10,11,12}-{django5}, py3{8,9,10,11,12}-{web,django3,django4,flask2,sqlalchemy1},lint
6+
7+
# Default envlist is only for matrix testing. Linter and vendoring should be called explicitly
8+
envlist = py3{10,11,12}-{django5}, py3{8,9,10,11,12}-{web,django3,django4,flask2,sqlalchemy1}
9+
10+
[gh-actions]
11+
python =
12+
3.8: py38
13+
3.9: py39
14+
3.10: py310
15+
3.11: py311
16+
3.12: py312
617

718
[web-deps]
819
deps=
@@ -54,4 +65,4 @@ deps = vendoring
5465
commands =
5566
poetry run vendoring {posargs:sync}
5667
# We don't need the .pyi files vendoring generates
57-
python -c 'from pathlib import Path; all(map(Path.unlink, Path("vendor").rglob("*.pyi")))'
68+
python -c 'from pathlib import Path; all(map(Path.unlink, Path("vendor").rglob("*.pyi")))'

0 commit comments

Comments
 (0)