@@ -2,57 +2,61 @@ name: Python Package Workflow
22
33on :
44 push :
5- branches : [ master ]
5+ branches :
6+ - master
67 pull_request :
7- branches : [ master ]
8+ branches :
9+ - master
10+
11+ env :
12+ PYTHON_VERSION : ' 3.11'
813
914{% raw -%}
1015jobs :
1116 build :
12-
13- runs-on : ubuntu-latest
14- strategy :
15- matrix :
16- python-version : ["3.11", "3.12", "3.13"]
17+ runs-on : ubuntu-24.04
1718
1819 steps :
19- - uses : actions/checkout@v3
20- - name : Set up Python ${{ matrix.python-version }}
21- uses : actions/setup-python@v4
22- with :
23- python-version : ${{ matrix.python-version }}
24- - name : Install dependencies
25- run : |
26- python -m pip install -U pip
27- python -m pip install .[dev]
28- - name : Cache pip dependencies
29- uses : actions/cache@v3
30- with :
31- path : ~/.cache/pip # This path is specific to Ubuntu
32- # Check for a cache hit for the corresponding pyproject.toml file
33- key : ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
34- restore-keys : |
35- ${{ runner.os }}-pip-
36- ${{ runner.os }}-
37- - name : Check code style
38- run : |
39- make check-style
40- - name : Check static analysis
41- run : |
42- make check-static-analysis
43- - name : Install package
44- run : |
45- pip install .
46- - name : Run unit tests
47- run : |
48- make test
49- - name : Generate code coverage report
50- run : |
51- make coverage
52- - name : Generate docs
53- run : |
54- make docs
55- - name : Generate package
56- run : |
57- make dist
20+ - uses : actions/checkout@v4
21+
22+ - name : Set up Python ${{ matrix.python-version }}
23+ uses : actions/setup-python@v5
24+ with :
25+ python-version : ${{ env.PYTHON_VERSION }}
26+
27+ - name : Cache pip dependencies and hatch environments
28+ id : cache
29+ uses : actions/cache@v4
30+ with :
31+ path : |
32+ ~/.cache/pip
33+ ~/.local/share/hatch
34+ ${{ env.pythonLocation }}/bin
35+ ${{ env.pythonLocation }}/lib/python${{ env.PYTHON_VERSION }}/site-packages
36+ key : ${{ runner.os }}-${{ env.PYTHON_VERSION }}-pip-hatch-${{ hashFiles('pyproject.toml') }}
37+ restore-keys : ${{ runner.os }}-${{ env.PYTHON_VERSION }}-pip-hatch-
38+
39+ - name : Install dependencies
40+ if : steps.cache.outputs.cache-hit != 'true'
41+ run : |
42+ python -m pip install -U pip
43+ python -m pip install hatch
44+
45+ - name : Check code style
46+ run : hatch run style:check
47+
48+ - name : Check type hints
49+ run : hatch run types:check
50+
51+ - name : Perform static code analysis
52+ run : hatch run lint:check
53+
54+ - name : Run unit tests
55+ run : hatch test -v --all --cover
56+
57+ - name : Generate docs
58+ run : hatch run docs:build
59+
60+ - name : Generate package
61+ run : hatch build
5862{%- endraw %}
0 commit comments