From: Simon Ruderich Date: Sat, 3 Aug 2019 18:18:35 +0000 (+0200) Subject: Add .gitlab-ci.yml to run tests in Docker container X-Git-Tag: 0.1~21 X-Git-Url: https://ruderich.org/simon/gitweb/?p=nsscash%2Fnsscash.git;a=commitdiff_plain;h=6f8646c1e90bbe0624ff28f1d3263f2b6b17c8ea Add .gitlab-ci.yml to run tests in Docker container --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..6442ec4 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,31 @@ +.template-docker: &template-docker + before_script: + - apt-get update + - apt-get install --no-install-recommends --yes golang golang-golang-x-tools golang-github-pkg-errors-dev golang-github-burntsushi-toml-dev build-essential clang git + script: + - 'test -z "$GOPATH" && export GOPATH=/usr/share/gocode' + # Run as user nobody so CAP_DAC_OVERRIDE is dropped and the tests can + # chmod a file 0000 to force "permission denied" errors. + - export HOME=/tmp # writable by nobody + - chown -R nobody . + # Empty TEST_* as -fsanitize doesn't work in a Docker container + - runuser -p -u nobody -- make TEST_CFLAGS= TEST_LDFLAGS= + - runuser -p -u nobody -- make test TEST_CFLAGS= TEST_LDFLAGS= + - 'test -z "$(git clean -nd)"' # any untracked files left? + - runuser -p -u nobody -- make clean + - 'test -z "$(git clean -ndx)"' # any unignored files left? + # Build with clang + - runuser -p -u nobody -- make CC=clang TEST_CFLAGS= TEST_LDFLAGS= + - runuser -p -u nobody -- make test CC=clang TEST_CFLAGS= TEST_LDFLAGS= + +debian-stable: + <<: *template-docker + image: debian:stable + +debian-testing: + <<: *template-docker + image: debian:testing + +debian-sid: + <<: *template-docker + image: debian:sid