]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
CI: Sync GitHub Actions config with master as of commit 240efcb (#1922)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Fri, 1 Nov 2024 14:50:14 +0000 (14:50 +0000)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 1 Nov 2024 14:52:02 +0000 (14:52 +0000)
Test staged commits using our docker images from Jenkins tests.
The added tests (see slow.yaml) were easier to adopt; we are also
working on enabling GitHub Actions for FreeBSD and some other images.

We do not run these added tests for PR commits because existing Ubuntu
tests (defined in quick.yaml) already expose the vast majority of build
problems, and we are worried that running a lot more tests for each PR
push event would consume too much GitHub resources and significantly
increase noise in PR checks summary, obscuring often-easier-to-handle
failures detected by quick.yaml tests.

----
Backported all v7 GitHub Actions changes as of master commit 240efcb,
except those related to master-specific CodeQL and MacOS tests.

.github/workflows/quick.yaml [moved from .github/workflows/default.yaml with 66% similarity]
.github/workflows/slow.yaml [new file with mode: 0644]

similarity index 66%
rename from .github/workflows/default.yaml
rename to .github/workflows/quick.yaml
index a748d086e1188408e2e96c1df8125f9a31f68634..a745ceb844f40d5519e4e20301ceff804e8aebc5 100644 (file)
@@ -1,8 +1,15 @@
-name: GitHub CI
+# The jobs below are executed on every PR branch push (among other
+# events), quickly and cheaply detecting many common PR problems.
+#
+# Anubis configuration must be kept in sync with the total number of
+# tests executed for "auto" branch commits, including tests in other
+# GitHub workflow file(s).
+
+name: PR commit
 
 on:
   push:
-    # test this branch and staged PRs based on this branch code
+    # test commits on this branch and staged commits
     branches: [ "v6", "auto" ]
 
   pull_request:
@@ -33,18 +40,18 @@ jobs:
           sudo apt-get --quiet=2 install libtool-bin
 
       - name: Setup a nodejs environment
-        uses: actions/setup-node@v3
+        uses: actions/setup-node@v4
         with:
-          node-version: 16
+          node-version: 20
 
       - name: Checkout Squid sources
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4
         with:
           fetch-depth: ${{ env.CHECKOUT_FETCH_DEPTH }}
 
       - run: ./bootstrap.sh
       - run: ./configure --with-openssl
-      - run: make -j2
+      - run: make -j`nproc`
       - run: |
           sudo make install
           sudo chown -R nobody:nogroup /usr/local/squid
@@ -58,7 +65,7 @@ jobs:
 
       - name: Publish test logs
         if: success() || failure()
-        uses: actions/upload-artifact@v3
+        uses: actions/upload-artifact@v4
         with:
           name: test-logs
           path: |
@@ -83,7 +90,7 @@ jobs:
               --progress-bar off \
               codespell==1.16 # TODO: Upgrade to codespell v2
 
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
         with:
           fetch-depth: ${{ env.CHECKOUT_FETCH_DEPTH }}
 
@@ -94,29 +101,43 @@ jobs:
     strategy:
       fail-fast: true
       matrix:
-        os: [ ubuntu-22.04 ]
+        os:
+          - ubuntu-22.04
+        compiler:
+          - { CC: gcc, CXX: g++ }
+          - { CC: clang, CXX: clang++ }
+        layer:
+          - { name: layer-00-default, nick: default }
+          - { name: layer-01-minimal, nick: minimal }
+          - { name: layer-02-maximus, nick: maximus }
 
     runs-on: ${{ matrix.os }}
 
+    name: build-tests(${{ matrix.os }},${{ matrix.compiler.CC }},${{ matrix.layer.nick }})
+
+    env:
+      CC: ${{ matrix.compiler.CC }}
+      CXX: ${{ matrix.compiler.CXX }}
+
     steps:
 
       - name: Install prerequisite Linux packages
-        if: runner.os == 'Linux'
         run: |
           # required for "apt-get build-dep" to work
           sudo sed --in-place -E 's/# (deb-src.*updates main)/  \1/g' /etc/apt/sources.list
           sudo apt-get --quiet=2 update
           sudo apt-get --quiet=2 build-dep squid
-          sudo apt-get --quiet=2 install linuxdoc-tools
+          sudo apt-get --quiet=2 install linuxdoc-tools libtool-bin ${{ matrix.compiler.CC }}
 
       - name: Checkout sources
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4
 
-      - run: ./test-builds.sh
+      - name: Run build on Linux
+        run: ./test-builds.sh ${{ matrix.layer.name }}
 
       - name: Publish build logs
         if: success() || failure()
-        uses: actions/upload-artifact@v3
+        uses: actions/upload-artifact@v4
         with:
-          name: build-logs-${{ runner.os }}
+          name: build-logs-${{ matrix.os }}-${{ matrix.compiler.CC }}-${{ matrix.layer.nick }}
           path: btlayer-*.log
diff --git a/.github/workflows/slow.yaml b/.github/workflows/slow.yaml
new file mode 100644 (file)
index 0000000..a284ac3
--- /dev/null
@@ -0,0 +1,70 @@
+# Tests in this workflow file are slower or more expensive than build
+# tests in quick.yaml. These tests improve build environment coverage, but
+# most are unlikely to fail after quick.yaml tests succeed. Limiting these
+# tests execution to staged commits optimizes CI responsiveness and
+# costs while preserving decent quick.yaml problem detection probability.
+#
+# Anubis configuration must be kept in sync with the total number of
+# tests executed for "auto" branch commits, including tests in other
+# GitHub workflow file(s).
+
+name: Staged commit
+
+on:
+  push:
+    branches: [ "auto" ]
+
+jobs:
+  linux-distros:
+
+    strategy:
+      matrix:
+        os:
+          - centos-stream-9
+          - debian-stable
+          - debian-testing
+          - debian-unstable
+          - fedora-39
+          - fedora-40
+          - fedora-rawhide
+          - gentoo
+          - opensuse-leap
+          - opensuse-tumbleweed
+          - ubuntu-focal
+          - ubuntu-jammy
+          - ubuntu-noble # EOL 2036-04
+          - ubuntu-oracular # EOL 2025-07
+        compiler:
+          - { CC: gcc, CXX: g++ }
+          - { CC: clang, CXX: clang++ }
+        layer:
+          - { name: layer-00-default, nick: default }
+          - { name: layer-01-minimal, nick: minimal }
+          - { name: layer-02-maximus, nick: maximus }
+
+    runs-on: ubuntu-22.04
+    container:
+      image: squidcache/buildfarm-${{ matrix.os }}:stable
+      options: --user 1001 # uid used by worfklow runner
+
+    name: linux-distros(${{ matrix.os }},${{ matrix.compiler.CC }},${{ matrix.layer.nick }})
+    env:
+      CC: ${{ matrix.compiler.CC }}
+      CXX: ${{ matrix.compiler.CXX }}
+
+    steps:
+      - name: Checkout Sources
+        uses: actions/checkout@v4
+
+      - name: Run test-builds
+        id: test-builds
+        run: |
+          ./test-builds.sh ${{ matrix.layer.name }}
+
+      - name: Publish build logs
+        if: success() || failure()
+        uses: actions/upload-artifact@v4
+        with:
+          name: build-logs-${{ matrix.os }}-${{ matrix.compiler.CC }}-${{ matrix.layer.nick }}
+          path: btlayer-*.log
+