Skip to content

Commit

Permalink
Add gitlab-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jaharkes committed Sep 11, 2018
1 parent df8696d commit 2bc0dab
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 1 deletion.
33 changes: 33 additions & 0 deletions .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*"

28 changes: 28 additions & 0 deletions 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
3 changes: 2 additions & 1 deletion 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 =
Expand Down
41 changes: 41 additions & 0 deletions 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

0 comments on commit 2bc0dab

Please sign in to comment.