1717jobs :
1818 prepare-base :
1919 name : Prepare base dependencies
20- runs-on : ubuntu-latest
20+ runs-on : &runs-on-ubuntu ubuntu-latest
2121 outputs :
2222 python-key : ${{ steps.generate-python-key.outputs.key }}
2323 pre-commit-key : ${{ steps.generate-pre-commit-key.outputs.key }}
2424 steps :
25- - name : Check out code from GitHub
25+ - &checkout
26+ name : Check out code from GitHub
262727- - name : Set up Python ${{ env.DEFAULT_PYTHON }}
28+ - &setup-python-default
29+ name : Set up Python ${{ env.DEFAULT_PYTHON }}
2830 id : python
29- 31+ uses :
&actions-setup-python actions/[email protected] 3032 with :
3133 python-version : ${{ env.DEFAULT_PYTHON }}
3234 check-latest : true
3840 'requirements_test_pre_commit.txt') }}" >> $GITHUB_OUTPUT
3941 - name : Restore Python virtual environment
4042 id : cache-venv
41- 43+ uses :
&actions-cache actions/[email protected] 4244 with :
4345 path : venv
4446 key : >-
@@ -50,17 +52,17 @@ jobs:
5052 run : |
5153 python -m venv venv
5254 . venv/bin/activate
53- python -m pip install -U pip setuptools wheel
55+ python -m pip install -U pip
5456 pip install -U -r requirements.txt -r requirements_test.txt
55- pip install -e .
57+ pip install .
5658 - name : Generate pre-commit restore key
5759 id : generate-pre-commit-key
5860 run : >-
5961 echo "key=pre-commit-${{ env.CACHE_VERSION }}-${{
6062 hashFiles('.pre-commit-config.yaml') }}" >> $GITHUB_OUTPUT
6163 - name : Restore pre-commit environment
6264 id : cache-precommit
63- uses : actions/ cache@v4.2.4
65+ uses : * actions- cache
6466 with :
6567 path : ${{ env.PRE_COMMIT_CACHE }}
6668 key : >-
@@ -86,20 +88,15 @@ jobs:
8688
8789 formatting :
8890 name : Run pre-commit checks
89- runs-on : ubuntu-latest
90- needs : prepare-base
91+ runs-on : *runs-on-ubuntu
92+ needs : &needs-base [ prepare-base]
9193 steps :
92- - name : Check out code from GitHub
93- 94- - name : Set up Python ${{ env.DEFAULT_PYTHON }}
95- id : python
96- 97- with :
98- python-version : ${{ env.DEFAULT_PYTHON }}
99- check-latest : true
100- - name : Restore Python virtual environment
94+ - *checkout
95+ - *setup-python-default
96+ - &cache-restore-python-base
97+ name : Restore Python virtual environment
10198 id : cache-venv
102- uses :
actions/cache/[email protected] 99+ uses :
&actions-cache-restore actions/cache/[email protected] 103100 with :
104101 fail-on-cache-miss : true
105102 path : venv
@@ -108,7 +105,7 @@ jobs:
108105 needs.prepare-base.outputs.python-key }}
109106 - name : Restore pre-commit environment
110107 id : cache-precommit
111- uses : actions/ cache/ restore@v4.2.4
108+ uses : * actions- cache- restore
112109 with :
113110 fail-on-cache-miss : true
114111 path : ${{ env.PRE_COMMIT_CACHE }}
@@ -122,53 +119,25 @@ jobs:
122119
123120 pylint :
124121 name : Check pylint
125- runs-on : ubuntu-latest
126- needs : prepare -base
122+ runs-on : *runs-on-ubuntu
123+ needs : *needs -base
127124 steps :
128- - name : Check out code from GitHub
129- 130- - name : Set up Python ${{ env.DEFAULT_PYTHON }}
131- id : python
132- 133- with :
134- python-version : ${{ env.DEFAULT_PYTHON }}
135- check-latest : true
136- - name : Restore Python virtual environment
137- id : cache-venv
138- uses :
actions/cache/[email protected] 139- with :
140- fail-on-cache-miss : true
141- path : venv
142- key : ${{ runner.os }}-${{ runner.arch }}-${{
143- steps.python.outputs.python-version }}-${{
144- needs.prepare-base.outputs.python-key }}
125+ - *checkout
126+ - *setup-python-default
127+ - *cache-restore-python-base
145128 - name : Run pylint
146129 run : |
147130 . venv/bin/activate
148131 pylint ${{ env.LIB_FOLDER }} tests
149132
150133 mypy :
151134 name : Check mypy
152- runs-on : ubuntu-latest
153- needs : prepare -base
135+ runs-on : *runs-on-ubuntu
136+ needs : *needs -base
154137 steps :
155- - name : Check out code from GitHub
156- 157- - name : Set up Python ${{ env.DEFAULT_PYTHON }}
158- id : python
159- 160- with :
161- python-version : ${{ env.DEFAULT_PYTHON }}
162- check-latest : true
163- - name : Restore Python virtual environment
164- id : cache-venv
165- uses :
actions/cache/[email protected] 166- with :
167- fail-on-cache-miss : true
168- path : venv
169- key : ${{ runner.os }}-${{ runner.arch }}-${{
170- steps.python.outputs.python-version }}-${{
171- needs.prepare-base.outputs.python-key }}
138+ - *checkout
139+ - *setup-python-default
140+ - *cache-restore-python-base
172141 - name : Run mypy
173142 run : |
174143 . venv/bin/activate
@@ -177,18 +146,17 @@ jobs:
177146
178147 pytest-linux :
179148 name : Run tests Python ${{ matrix.python-version }} (Linux)
180- runs-on : ubuntu-latest
149+ runs-on : *runs-on-ubuntu
181150 strategy :
182151 matrix :
183152 python-version : ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
184153 outputs :
185154 python-key : ${{ steps.generate-python-key.outputs.key }}
186155 steps :
187- - name : Check out code from GitHub
188- 156+ - *checkout
189157 - name : Set up Python ${{ matrix.python-version }}
190158 id : python
191- uses : actions/ setup-python@v6.0.0
159+ uses : * actions- setup-python
192160 with :
193161 python-version : ${{ matrix.python-version }}
194162 allow-prereleases : true
@@ -201,7 +169,7 @@ jobs:
201169 'requirements_test_pre_commit.txt') }}" >> $GITHUB_OUTPUT
202170 - name : Restore Python virtual environment
203171 id : cache-venv
204- uses : actions/ cache@v4.2.4
172+ uses : * actions- cache
205173 with :
206174 path : venv
207175 key : >-
@@ -213,9 +181,9 @@ jobs:
213181 run : |
214182 python -m venv venv
215183 . venv/bin/activate
216- python -m pip install -U pip setuptools wheel
184+ python -m pip install -U pip
217185 pip install -U -r requirements.txt -r requirements_test.txt
218- pip install -e .
186+ pip install .
219187 - name : Run pytest
220188 run : |
221189 . venv/bin/activate
0 commit comments