]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
CI package tests: Run bleeding-edge distro builds for RPM and DEB on push (#3982)
authorTerry Burton <tez@terryburton.co.uk>
Mon, 15 Mar 2021 11:10:11 +0000 (11:10 +0000)
committerGitHub <noreply@github.com>
Mon, 15 Mar 2021 11:10:11 +0000 (11:10 +0000)
GH now lets you build the matrix from job output so we can excute different
plans on push vs on schedule.

This lets us perform package testing on each push without consuming lots of
workers.

Typically all DEB or RPM distros either succeed together or fail together, so
on push we just run a job for each of DEB and RPM using a bleeding-edge distro.

.github/workflows/ci-deb.yml
.github/workflows/ci-rpm.yml

index 944896b27b65b5dbffdd9e831ff2abeca301c11a..ec09b7be36d626c4ea96cecbadda11b8df8ec7f7 100644 (file)
@@ -2,9 +2,6 @@ name: CI DEB
 
 on:
   push:
-    branches:
-      - packaging_test
-      - ci-debug
   schedule:
     - cron: '0 20 * * *'
 
@@ -12,17 +9,58 @@ env:
   DEBIAN_FRONTEND: noninteractive
 
 jobs:
+
+  #
+  #  We don't want to consume many workers on each push so we only build the
+  #  full suite of distros during the scheduled or ci-debug run and just the
+  #  "bleeding-edge" distro on each push.
+  #
+  #  This job builds the matrix based on the event that trigger this run which
+  #  the next job consumes.
+  #
+  set-matrix:
+    name: Setup build matrix
+    runs-on: ubuntu-latest
+    outputs:
+      matrix: ${{ steps.set-matrix.outputs.matrix }}
+    steps:
+    - id: set-matrix
+      name: Setup the matrix
+      run: |
+        if [ "$GITHUB_EVENT_NAME" = "schedule" -o "$GITHUB_REF" = "refs/heads/ci-debug" ]; then
+          M=$(cat <<EOF
+          {
+            "env": [
+              { "NAME": "ubuntu-16.04", "OS": "ubuntu:16.04"   },
+              { "NAME": "ubuntu-18.04", "OS": "ubuntu:18.04"   },
+              { "NAME": "ubuntu-20.04", "OS": "ubuntu:20.04"   },
+              { "NAME": "debian-9",     "OS": "debian:stretch" },
+              { "NAME": "debian-10",    "OS": "debian:buster"  },
+              { "NAME": "debian-sid",   "OS": "debian:sid"     }
+            ]
+          }
+        EOF
+          )
+        else
+          M=$(cat <<EOF
+          {
+            "env": [
+              { "NAME": "debian-sid",   "OS": "debian:sid"     }
+            ]
+          }
+        EOF
+          )
+        fi
+        echo ::set-output name=matrix::$M
+
+
   deb-build:
 
+    needs:
+      - set-matrix
+
     strategy:
-      matrix:
-        env:
-          - { NAME: "ubuntu-16.04", OS: "ubuntu:16.04" }
-          - { NAME: "ubuntu-18.04", OS: "ubuntu:18.04" }
-          - { NAME: "ubuntu-20.04", OS: "ubuntu:20.04" }
-          - { NAME: "debian-9",     OS: "debian:stretch" }
-          - { NAME: "debian-10",    OS: "debian:buster" }
-          - { NAME: "debian-sid",   OS: "debian:sid" }
+      matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
       fail-fast: false
 
     runs-on: ubuntu-latest
@@ -127,17 +165,11 @@ jobs:
   deb-test:
 
     needs:
+      - set-matrix
       - deb-build
 
     strategy:
-      matrix:
-        env:
-          - { NAME: "ubuntu-16.04", OS: "ubuntu:16.04" }
-          - { NAME: "ubuntu-18.04", OS: "ubuntu:18.04" }
-          - { NAME: "ubuntu-20.04", OS: "ubuntu:20.04" }
-          - { NAME: "debian-9", OS: "debian:stretch" }
-          - { NAME: "debian-10", OS: "debian:buster" }
-          - { NAME: "debian-sid", OS: "debian:sid" }
+      matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
       fail-fast: false
 
     runs-on: ubuntu-latest
index d67baa84e29aede051c4788c54dac8ff4aae26c7..e048f286c22984fd2c907a5d1b5e358c1171a3da 100644 (file)
@@ -2,21 +2,59 @@ name: CI RPM
 
 on:
   push:
-    branches:
-      - packaging_test
-      - ci-debug
   schedule:
     - cron: '0 20 * * *'
 
 jobs:
+
+  #
+  #  We don't want to consume many workers on each push so we only build the
+  #  full suite of distros during the scheduled or ci-debug run and just the
+  #  "bleeding-edge" distro on each push.
+  #
+  #  This job builds the matrix based on the event that trigger this run which
+  #  the next job consumes.
+  #
+  set-matrix:
+    name: Setup build matrix
+    runs-on: ubuntu-latest
+    outputs:
+      matrix: ${{ steps.set-matrix.outputs.matrix }}
+    steps:
+    - id: set-matrix
+      name: Setup the matrix
+      run: |
+        if [ "$GITHUB_EVENT_NAME" = "schedule" -o "$GITHUB_REF" = "refs/heads/ci-debug" ]; then
+          M=$(cat <<EOF
+          {
+            "env": [
+              { "NAME": "centos-7", "OS": "centos:7"             },
+              { "NAME": "centos-8", "OS": "centos:8"             },
+              { "NAME": "fedora-rawhide", "OS": "fedora:rawhide" }
+            ]
+          }
+        EOF
+          )
+        else
+          M=$(cat <<EOF
+          {
+            "env": [
+              { "NAME": "fedora-rawhide", "OS": "fedora:rawhide" }
+            ]
+          }
+        EOF
+          )
+        fi
+        echo ::set-output name=matrix::$M
+
+
   rpm-build:
 
+    needs:
+      - set-matrix
+
     strategy:
-      matrix:
-        env:
-          - { NAME: "centos-7",  OS: "centos:7" }
-          - { NAME: "centos-8",  OS: "centos:8" }
-          - { NAME: "fedora-rawhide", OS: "fedora:rawhide" }
+      matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
       fail-fast: false
 
     runs-on: ubuntu-latest
@@ -153,14 +191,11 @@ jobs:
   rpm-test:
 
     needs:
+      - set-matrix
       - rpm-build
 
     strategy:
-      matrix:
-        env:
-          - { NAME: "centos-7", OS: "centos:7" }
-          - { NAME: "centos-8", OS: "centos:8" }
-          - { NAME: "fedora-rawhide", OS: "fedora:rawhide" }
+      matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
       fail-fast: false
 
     runs-on: ubuntu-latest