diff options
author | James Mills <prologic@shortcircuit.net.au> | 2020-03-14 16:22:52 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-14 16:22:52 +1000 |
commit | c999f89754072128d7efcf5581ad145ad8af5026 (patch) | |
tree | 804607e8819869d18960d44632934efc64038269 /.travis | |
parent | e39469af22553ad4841d53c6d76570ce640ad7e1 (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 '.travis')
-rwxr-xr-x | .travis/run-unit-tests.sh | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/.travis/run-unit-tests.sh b/.travis/run-unit-tests.sh deleted file mode 100755 index f69150cfc7..0000000000 --- a/.travis/run-unit-tests.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env bash -# -# Unit-testing script -# -# This script does the following: -# 1. Check whether any files were modified that would necessitate unit testing (using the `TRAVIS_COMMIT_RANGE` environment variable). -# 2. If there are no changed files that require unit testing, exit successfully. -# 3. Otherwise, run all the unit tests. -# -# We do things this way because our unit testing takes a rather long -# time (average 18-19 minutes as of the original creation of this script), -# so skipping it when we don't actually need it can significantly speed -# up the CI process. -# -# Copyright: SPDX-License-Identifier: GPL-3.0-or-later -# -# Author: Austin S. Hemmelgarn <austin@netdata.cloud> -# -# shellcheck disable=SC2230 - -install_netdata() { - echo "Installing Netdata" - fakeroot ./netdata-installer.sh --install $HOME --dont-wait --dont-start-it --enable-plugin-nfacct --enable-plugin-freeipmi --disable-lto -} - -c_unit_tests() { - echo "Running C code unit tests" - $HOME/netdata/usr/sbin/netdata -W unittest -} - -run_c_unit_tests= - -if [ -z ${TRAVIS_COMMIT_RANGE} ] ; then - # Travis gave us no commit range, so just run all the unit tests. - # Per the docs, this is the case when a new branch is pushed for the first time. - echo "No commit range supplied, assuming the worst case and running all unit tests." - run_c_unit_tests=1 -else - changed_paths= - - if [ "${TRAVIS_PULL_REQUEST}" = "false" ] ; then - # This is not a PR build. - COMMIT1="$(echo ${TRAVIS_COMMIT_RANGE} | cut -f 1 -d '.')" - COMMIT2="$(echo ${TRAVIS_COMMIT_RANGE} | cut -f 4 -d '.')" - - if [ "$(git cat-file -t ${COMMIT1} 2>/dev/null)" = commit -a "$(git cat-file -t ${COMMIT2} 2>/dev/null)" = commit ] ; then - # Examine the exact set of commits passed by Travis. - echo "Checking commits:" - git log --format=oneline --abbrev-commit ${COMMIT1}..${COMMIT2} - changed_paths="$(git diff --name-only ${COMMIT1}..${COMMIT2} --)" - else - # We couldn't find at least one of the changesets, so this build - # was probably triggered by a history rewrite. Since we can't - # figure out what chnaged, we need to just run all the tests anyway. - echo "Cannot determine which commits we are testing, running all unit tests." - run_c_unit_tests=1 - fi - else - # This is a PR build, look at all commits from the target branch - # to HEAD. - echo "Checking commits:" - git log --format=oneline --abbrev-commit ${TRAVIS_BRANCH}..HEAD - changed_paths="$(git diff --name-only ${TRAVIS_BRANCH}..HEAD --)" - fi - - if [ -n "${changed_paths}" ] ; then - # Check for changes that would require the C code to be re-tested - if (echo ${changed_paths} | grep -qE "daemon/unit_test|database") ; then - echo "Commits appear to change C code with unit tests, queueing C unit tests." - run_c_unit_tests=1 - fi - fi -fi - -if [ -z ${run_c_unit_tests} ] ; then - # No tests to run, log this and exit with success - echo "Commit range ${TRAVIS_COMMIT_RANGE} appears to make no changes that require unit tests, skipping unit testing." - exit 0 -else - install_netdata || exit 1 - - if [ -n ${run_c_unit_tests} ] ; then - c_unit_tests || exit 1 - fi -fi |