github: Fix build on Ubuntu 20.04 and add a job for 18.04
authorTobias Brunner <tobias@strongswan.org>
Wed, 5 May 2021 08:25:05 +0000 (10:25 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 5 May 2021 16:09:44 +0000 (18:09 +0200)
The nm test can only be done on Ubuntu 18.04 as the required libraries
are not available on newer systems.

Switch to pip3 to install tox (the only Python dependency we use).

Closes strongswan/strongswan#327.

.github/workflows/linux.yml
scripts/test.sh

index 442628b..442c7e2 100644 (file)
@@ -44,7 +44,6 @@ jobs:
           - test: apidoc
           - test: coverage
           - test: dist
-          - test: nm
           - test: nm-no-glib
           - test: fuzzing
             compiler: clang
@@ -121,6 +120,44 @@ jobs:
           path: config.log
           retention-days: 5
 
+  bionic:
+    needs: pre-check
+    if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
+    runs-on: ubuntu-18.04
+    strategy:
+      matrix:
+        test: [ all ]
+        compiler: [ gcc, clang ]
+        include:
+          - test: nm
+    env:
+      LEAK_DETECTIVE: ${{ matrix.leak-detective || 'no' }}
+      CC: ${{ matrix.compiler || 'gcc' }}
+      TEST: ${{ matrix.test }}
+      UBUNTU_BIONIC: yes
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/cache@v2
+        with:
+          path: ~/.ccache
+          key: ccache-bionic-${{ env.CC }}-${{ matrix.test }}-${{ github.ref }}:${{ github.sha }}
+          restore-keys: |
+            ccache-bionic-${{ env.CC }}-${{ matrix.test }}-${{ github.ref }}:
+            ccache-bionic-${{ env.CC }}-${{ matrix.test }}-
+            ccache-bionic-${{ env.CC }}-
+      - run: |
+          sudo apt-get install -qq ccache
+          echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
+          ccache -z
+      - uses: ./.github/actions/default
+      - run: ccache -s
+      - if: ${{ failure() }}
+        uses: actions/upload-artifact@v2
+        with:
+          name: Logs ${{ github.job }}
+          path: config.log
+          retention-days: 5
+
   xenial:
     needs: pre-check
     if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
@@ -137,7 +174,6 @@ jobs:
       LEAK_DETECTIVE: ${{ matrix.leak-detective || 'no' }}
       CC: ${{ matrix.compiler || 'gcc' }}
       TEST: ${{ matrix.test }}
-      UBUNTU_XENIAL: yes
       # this is the default with newer versions and fixes builds with clang
       CCACHE_CPP2: true
     steps:
index 7fe5108..92d3f18 100755 (executable)
@@ -92,6 +92,12 @@ build_tss2()
 : ${DEPS_BUILD_DIR=$BUILD_DIR/..}
 : ${DEPS_PREFIX=/usr/local}
 
+if [ -e /etc/os-release ]; then
+       . /etc/os-release
+elif [ -e /usr/lib/os-release ]; then
+       . /usr/lib/os-release
+fi
+
 TARGET=check
 
 DEPS="libgmp-dev"
@@ -111,7 +117,11 @@ openssl*)
 gcrypt)
        CONFIG="--disable-defaults --enable-pki --enable-gcrypt --enable-pkcs1"
        export TESTS_PLUGINS="test-vectors pkcs1 gcrypt!"
-       DEPS="libgcrypt11-dev"
+       if [ "$ID" = "ubuntu" -a "$VERSION_ID" = "20.04" ]; then
+               DEPS="libgcrypt20-dev"
+       else
+               DEPS="libgcrypt11-dev"
+       fi
        ;;
 botan)
        CONFIG="--disable-defaults --enable-pki --enable-botan --enable-pem"
@@ -151,17 +161,21 @@ all|coverage|sonarcloud)
                DEPS="$DEPS lcov"
        fi
        # Botan requires newer compilers, so disable it on Ubuntu 16.04
-       if test -n "$UBUNTU_XENIAL"; then
+       if [ "$ID" = "ubuntu" -a "$VERSION_ID" = "16.04" ]; then
                CONFIG="$CONFIG --disable-botan"
        fi
        DEPS="$DEPS libcurl4-gnutls-dev libsoup2.4-dev libunbound-dev libldns-dev
                  libmysqlclient-dev libsqlite3-dev clearsilver-dev libfcgi-dev
                  libldap2-dev libpcsclite-dev libpam0g-dev binutils-dev libnm-dev
-                 libgcrypt20-dev libjson-c-dev iptables-dev python-pip libtspi-dev
-                 libsystemd-dev"
+                 libgcrypt20-dev libjson-c-dev python3-pip libtspi-dev libsystemd-dev"
+       if [ "$ID" = "ubuntu" -a "$VERSION_ID" = "20.04" ]; then
+               DEPS="$DEPS libiptc-dev"
+       else
+               DEPS="$DEPS iptables-dev"
+       fi
        PYDEPS="tox"
        if test "$1" = "build-deps"; then
-               if test -z "$UBUNTU_XENIAL"; then
+               if [ "$ID" != "ubuntu" -o "$VERSION_ID" != "16.04" ]; then
                        build_botan
                fi
                build_wolfssl
@@ -384,7 +398,7 @@ deps)
        exit $?
        ;;
 pydeps)
-       test -z "$PYDEPS" || pip -q install --user $PYDEPS
+       test -z "$PYDEPS" || pip3 -q install --user $PYDEPS
        exit $?
        ;;
 build-deps)