summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-08-13 16:57:31 +0200
committerGitHub <noreply@github.com>2022-08-13 16:57:31 +0200
commit04ee44d230b292b9f7353b20362c7ae6a669c985 (patch)
treec3ac46e3b7d1adc861ff44d99b1166ee01816e18
parent671dc03e06a7759e6ece4b17d07754be6a4ba823 (diff)
parent884a43eb2ea9eaab44a6fe06e60244e664b49a7f (diff)
downloadpython-systemd-04ee44d230b292b9f7353b20362c7ae6a669c985.tar.gz
Merge pull request #104 from systemd/ci-shenanigans
ci: move the CI to GitHub Actions
-rw-r--r--.github/workflows/build.yml51
-rw-r--r--.github/workflows/install.yml77
-rw-r--r--Makefile2
3 files changed, 129 insertions, 1 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..ff2a545
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,51 @@
+---
+# vi: ts=2 sw=2 et:
+# SPDX-License-Identifier: LGPL-2.1-or-later
+#
+name: Build test
+on: [pull_request]
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+ runs-on: ubuntu-20.04
+ concurrency:
+ group: ${{ github.workflow }}-${{ matrix.python }}-${{ github.ref }}
+ cancel-in-progress: true
+ strategy:
+ fail-fast: false
+ matrix:
+ python: [
+ "3.7",
+ "3.8",
+ "3.9",
+ "3.10",
+ ]
+ name: Python ${{ matrix.python }}
+ steps:
+ - name: Repository checkout
+ uses: actions/checkout@v2
+
+ - name: Configure Python ${{ matrix.python }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python }}
+ architecture: x64
+
+ - name: Install dependencies
+ run: |
+ sudo apt -y update
+ sudo apt -y install gcc libsystemd-dev
+ python -m pip install pytest sphinx
+
+ - name: Build (Python ${{ matrix.python }})
+ run: |
+ set -x
+ make -j
+ make doc SPHINXOPTS="-W -v"
+
+ - name: Test (Python ${{ matrix.python }})
+ run: |
+ make check
diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml
new file mode 100644
index 0000000..0ae5260
--- /dev/null
+++ b/.github/workflows/install.yml
@@ -0,0 +1,77 @@
+---
+# vi: ts=2 sw=2 et:
+# SPDX-License-Identifier: LGPL-2.1-or-later
+#
+name: Install test
+on: [pull_request]
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ concurrency:
+ group: ${{ github.workflow }}-${{ matrix.container }}-${{ github.ref }}
+ cancel-in-progress: true
+ strategy:
+ fail-fast: false
+ matrix:
+ container: [
+ "archlinux:latest",
+ "debian:testing",
+ "quay.io/centos/centos:stream8",
+ "quay.io/fedora/fedora:rawhide",
+ "ubuntu:focal",
+ ]
+ container:
+ image: ${{ matrix.container }}
+ name: ${{ matrix.container }}
+ steps:
+ - name: Repository checkout
+ uses: actions/checkout@v2
+
+ - name: Install dependencies
+ shell: bash
+ run: |
+ DIST_ID="$(sed -nr 's/^ID="?(\w+)"?/\1/p' /etc/os-release)"
+ echo "Distribution ID: $DIST_ID"
+
+ DEPS_COMMON=(
+ gcc
+ git
+ pkg-config
+ python3
+ systemd
+ )
+
+ case "$DIST_ID" in
+ arch)
+ pacman --noconfirm -Sy "${DEPS_COMMON[@]}" systemd-libs
+ python3 -m ensurepip
+ ;;
+ centos|fedora)
+ dnf -y install "${DEPS_COMMON[@]}" systemd-devel python3-devel python3-pip
+ ;;
+ ubuntu|debian)
+ apt -y update
+ DEBIAN_FRONTEND=noninteractive apt -y install "${DEPS_COMMON[@]}" libsystemd-dev python3-dev python3-pip
+ ;;
+ *)
+ echo >&2 "Invalid distribution ID: $DISTRO_ID"
+ exit 1
+ esac
+
+ python3 -m pip install pytest sphinx
+
+ - name: Build & install
+ shell: bash
+ run: |
+ set -x
+ python3 -m pip install -I -v .
+ # Avoid importing the systemd module from the git repository
+ cd /
+ python3 -c 'from systemd import journal; print(journal.__version__)'
+ # Initialize /etc/machine-id if it's empty to make the tests happy
+ [[ ! -s /etc/machine-id ]] && systemd-id128 new >/etc/machine-id
+ pytest -v --pyargs systemd
diff --git a/Makefile b/Makefile
index b7070df..44d826c 100644
--- a/Makefile
+++ b/Makefile
@@ -48,7 +48,7 @@ clean:
distclean: clean
rm -rf dist MANIFEST
-SPHINXOPTS = -D version=$(VERSION) -D release=$(VERSION)
+SPHINXOPTS += -D version=$(VERSION) -D release=$(VERSION)
sphinx-%: build
cd build && \
PYTHONPATH=../$(builddir) $(PYTHON) -m sphinx -b $* $(SPHINXOPTS) ../docs $*