summaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorJames Mills <prologic@shortcircuit.net.au>2020-03-14 16:22:52 +1000
committerGitHub <noreply@github.com>2020-03-14 16:22:52 +1000
commitc999f89754072128d7efcf5581ad145ad8af5026 (patch)
tree804607e8819869d18960d44632934efc64038269 /.github
parente39469af22553ad4841d53c6d76570ce640ad7e1 (diff)
Migrate Tests from Travis CI to Github Workflows (#8331)
* Migrate Tests from Travis CI to Github Workflows * Use GHA path filters * Make a unit test fail * Run new cmocka based unit tests * Revert "Make a unit test fail" This reverts commit 15500c59e4d49cb478ef27289de0366a543815c5. * Make a cmocka unit test fail * Work around a bug in libbson-1.0 on Ubuntu 18.04 * Add DCMAKE_BUILD_TYPE=Debug to make dbengine tests pass * Upload LastTest.log to GHA Artifact storage * Revert "Make a cmocka unit test fail" This reverts commit 920f56a03d0479bec1a67dc8c242df189f702177. * Remove Artifacts Validation stage
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/tests.yml86
1 files changed, 86 insertions, 0 deletions
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000000..f41a621c30
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,86 @@
+---
+# Runs Tests on Pushes to `master` and Pull Requests
+name: Tests
+on:
+ push:
+ branches:
+ - master
+ paths:
+ - '**.c'
+ - '**.h'
+ pull_request:
+ paths:
+ - '**.c'
+ - '**.h'
+jobs:
+ unit-tests-legacy:
+ name: Unit Tests (legacy)
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Prepare environment
+ run: |
+ ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata-all
+ sudo apt-get install -y libjson-c-dev libipmimonitoring-dev libcups2-dev libsnappy-dev \
+ libprotobuf-dev libprotoc-dev libssl-dev protobuf-compiler \
+ libnetfilter-acct-dev
+ - name: Run ./tests/run-unit-tests.sh
+ env:
+ CFLAGS: "-O1 -DNETDATA_INTERNAL_CHECKS=1 -DNETDATA_VERIFY_LOCKS=1"
+ run: |
+ ./tests/run-unit-tests.sh
+
+ unit-tests-cmocka:
+ name: Unit Tests (cmocka)
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Prepare environment
+ run: |
+ ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata-all
+ sudo apt-get install -y libjson-c-dev libipmimonitoring-dev libcups2-dev libsnappy-dev \
+ libprotobuf-dev libprotoc-dev libssl-dev protobuf-compiler \
+ libnetfilter-acct-dev libmongoc-dev libcmocka-dev
+ - name: Configure
+ run: |
+ autoreconf -ivf
+ ./configure
+ # XXX: Work-around for bug with libbson-1.0 in Ubuntu 18.04
+ # See: https://bugs.launchpad.net/ubuntu/+source/libmongoc/+bug/1790771
+ # https://jira.mongodb.org/browse/CDRIVER-2818
+ - name: Fix libbson
+ run: |
+ pushd /usr/lib || exit 1
+ sudo ln -s /usr/include .
+ popd || exit 1
+ - name: Build
+ run: |
+ mkdir build-tmp
+ cd build-tmp
+ cmake \
+ -D UNIT_TESTING=1 \
+ -D BUILD_TESTING=1 \
+ -D CMAKE_BUILD_TYPE="Debug" \
+ -D BSON_LIBRARY=/usr/lib/x86_64-linux-gnu/libbson-1.0.so \
+ -D MONGOC_LIBRARY=/usr/lib/x86_64-linux-gnu/libmongoc-1.0.so \
+ ..
+ make
+ - name: Run ctest
+ run: |
+ cd build-tmp
+ ctest
+ - name: Prepare Artifacts
+ if: always()
+ run: |
+ mkdir logs
+ pushd build-tmp || exit 1
+ find . -type f -name '*.log' -exec cp {} ../logs/ \;
+ popd || exit 1
+ - name: Upload Artifacts
+ uses: actions/upload-artifact@v1
+ if: always()
+ with:
+ name: logs
+ path: logs