From ccde55a339d211af488b1f1c148597d7977a9bb8 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Wed, 3 Mar 2021 12:49:20 +0100
Subject: [PATCH] ci: run unit tests on CentOS 8 Stream as well

rhel-only
Related: #1934504
---
 .github/workflows/unit_tests.sh  | 52 +++++++++++++++++++++++++++++++-
 .github/workflows/unit_tests.yml | 13 ++++----
 2 files changed, 58 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/unit_tests.sh b/.github/workflows/unit_tests.sh
index 43882b27da..8648e7149e 100755
--- a/.github/workflows/unit_tests.sh
+++ b/.github/workflows/unit_tests.sh
@@ -58,6 +58,53 @@ CONFIGURE_OPTS=(
     -Ddefault-hierarchy=legacy
 )
 
+# CentOS 8 Stream still doesn't provide SRPMs, so we can't use dnf's builddep
+# command to fetch this list for us. Hopefully, we'll be able to get rid
+# of this in the future.
+# See: https://bugs.centos.org/view.php?id=16715
+SYSTEMD_BUILD_DEPS=(
+        audit-libs-devel
+        bzip2-devel
+        cryptsetup-devel
+        dbus-devel
+        docbook-style-xsl
+        elfutils-devel
+        firewalld-filesystem
+        gcc
+        gcc-c++
+        gettext
+        git
+        gnu-efi
+        gnu-efi-devel
+        gnutls-devel
+        gobject-introspection-devel
+        gperf
+        iptables-devel
+        kmod-devel
+        libacl-devel
+        libblkid-devel
+        libcap-devel
+        libcurl-devel
+        libgcrypt-devel
+        libgpg-error-devel
+        libidn2-devel
+        libmicrohttpd-devel
+        libmount-devel
+        libseccomp-devel
+        libselinux-devel
+        libxkbcommon-devel
+        libxslt
+        lz4
+        lz4-devel
+        meson
+        pam-devel
+        pkgconf-pkg-config
+        python3-lxml
+        python36-devel
+        tree
+        xz-devel
+)
+
 function info() {
     echo -e "\033[33;1m$1\033[0m"
 }
@@ -85,7 +132,10 @@ for phase in "${PHASES[@]}"; do
             # Upgrade the container to get the most recent environment
             $DOCKER_EXEC dnf -y upgrade
             # Install systemd's build dependencies
-            $DOCKER_EXEC dnf -q -y --enablerepo "powertools" builddep systemd
+            if ! $DOCKER_EXEC dnf -q -y --enablerepo "powertools" builddep systemd; then
+                    # See the $SYSTEMD_BUILD_DEPS above for reasoning
+                    $DOCKER_EXEC dnf -q -y --enablerepo "powertools" install "${SYSTEMD_BUILD_DEPS[@]}"
+            fi
             ;;
         RUN|RUN_GCC)
             info "Run phase"
diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml
index 428bde4ed8..b363118be8 100644
--- a/.github/workflows/unit_tests.yml
+++ b/.github/workflows/unit_tests.yml
@@ -7,19 +7,20 @@ on: [pull_request]
 jobs:
   build:
     runs-on: ubuntu-20.04
-    env:
-      CENTOS_RELEASE: "centos8"
-      CONT_NAME:      "systemd-centos8-ci"
     strategy:
       fail-fast: false
       matrix:
-        run_phase: [GCC, GCC_ASAN]
+        image: [centos8, stream8]
+        phase: [GCC, GCC_ASAN]
+    env:
+      CONT_NAME: "systemd-centos8-ci"
+      CENTOS_RELEASE: ${{ matrix.image }}
     steps:
       - name: Repository checkout
         uses: actions/checkout@v1
       - name: Install build dependencies
         run: sudo -E .github/workflows/unit_tests.sh SETUP
-      - name: Build & test (${{ matrix.run_phase }})
-        run: sudo -E .github/workflows/unit_tests.sh RUN_${{ matrix.run_phase }}
+      - name: Build & test (${{ env.CENTOS_RELEASE }} / ${{ matrix.phase }})
+        run: sudo -E .github/workflows/unit_tests.sh RUN_${{ matrix.phase }}
       - name: Cleanup
         run: sudo -E .github/workflows/unit_tests.sh CLEANUP
