Skip to content

Commit e9861ec

Browse files
committed
Rewrite CI: use reusable actions, native arm and faster PR testing
This commit rewrites the CI configuration to use reusable actions for testing with nox and setting up Python. It also uses the new native arm runners, upgrade to use the Ubuntu 22.04 GitHub runner and split the CI into two workflows: one for PRs and one for pushes. The PR workflow only runs the nox tests for the default Python version and test the documentation website generation, so it should be much quicker. When pushing (to any branch, including merge queues, and tags), a more through CI is run, including all the nox sessions for all supported Python versions, archs and OSes, building the distribution packages, testing the installation of the built packages, publishing the documentation website, creating a GitHub release and publishing the packages to PyPI. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 19c0dbd commit e9861ec

File tree

2 files changed

+119
-223
lines changed

2 files changed

+119
-223
lines changed

.github/workflows/ci-pr.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Test PR
2+
3+
on: pull_request
4+
5+
env:
6+
# Please make sure this version is included in the `matrix`, as the
7+
# `matrix` section can't use `env`, so it must be entered manually
8+
DEFAULT_PYTHON_VERSION: '3.11'
9+
# It would be nice to be able to also define a DEFAULT_UBUNTU_VERSION
10+
# but sadly `env` can't be used either in `runs-on`.
11+
12+
jobs:
13+
nox:
14+
name: Test with nox
15+
runs-on: ubuntu-22.04
16+
17+
steps:
18+
- name: Run nox
19+
uses: frequenz-floss/[email protected]
20+
with:
21+
python-version: "3.11"
22+
nox-session: ci_checks_max
23+
24+
test-docs:
25+
name: Test documentation website generation
26+
runs-on: ubuntu-22.04
27+
steps:
28+
- name: Setup Git
29+
uses: frequenz-floss/[email protected]
30+
31+
- name: Fetch sources
32+
uses: actions/checkout@v4
33+
with:
34+
submodules: true
35+
36+
- name: Setup Python
37+
uses: frequenz-floss/[email protected]
38+
with:
39+
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
40+
dependencies: .[dev-mkdocs]
41+
42+
- name: Generate the documentation
43+
env:
44+
MIKE_VERSION: gh-${{ github.job }}
45+
run: |
46+
mike deploy $MIKE_VERSION
47+
mike set-default $MIKE_VERSION
48+
49+
- name: Upload site
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: docs-site
53+
path: site/
54+
if-no-files-found: error

0 commit comments

Comments
 (0)