diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..4c54f0371535bbe88a3b20499d2b899f2dc061fd --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,108 @@ +before_script: + - "source ~gitlab-runner/cicd_support/cicd_support.shinc" + + +after_script: + - "echo Test Complete." + +stages: + - clean + - build + - test + + + +# +# Cleaning +# + +#template +.do-clean: &do-nightly-clean + stage: clean + script: + - ./cicd_tests/do-clean.sh + +# per os items +do-nightly-clean-ubuntu18: + <<: *do-nightly-clean + tags: + - ubuntu18 + variables: + OS: 'ubuntu18' + +do-nightly-clean-ubuntu16: + <<: *do-nightly-clean + tags: + - ubuntu16 + variables: + OS: 'ubuntu16' + +do-nightly-clean-centos76: + <<: *do-nightly-clean + tags: + - centos76 + variables: + OS: 'centos76' + + +# +# building +# + + +# template +.do-build: &do-build + stage: build + script: + - ./cicd_tests/do-build.sh + + +# per os items +do-build-ubuntu18: + <<: *do-build + tags: + - ubuntu18 + variables: + OS: 'ubuntu18' + + +do-build-ubuntu16: + <<: *do-build + tags: + - ubuntu16 + variables: + OS: 'ubuntu16' + +do-build-centos76: + <<: *do-build + tags: + - centos76 + variables: + OS: 'centos76' + + +# +# simple test. +# + +# template +.simple: &simple + stage: test + script: + - ./cicd_tests/test-p1.sh + +simple-ubuntu16: + <<: *simple + tags: + - ubuntu16 + variables: + OS: 'ubuntu16' + +simple-ubuntu18: + <<: *simple + tags: + - ubuntu18 + variables: + OS: 'ubuntu18' + + diff --git a/cicd_tests/do-build.sh b/cicd_tests/do-build.sh new file mode 100755 index 0000000000000000000000000000000000000000..6368bdbe692a3a143e1e2dea7b8ddad114dee11f --- /dev/null +++ b/cicd_tests/do-build.sh @@ -0,0 +1,38 @@ +#/bin/bash + +set -e +set -x + +main() +{ + + # gather info for debugging later, probably not necessary + pwd + hostname + whoami + env|grep "^CICD" + + git submodule sync + git submodule update --init --recursive + + local orig_dir=$(pwd) + + # puts cfi_umbrella (and all submodules) in CICD_MODULE_WORK_DIR + cicd_setup_module_dependency allnp/peasoup_umbrella.git p1_umbrella + + # Build $PSZ, cleanup db. + cd $CICD_MODULE_WORK_DIR/p1_umbrella + source set_env_vars + sudo ./get-peasoup-packages.sh all + ./build-all.sh + dropdb $PGDATABASE 2>/dev/null || true ; ./postgres_setup.sh + + # build p1 dir + cd $orig_dir + time rsync -a --exclude='.git' $CICD_TO_TEST_DIR/ /tmp/p1_test + cd /tmp/p1_test + source set_env_var + scons -j 3 +} + +main "$@" diff --git a/cicd_tests/do-clean.sh b/cicd_tests/do-clean.sh new file mode 100755 index 0000000000000000000000000000000000000000..e8ad14832bba62a3fefa678daf181aba2c66b6f8 --- /dev/null +++ b/cicd_tests/do-clean.sh @@ -0,0 +1,23 @@ +#/bin/bash + +set -e +set -x + +main() +{ + + # gather info for debugging later, probably not necessary + pwd + hostname + whoami + env|grep "^CICD" + + + if [[ $CICD_NIGHTLY == 1 ]] ; then + rm -rf $CICD_MODULE_WORK_DIR/p1_umbrella + rm -rf /tmp/p1_test + fi + +} + +main "$@" diff --git a/cicd_tests/test-p1.sh b/cicd_tests/test-p1.sh new file mode 100755 index 0000000000000000000000000000000000000000..c32382bded5374a03b54b1368b2e8ff0521981d7 --- /dev/null +++ b/cicd_tests/test-p1.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e +set -x + +cd $CICD_MODULE_WORK_DIR/p1_umbrella +source set_env_vars +cd /tmp/p1_test +source set_env_var + + +main() +{ + cd $CICD_MODULE_WORK_DIR/p1_umbrella + cd examples + ./test_cmds.sh -c "rida_p1" -l -a "bzip2 tcpdump" + exit 0 +} + +main $*