Skip to content

Commit c14cbe7

Browse files
committed
Fixup broken CI
Around the beginning of 2025, the `ubuntu-latest` runner image which [this project uses][1], [was changed from Ubuntu 22.04 to 24.04][2]. As a result, the python version which is used by this repo's GitHub actions changed from [3.10.12][3] to [3.12.3][4]. With this change to Python 3.12, [PEP 668][5] was introduced. This new Python behavior is causing errors in the CI and `pip` is exiting non-zero ``` error: externally-managed-environment × This environment is externally managed ╰─> To install Python packages system-wide, try apt install     python3-xyz, where xyz is the package you are trying to     install.     If you wish to install a non-Debian-packaged Python package,     create a virtual environment using python3 -m venv path/to/venv.     Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make     sure you have python3-full installed.     If you wish to install a non-Debian packaged Python application,     it may be easiest to use pipx install xyz, which will manage a     virtual environment for you. Make sure you have pipx installed.     See /usr/share/doc/python3.13/README.venv for more information. ``` This commit changes the CI to use virtualenvs to address this externally-managed-environment problem. This also fixes up or updates CI by * Changing the build image from Ubuntu 20.04 to 24.04 * Updating the list of Python versions tested to just the current supported Python versions * Updating the versions of the `checkout` and `setup-python` actions * Anchoring the install image to Ubuntu 24.04 (instead of `latest`) to prevent this type of thing in the future * Updating container OSes for install   * CentOS Stream 8 to CentOS Stream 9 as Stream 8 is end of lifed   * Ubuntu focatl to noble [1]: https://github.com/systemd/python-systemd/blob/903142423452c4dd18110b7f8a953dabb2031e49/.github/workflows/install.yml#L17 [2]: actions/runner-images#10636 [3]: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#installed-software [4]: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#language-and-runtime [5]: https://peps.python.org/pep-0668/
1 parent 9031424 commit c14cbe7

File tree

3 files changed

+30
-16
lines changed

3 files changed

+30
-16
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,50 @@ permissions:
1414

1515
jobs:
1616
build:
17-
runs-on: ubuntu-20.04
17+
runs-on: ubuntu-24.04
1818
concurrency:
1919
group: ${{ github.workflow }}-${{ matrix.python }}-${{ github.ref }}
2020
cancel-in-progress: true
2121
strategy:
2222
fail-fast: false
2323
matrix:
2424
python: [
25-
"3.7",
26-
"3.8",
2725
"3.9",
2826
"3.10",
29-
"3.11.0-rc.1",
27+
"3.11",
28+
"3.12",
29+
"3.13"
3030
]
3131
name: Python ${{ matrix.python }}
3232
steps:
3333
- name: Repository checkout
34-
uses: actions/checkout@v2
34+
uses: actions/checkout@v4
3535

3636
- name: Configure Python ${{ matrix.python }}
37-
uses: actions/setup-python@v2
37+
uses: actions/setup-python@v5
3838
with:
3939
python-version: ${{ matrix.python }}
4040
architecture: x64
4141

4242
- name: Install dependencies
4343
run: |
4444
sudo apt -y update
45-
sudo apt -y install gcc libsystemd-dev
46-
python -m pip install pytest sphinx
47-
45+
sudo apt -y install gcc libsystemd-dev python3-setuptools
46+
- name: Create virtualenv
47+
run: |
48+
python3 -m venv ~/${{ matrix.python }}
49+
- name: Install python dependencies
50+
run: |
51+
source ~/${{ matrix.python }}/bin/activate
52+
python3 -m pip install pytest sphinx setuptools
4853
- name: Build (Python ${{ matrix.python }})
4954
run: |
5055
set -x
56+
source ~/${{ matrix.python }}/bin/activate
5157
make -j
5258
make doc SPHINXOPTS="-W -v"
5359
5460
- name: Test (Python ${{ matrix.python }})
5561
run: |
62+
source ~/${{ matrix.python }}/bin/activate
5663
make check

.github/workflows/install.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permissions:
1414

1515
jobs:
1616
build:
17-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-24.04
1818
concurrency:
1919
group: ${{ github.workflow }}-${{ matrix.container }}-${{ github.ref }}
2020
cancel-in-progress: true
@@ -24,16 +24,16 @@ jobs:
2424
container: [
2525
"archlinux:latest",
2626
"debian:testing",
27-
"quay.io/centos/centos:stream8",
27+
"quay.io/centos/centos:stream9",
2828
"quay.io/fedora/fedora:rawhide",
29-
"ubuntu:focal",
29+
"ubuntu:noble",
3030
]
3131
container:
3232
image: ${{ matrix.container }}
3333
name: ${{ matrix.container }}
3434
steps:
3535
- name: Repository checkout
36-
uses: actions/checkout@v2
36+
uses: actions/checkout@v4
3737

3838
- name: Install dependencies
3939
shell: bash
@@ -52,14 +52,20 @@ jobs:
5252
case "$DIST_ID" in
5353
arch)
5454
pacman --noconfirm -Sy "${DEPS_COMMON[@]}" systemd-libs
55+
python3 -m venv ~/venv
56+
source ~/venv/bin/activate
5557
python3 -m ensurepip
5658
;;
5759
centos|fedora)
58-
dnf -y install "${DEPS_COMMON[@]}" systemd-devel python3-devel python3-pip
60+
dnf -y install "${DEPS_COMMON[@]}" systemd-devel python3-devel python3-pip python3-setuptools
61+
python3 -m venv ~/venv
62+
source ~/venv/bin/activate
5963
;;
6064
ubuntu|debian)
6165
apt -y update
62-
DEBIAN_FRONTEND=noninteractive apt -y install "${DEPS_COMMON[@]}" libsystemd-dev python3-dev python3-pip
66+
DEBIAN_FRONTEND=noninteractive apt -y install "${DEPS_COMMON[@]}" libsystemd-dev python3-dev python3-pip python3-setuptools python3-venv
67+
python3 -m venv ~/venv
68+
source ~/venv/bin/activate
6369
;;
6470
*)
6571
echo >&2 "Invalid distribution ID: $DISTRO_ID"
@@ -71,6 +77,7 @@ jobs:
7177
- name: Build & install
7278
shell: bash
7379
run: |
80+
source ~/venv/bin/activate
7481
set -x
7582
python3 -m pip install -I -v .
7683
# Avoid importing the systemd module from the git repository

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PYTHON = python
1+
PYTHON = python3
22
SED = sed
33
ETAGS = etags
44
INCLUDE_DIR := $(shell pkg-config --variable=includedir libsystemd)

0 commit comments

Comments
 (0)