Skip to content

Commit 2603640

Browse files
committed
Streamline GitHub Actions CI workflow
- consolidate duplicate lint and PR workflows - run strict linting, type checking, and tests - test against Python 3.10 through 3.14 - install dependencies from Pipfile.lock - add caching, timeouts, minimal permissions, and concurrency control - remove ignored failures and fragile changed-file logic
1 parent dd1bfbe commit 2603640

2 files changed

Lines changed: 54 additions & 319 deletions

File tree

.github/workflows/lint_pr.yml

Lines changed: 0 additions & 289 deletions
This file was deleted.

.github/workflows/lint_python.yml

Lines changed: 54 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,62 @@
1-
name: lint_python
2-
on: [pull_request, push]
1+
name: Python CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
concurrency:
11+
group: python-ci-${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
314
jobs:
4-
lint_python:
15+
quality:
16+
name: Lint, type-check, and test
517
runs-on: ubuntu-24.04
18+
timeout-minutes: 15
619
steps:
720
- uses: actions/checkout@v6
21+
822
- uses: actions/setup-python@v6
923
with:
10-
python-version: 3.12
11-
- name: Install dependencies
24+
python-version: "3.12"
25+
cache: pip
26+
cache-dependency-path: Pipfile.lock
27+
28+
- name: Run quality checks
29+
run: ./lint.sh
30+
31+
tests:
32+
name: Test on Python ${{ matrix.python-version }}
33+
runs-on: ubuntu-24.04
34+
timeout-minutes: 15
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
python-version:
39+
- "3.10"
40+
- "3.11"
41+
- "3.12"
42+
- "3.13"
43+
- "3.14"
44+
steps:
45+
- uses: actions/checkout@v6
46+
47+
- uses: actions/setup-python@v6
48+
with:
49+
python-version: ${{ matrix.python-version }}
50+
cache: pip
51+
cache-dependency-path: Pipfile.lock
52+
53+
- name: Install locked dependencies
1254
run: |
1355
python -m pip install --upgrade pip
14-
pip install pipenv
15-
pipenv sync --dev --system
16-
pip install --no-build-isolation --no-deps -e .
17-
- name: Lint with flake8
18-
run: flake8 ./patterns --count --show-source --statistics
19-
continue-on-error: true
20-
- name: Format check with isort and black
21-
run: |
22-
isort --profile black --check ./patterns
23-
black --check ./patterns
24-
continue-on-error: true
25-
- name: Type check with mypy
26-
run: mypy --ignore-missing-imports ./patterns || true
27-
continue-on-error: true
28-
- name: Run tests with pytest
29-
run: |
30-
pytest ./patterns
31-
pytest --doctest-modules ./patterns || true
32-
continue-on-error: true
33-
- name: Check Python version compatibility
34-
run: shopt -s globstar && pyupgrade --py310-plus ./patterns/**/*.py
35-
continue-on-error: true
36-
- name: Run tox
37-
run: tox
38-
continue-on-error: true
56+
python -m pip install pipenv
57+
pipenv requirements --dev > "${RUNNER_TEMP}/requirements-dev.txt"
58+
python -m pip install -r "${RUNNER_TEMP}/requirements-dev.txt"
59+
python -m pip install --no-build-isolation --no-deps -e .
60+
61+
- name: Run tests
62+
run: python -m pytest tests patterns

0 commit comments

Comments
 (0)