From e7d9779dfc3748f8f205585fa09ebc7181874642 Mon Sep 17 00:00:00 2001 From: Olaf Meeuwissen Date: Sat, 17 Jun 2017 12:38:21 +0900 Subject: [PATCH] CI: Build `git describe` versioned snapshot tarballs This: - modifies `configure.ac` to get a version number courtesy of `git` when `autoconf` is run - runs a `make dist` when all compilation targets succeed - makes the resulting tarball available as a build artifact - renames the various pipeline stages --- .gitlab-ci.yml | 55 +++++++++++++++++++++++++++++++++++++------------- configure.ac | 2 +- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 689e06e54..5e4dd7522 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,42 +9,69 @@ variables: CONFIGURE_FULL: "--with-usb --enable-avahi --enable-pnm-backend" stages: - - lint - - build + - prepare + - compile + - archive -lint: - stage: lint +prepare: + image: $REGISTRY_HUB:debian-8-base + stage: prepare script: - find -path ./.git -prune -o -type f | xargs tools/style-check.sh + - sed -i '/^AC_INIT/s/,.*/,m4_esyscmd_s([git describe --dirty]),/' configure.ac + - autoconf --force + artifacts: + paths: + - configure + expire_in: 1 day -.build_template: &build_definition - stage: build +.compile_template: &compile_definition + stage: compile script: - ./configure $CONFIGURE_OPTS - make -j2 -k $MAKE_FLAGS -build:debian-8-mini: +compile:debian-8-mini: image: $REGISTRY_HUB:debian-8-mini variables: CONFIGURE_OPTS: "$CONFIGURE_MINI" MAKE_FLAGS: "CFLAGS=-Werror" - <<: *build_definition + <<: *compile_definition -build:debian-8-full: +compile:debian-8-full: image: $REGISTRY_HUB:debian-8-full variables: CONFIGURE_OPTS: "$CONFIGURE_MINI $CONFIGURE_FULL" MAKE_FLAGS: "CFLAGS=-Werror" - <<: *build_definition + <<: *compile_definition + cache: + untracked: true + artifacts: + paths: + - configure + expire_in: 1 day -build:alpine-3.6-musl: +compile:alpine-3.6-musl: image: $REGISTRY_HUB:alpine-3.6-musl variables: CONFIGURE_OPTS: "$CONFIGURE_MINI $CONFIGURE_FULL" - <<: *build_definition + <<: *compile_definition -build:fedora-25-clang: +compile:fedora-25-clang: image: $REGISTRY_HUB:fedora-25-clang variables: CONFIGURE_OPTS: "$CONFIGURE_MINI $CONFIGURE_FULL" - <<: *build_definition + <<: *compile_definition + +archive: + stage: archive + image: $REGISTRY_HUB:debian-8-full + dependencies: + - compile:debian-8-full + before_script: + - ./config.status --quiet || ./configure "$CONFIGURE_MINI" + script: + - make dist + artifacts: + paths: + - sane-backends-*.tar.gz diff --git a/configure.ac b/configure.ac index c02fe8476..ca62b20e8 100644 --- a/configure.ac +++ b/configure.ac @@ -27,7 +27,7 @@ AS_IF([test x = "x`echo $VERSION | sed 's/[[.0-9]]//g'`"], [is_release=no]) V_MAJOR=`echo $VERSION | $AWK -F. '{print $1}'` V_MINOR=`echo $VERSION | $AWK -F. '{print $2}'` -V_REV=`echo $VERSION | $AWK -F. '{print $3}' | sed 's/[[^0-9]]//g'`; +V_REV=`echo $VERSION | $AWK -F. '{print $3}' | sed 's/^\([[0-9]]*\).*/\1/'`; AC_DEFINE_UNQUOTED(SANE_DLL_V_MAJOR, $V_MAJOR, [SANE DLL major number]) AC_DEFINE_UNQUOTED(SANE_DLL_V_MINOR, $V_MINOR, [SANE DLL minor number])