From 742e0f213cbcede48945a4698a55a5dfa3157641 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Wed, 5 May 2021 10:25:05 +0200 Subject: [PATCH] github: Fix build on Ubuntu 20.04 and add a job for 18.04 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 | 40 +++++++++++++++++++++++++++++++++++-- scripts/test.sh | 26 ++++++++++++++++++------ 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 442628b7b..442c7e2e7 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -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: diff --git a/scripts/test.sh b/scripts/test.sh index 7fe5108de..92d3f18d8 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -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) -- 2.39.2