From 2bc0dabaa5ce394fff91684f2621fed5ca976029 Mon Sep 17 00:00:00 2001 From: Jan Harkes Date: Mon, 10 Sep 2018 12:43:23 -0400 Subject: [PATCH] Add gitlab-ci --- .gitlab-ci.yml | 33 +++++++++++++++++++++++++++++++++ bootstrap.sh | 28 ++++++++++++++++++++++++++++ tools/Makefile.am | 3 ++- tools/version_check.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 .gitlab-ci.yml create mode 100755 tools/version_check.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..530d63f8a --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,33 @@ +variables: + DOCKER_DRIVER: overlay2 + +before_script: + - mkdir -p ccache + - export CCACHE_BASEDIR=${PWD} + - export CCACHE_DIR=${PWD}/ccache + - export PATH=/usr/lib/ccache:${PATH} + +cache: + paths: + - ccache/ + +sources: + stage: build + + # Use Debian-based official GCC image + # see https://hub.docker.com/_/gcc/ + image: gcc + + script: + - apt-get update -y -qq + - apt-get install -y -qq --no-install-recommends automake ccache bison flex pkg-config python systemd liblua5.1-0-dev libncurses5-dev libreadline-dev libuv1-dev + - tools/version_check.sh + - ./bootstrap.sh --fix-versions + - ./configure --prefix=/usr --with-lua + - make distcheck dist-xz + + artifacts: + expire_in: 1 week + paths: + - "coda-*.tar*" + diff --git a/bootstrap.sh b/bootstrap.sh index 4cd22acec..31117e8ea 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,2 +1,30 @@ #!/bin/sh + +ACINIT_RE='^\(AC_INIT([^,]*, \)\([^,]*\)\(.*)\)' +fixver () { + SUBSYS="$1" + + VERSION=$(git describe --match="$SUBSYS-*" | cut -d- -f2-) + RELEASE=$(echo $VERSION | cut -d- -f1) + + # any changes to the subdir since the last release tag? + [ -n "$(git diff $SUBSYS-$RELEASE lib-src/$SUBSYS)" ] || VERSION="$RELEASE" + + echo "$SUBSYS-$VERSION" + sed -i "s/$ACINIT_RE/\1$VERSION\3/" lib-src/$SUBSYS/configure.ac +} + +# Fix up Coda, LWP, RPC2, and RVM versions +if [ "$1" = "--fix-versions" ] ; then + CODA_VERSION=$(git describe --match="coda-*" | cut -d- -f2-) + + echo "coda-$CODA_VERSION" + sed -i "s/$ACINIT_RE/\1$CODA_VERSION\3/" configure.ac + + fixver lwp + fixver rpc2 + fixver rvm +fi + +# and rebuild configure files autoreconf --verbose --install --force diff --git a/tools/Makefile.am b/tools/Makefile.am index 80c4d5f4a..82b382cf2 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,6 +1,7 @@ ## Process this file with automake to produce Makefile.in -dist_noinst_SCRIPTS = make-split-dist.sh maketags pkg-bsd.sh find_unused_symbols.py +dist_noinst_SCRIPTS = make-split-dist.sh maketags pkg-bsd.sh \ + find_unused_symbols.py version_check.sh if HAVE_SYSTEMD dist_modulesload_DATA = diff --git a/tools/version_check.sh b/tools/version_check.sh new file mode 100755 index 000000000..dfe3879d7 --- /dev/null +++ b/tools/version_check.sh @@ -0,0 +1,41 @@ +#!/bin/sh +# +# Check if configure.ac versions match up with git tags and +# make sure that all subsystems have an uptodate release tag +# when we're building a new Coda release +# + +TAGGED_SUBSYS=$(echo $CI_COMMIT_TAG | cut -d- -f1) + +ACINIT_RE='^\(AC_INIT([^,]*, \)\([^,]*\)\(.*)\)' + +checkver () { + SUBSYS="$1" + SUBDIR="$2" + + # VERSION is git version (latest tag + # commits + commit sha) + # RELEASE is latest git tagged version + # CONFVER is configure.ac version + VERSION=$(git describe --match="$SUBSYS-*" | cut -d- -f2-) + RELEASE=$(echo $VERSION | cut -d- -f1) + CONFVER=$(sed -n "s/$ACINIT_RE/\2/p" $SUBDIR/configure.ac) + + # the configure.ac version should match the tagged version + if [ "$CONFVER" != "$RELEASE" ] ; then + echo "$SUBSYS: configure.ac version does not match git tag" + [ "$TAGGED_SUBSYS" = "$SUBSYS" ] && exit 1 + fi + + # are there changes since the last release tag? + if [ -n "$(git diff $SUBSYS-$RELEASE $SUBDIR)" ] + then + echo "$SUBSYS: untagged version $VERSION" + [ "$TAGGED_SUBSYS" = "coda" ] && exit 1 + fi +} + +checkver coda . +checkver lwp lib-src/lwp +checkver rpc2 lib-src/rpc2 +checkver rvm lib-src/rvm +exit 0