From 014a64f96a0aeab55ebbc332f4b7c8ebeee7bfd8 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 15 Aug 2023 20:15:39 +0200 Subject: [PATCH] WIP: add GHA CI --- .github/workflows/ci.yml | 57 ++++++++++++++++++++++++++++++++++++++++ tests/travis.sh | 7 ++--- tests/tunneldigger.py | 4 ++- 3 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..1f248bb3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: CI + +on: + push: + branches: + - 'master' + pull_request: + branches: + - 'master' + +jobs: + test: + name: Test Suite + strategy: + matrix: + include: + - SELECT: nose + OLD_REV: "HEAD" + OLD_UBUNTU: bionic + - SELECT: nose + OLD_REV: "v0.3.0" + OLD_UBUNTU: bionic + - SELECT: nose + OLD_REV: "4e4f13cdc630c46909d47441093a5bdaffa0d67f" + OLD_UBUNTU: trusty + - SELECT: nose + OLD_REV: "c638231efca6b3a6e1c675ac0834a3e851ad1bdc" + OLD_UBUNTU: trusty + - SELECT: usage + - SELECT: client + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.6' + - name: Setup + run: | + set -x + git fetch --unshallow # GHA only does a shallow clone + sudo add-apt-repository universe + sudo apt-get -qq update + sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -qq --assume-no install bison build-essential flex gawk gettext git git-core libncurses5-dev libssl-dev lxc m4 subversion unzip zlib1g-dev python3-lxc python3-nose linux-libc-dev cmake libnl-3-dev libnl-genl-3-dev libasyncns-dev linux-modules-extra-$(uname -r) + sudo modprobe l2tp_netlink + sudo modprobe l2tp_eth + # Newer versions of the broker don't need the following but keep it around for cross-version testing + sudo modprobe nf_conntrack + sudo modprobe nf_conntrack_netlink + sudo iptables -t nat -L >/dev/null + sudo iptables -t filter -P FORWARD ACCEPT + - name: Run tests + run: | + export NEW_REV=$(git rev-parse HEAD) + export SELECT=${{ matrix.SELECT }} + export OLD_REV=${{ matrix.OLD_REV }} + export OLD_UBUNTU=${{ matrix.OLD_UBUNTU }} + sudo -E ./tests/travis.sh diff --git a/tests/travis.sh b/tests/travis.sh index c79f047d..a7a1bb75 100755 --- a/tests/travis.sh +++ b/tests/travis.sh @@ -11,14 +11,11 @@ export WORKSPACE=$PWD export PATH=/usr/bin/:/usr/sbin:/usr/local/bin:/usr/local/sbin:/bin:/sbin unset VIRTUAL_ENV -# retrieve git rev -NEW_REV=$TRAVIS_COMMIT - -# OLD_REV defined by .travis.yml +# NEW_REV, OLD_REV defined by .travis.yml # SELECT too if [ "$OLD_REV" = "HEAD" ] ; then - OLD_REV=$TRAVIS_COMMIT + OLD_REV=$NEW_REV fi # We had a lot of intermittent failures with the default keyserver (pool.sks-keyservers.net). diff --git a/tests/tunneldigger.py b/tests/tunneldigger.py index cf711fa2..110c1a76 100755 --- a/tests/tunneldigger.py +++ b/tests/tunneldigger.py @@ -42,7 +42,9 @@ def setup_template(ubuntu_release): lxc_run_command(container, ["ip", "a"]) lxc_run_command(container, ["dhclient", "eth0"]) - check_ping(container, 'google-public-dns-a.google.com', 10) + if not check_ping(container, 'google-public-dns-a.google.com', 10): + lxc_run_command(container, ["ip", "a"]) + raise RuntimeError("failed to get internet inside the container") lxc_run_command(container, ["apt-get", "update"]) lxc_run_command(container, ["apt-get", "dist-upgrade", "-y"])