1- name : frequenz-sdk-python
1+ name : CI
22
33on :
44 merge_group :
55 pull_request :
66 push :
7+ # We need to explicitly include tags because otherwise when adding
8+ # `branches-ignore` it will only trigger on branches.
79 tags :
810 - ' *'
911 branches-ignore :
1416 workflow_dispatch :
1517
1618env :
19+ # Please make sure this version is included in the `matrix`, as the
20+ # `matrix` section can't use `env`, so it must be entered manually
1721 DEFAULT_PYTHON_VERSION : ' 3.11'
22+ # It would be nice to be able to also define a DEFAULT_UBUNTU_VERSION
23+ # but sadly `env` can't be used either in `runs-on`.
1824
1925jobs :
20- test :
26+ nox :
27+ name : Test with nox
2128 strategy :
2229 fail-fast : false
2330 matrix :
@@ -37,23 +44,19 @@ jobs:
3744 python-version : ${{ matrix.python }}
3845 cache : ' pip'
3946
40- - uses : actions/cache@v3
41- with :
42- path : ~/.cache/pip
43- key : ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('minimum-requirements-ci.txt', 'pyproject.toml') }}
44- restore-keys : |
45- ${{ runner.os }}-${{ matrix.python-version }}-pip-
46-
4747 - name : Install required Python packages
4848 run : |
4949 python -m pip install --upgrade pip
50- python -m pip install nox toml
50+ python -m pip install -e .[dev-noxfile]
5151
52- - name : run nox
52+ - name : Run nox
53+ # To speed things up a bit we use the speciall ci_checks_max session
54+ # that uses the same venv to run multiple linting sessions
5355 run : nox -e ci_checks_max pytest_min
5456 timeout-minutes : 10
5557
56- build-dist :
58+ build :
59+ name : Build distribution packages
5760 runs-on : ubuntu-20.04
5861 steps :
5962 - name : Fetch sources
@@ -62,25 +65,26 @@ jobs:
6265 - name : Set up Python
6366 uses : actions/setup-python@v4
6467 with :
65- python-version : ' 3.11 '
68+ python-version : ${{ env.DEFAULT_PYTHON_VERSION }}
6669 cache : ' pip'
6770
68- - name : Install build dependencies
71+ - name : Install required Python packages
6972 run : |
7073 python -m pip install -U pip
7174 python -m pip install -U build
7275
7376 - name : Build the source and binary distribution
7477 run : python -m build
7578
76- - name : Upload dist files
79+ - name : Upload distribution files
7780 uses : actions/upload-artifact@v3
7881 with :
79- name : frequenz-sdk-python- dist
82+ name : dist-packages
8083 path : dist/
8184 if-no-files-found : error
8285
83- test-generate-docs :
86+ test-docs :
87+ name : Test documentation website generation
8488 if : github.event_name != 'push'
8589 runs-on : ubuntu-20.04
8690 steps :
99103 - name : Install build dependencies
100104 run : |
101105 python -m pip install -U pip
102- python -m pip install .[docs-gen ]
106+ python -m pip install .[dev-mkdocs ]
103107
104108 - name : Generate the documentation
105109 env :
@@ -111,12 +115,13 @@ jobs:
111115 - name : Upload site
112116 uses : actions/upload-artifact@v3
113117 with :
114- name : frequenz-channels-python -site
118+ name : docs -site
115119 path : site/
116120 if-no-files-found : error
117121
118122 publish-docs :
119- needs : ["test", "build-dist"]
123+ name : Publish documentation website to GitHub pages
124+ needs : ["nox", "build"]
120125 if : github.event_name == 'push'
121126 runs-on : ubuntu-20.04
122127 permissions :
@@ -178,7 +183,7 @@ jobs:
178183 if : steps.mike-metadata.outputs.version
179184 run : |
180185 python -m pip install -U pip
181- python -m pip install .[docs-gen ]
186+ python -m pip install .[dev-mkdocs ]
182187
183188 - name : Fetch the gh-pages branch
184189 if : steps.mike-metadata.outputs.version
@@ -193,6 +198,7 @@ jobs:
193198 mike deploy --push --update-aliases "$VERSION" $ALIASES
194199
195200 create-github-release :
201+ name : Create GitHub release
196202 needs : ["publish-docs"]
197203 # Create a release only on tags creation
198204 if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
@@ -203,10 +209,10 @@ jobs:
203209 discussions : write
204210 runs-on : ubuntu-20.04
205211 steps :
206- - name : Download dist files
212+ - name : Download distribution files
207213 uses : actions/download-artifact@v3
208214 with :
209- name : frequenz-sdk-python- dist
215+ name : dist-packages
210216 path : dist
211217
212218 - name : Download RELEASE_NOTES.md
@@ -230,7 +236,6 @@ jobs:
230236 if echo "$REF_NAME" | grep -- -; then extra_opts=" --prerelease"; fi
231237 gh release create \
232238 -R "$REPOSITORY" \
233- --discussion-category announcements \
234239 --notes-file RELEASE_NOTES.md \
235240 --generate-notes \
236241 $extra_opts \
@@ -242,17 +247,18 @@ jobs:
242247 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
243248
244249 publish-to-pypi :
250+ name : Publish packages to PyPI
245251 needs : ["create-github-release"]
246252 runs-on : ubuntu-20.04
247253 permissions :
248254 # For trusted publishing. See:
249255 # https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/
250256 id-token : write
251257 steps :
252- - name : Download dist files
258+ - name : Download distribution files
253259 uses : actions/download-artifact@v3
254260 with :
255- name : frequenz-sdk-python- dist
261+ name : dist-packages
256262 path : dist
257263
258264 - name : Publish the Python distribution to PyPI
0 commit comments