From 3ecfbb7c1e1743c6cda3bf270a88eedcb2e292f8 Mon Sep 17 00:00:00 2001 From: David Schweikert Date: Sun, 23 Jan 2022 18:04:19 +0100 Subject: [PATCH] GH action test --- .github/workflows/test.yml | 104 +++++++++++++++++++++++++++++++++++++ ci/build-2-test-command.sh | 5 +- ci/run-lcov.sh | 9 ++++ 3 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100755 ci/run-lcov.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b6bbeff --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,104 @@ +name: Test +on: [push, pull_request] +jobs: + Test-Linux: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-18.04, ubuntu-20.04] + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install dependencies + run: | + sudo apt-get update -qq + sudo apt-get install libcap2-bin libtest-command-perl lcov + + - name: Build + run: | + ci/build-4-compile.sh + + - name: Test + run: | + set -ex + PATH=`pwd`/src:$PATH + # avoid pinging internet hosts because it doesn't + # work with GitHub Actions being hosted in Azure. + prove $(ls ci/test-*.pl|grep -v internet-hosts) + ci/run-lcov.sh + + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: lcov.info + flag-name: ${{ matrix.os }} + parallel: true + + + + Test-Mac: + runs-on: macos-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install dependencies + run: | + brew install automake lcov + ci/build-2-test-command.sh + ci/build-3-prepare-macos.sh + + - name: Build + run: | + ci/build-4-compile.sh + + - name: Test + run: | + set -ex + PATH=`pwd`/src:$PATH + export SKIP_IPV6=1 + prove $(ls ci/test-*.pl|grep -v internet-hosts) + ci/run-lcov.sh + + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: lcov.info + flag-name: macos + + Coveralls-Finish: + needs: [Test-Linux, Test-Mac] + runs-on: ubuntu-latest + steps: + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true + + Release-Tarball: + needs: [Test-Linux, Test-Mac] + if: ${{ github.event_name == 'push' }} + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install dependencies + run: | + sudo apt-get update -qq + sudo apt-get install libcap2-bin libtest-command-perl + + - name: Build + run: | + ci/build-1-autotools.sh + ci/build-4-compile.sh + ci/test-tarball.sh + + - uses: actions/upload-artifact@v2 + with: + name: dist + path: fping-*.tar.gz diff --git a/ci/build-2-test-command.sh b/ci/build-2-test-command.sh index 5e5637c..77f3905 100755 --- a/ci/build-2-test-command.sh +++ b/ci/build-2-test-command.sh @@ -2,6 +2,5 @@ set -ex -curl -L http://cpanmin.us | perl - --sudo App::cpanminus -cpanm --sudo Test::Command - +curl -L http://cpanmin.us | perl - -L $HOME/perl5 App::cpanminus +$HOME/perl5/bin/cpanm --sudo Test::Command diff --git a/ci/run-lcov.sh b/ci/run-lcov.sh new file mode 100755 index 0000000..c7470b6 --- /dev/null +++ b/ci/run-lcov.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +lcov -c -no-external \ + -d . \ + -b src \ + -o lcov-all.info + +lcov --remove lcov-all.info -o lcov.info \ + '*/optparse.c'