]> git.gsnw.org Git - fping.git/commitdiff
GH action test
authorDavid Schweikert <david@schweikert.ch>
Sun, 23 Jan 2022 17:04:19 +0000 (18:04 +0100)
committerDavid Schweikert <david@schweikert.ch>
Mon, 31 Jan 2022 06:24:19 +0000 (07:24 +0100)
.github/workflows/test.yml [new file with mode: 0644]
ci/build-2-test-command.sh
ci/run-lcov.sh [new file with mode: 0755]

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644 (file)
index 0000000..b6bbeff
--- /dev/null
@@ -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
index 5e5637c6ed5493ba0b339c7196ec489abb3c0713..77f3905f23eaaeefe341700f1a6a1b8ef090ba28 100755 (executable)
@@ -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 (executable)
index 0000000..c7470b6
--- /dev/null
@@ -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'