| 1 |
--- |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
name: Install test |
| 6 |
on: |
| 7 |
pull_request: |
| 8 |
push: |
| 9 |
branches: |
| 10 |
- main |
| 11 |
|
| 12 |
permissions: |
| 13 |
contents: read |
| 14 |
|
| 15 |
jobs: |
| 16 |
build: |
| 17 |
runs-on: ubuntu-latest |
| 18 |
concurrency: |
| 19 |
group: ${{ github.workflow }}-${{ matrix.container }}-${{ github.ref }} |
| 20 |
cancel-in-progress: true |
| 21 |
strategy: |
| 22 |
fail-fast: false |
| 23 |
matrix: |
| 24 |
container: [ |
| 25 |
"archlinux:latest", |
| 26 |
"debian:testing", |
| 27 |
"quay.io/centos/centos:stream8", |
| 28 |
"quay.io/fedora/fedora:rawhide", |
| 29 |
"ubuntu:focal", |
| 30 |
] |
| 31 |
container: |
| 32 |
image: ${{ matrix.container }} |
| 33 |
name: ${{ matrix.container }} |
| 34 |
steps: |
| 35 |
- name: Repository checkout |
| 36 |
uses: actions/checkout@v2 |
| 37 |
|
| 38 |
- name: Install dependencies |
| 39 |
shell: bash |
| 40 |
run: | |
| 41 |
DIST_ID="$(sed -nr 's/^ID="?(\w+)"?/\1/p' /etc/os-release)" |
| 42 |
echo "Distribution ID: $DIST_ID" |
| 43 |
|
| 44 |
DEPS_COMMON=( |
| 45 |
gcc |
| 46 |
git |
| 47 |
pkg-config |
| 48 |
python3 |
| 49 |
systemd |
| 50 |
) |
| 51 |
|
| 52 |
case "$DIST_ID" in |
| 53 |
arch) |
| 54 |
pacman --noconfirm -Sy "${DEPS_COMMON[@]}" systemd-libs |
| 55 |
python3 -m ensurepip |
| 56 |
;; |
| 57 |
centos|fedora) |
| 58 |
dnf -y install "${DEPS_COMMON[@]}" systemd-devel python3-devel python3-pip |
| 59 |
;; |
| 60 |
ubuntu|debian) |
| 61 |
apt -y update |
| 62 |
DEBIAN_FRONTEND=noninteractive apt -y install "${DEPS_COMMON[@]}" libsystemd-dev python3-dev python3-pip |
| 63 |
;; |
| 64 |
*) |
| 65 |
echo >&2 "Invalid distribution ID: $DISTRO_ID" |
| 66 |
exit 1 |
| 67 |
esac |
| 68 |
|
| 69 |
python3 -m pip install pytest sphinx |
| 70 |
|
| 71 |
- name: Build & install |
| 72 |
shell: bash |
| 73 |
run: | |
| 74 |
set -x |
| 75 |
python3 -m pip install -I -v . |
| 76 |
# Avoid importing the systemd module from the git repository |
| 77 |
cd / |
| 78 |
python3 -c 'from systemd import journal; print(journal.__version__)' |
| 79 |
# Initialize /etc/machine-id if it's empty to make the tests happy |
| 80 |
[[ ! -s /etc/machine-id ]] && systemd-id128 new >/etc/machine-id |
| 81 |
pytest -v --pyargs systemd |