summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Bolognani <abologna@redhat.com>2020-03-27 16:40:05 +0100
committerAndrea Bolognani <abologna@redhat.com>2020-03-27 19:08:50 +0100
commitcab35ae380633eb0099e15427be6f8537a8a9fff (patch)
treeb29b314aef7fdfbec168bcaaf7474ee5582ddd92
parent8018858d23abc3423bfe4384750d0522371051d7 (diff)
downloadlibvirt-cab35ae380633eb0099e15427be6f8537a8a9fff.tar.gz
gitlab: Add script_variables and define $MAKEFLAGS therev6.2.0-rc1
This new template provides a standardized place where environment variables which are not static, but rather depend on the output of some shell command, can be defined for later use. This pattern is already used in libosinfo's GitLab CI integration. Defining $MAKEFLAGS there means we don't need to call getconf over and over, and the actual build steps don't end up drowned in the noise. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-rw-r--r--.gitlab-ci.yml26
1 files changed, 19 insertions, 7 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1e3675ace0..beeae1df05 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,6 +7,8 @@ stages:
- native_build
- cross_build
+.script_variables: &script_variables |
+ export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
# Common templates
@@ -18,6 +20,7 @@ stages:
- ccache/
key: "$CI_JOB_NAME"
before_script:
+ - *script_variables
- mkdir -p ccache
- export CC="ccache gcc"
- export CCACHE_BASEDIR=${PWD}
@@ -26,7 +29,7 @@ stages:
- mkdir build
- cd build
- ../autogen.sh || (cat config.log && exit 1)
- - $MAKE -j $(getconf _NPROCESSORS_ONLN) distcheck
+ - $MAKE distcheck
# Extra native build jobs that are only run post-merge, or
# when code is pushed to a branch with "ci-full-" name prefix
@@ -45,6 +48,7 @@ stages:
- ccache/
key: "$CI_JOB_NAME"
before_script:
+ - *script_variables
- mkdir -p ccache
- export CC="ccache ${ABI}-gcc"
- export CCACHE_BASEDIR=${PWD}
@@ -53,7 +57,7 @@ stages:
- mkdir build
- cd build
- ../autogen.sh $CONFIGURE_OPTS || (cat config.log && exit 1)
- - $MAKE -j $(getconf _NPROCESSORS_ONLN)
+ - $MAKE
# Extra cross build jobs that are only run post-merge, or
# when code is pushed to a branch with "ci-full-" name prefix
@@ -163,12 +167,14 @@ mingw64-fedora-30:
# https://gitlab.com/libvirt/libvirt/-/jobs/artifacts/master/download?job=website
website:
stage: prebuild
+ before_script:
+ - *script_variables
script:
- mkdir build
- cd build
- ../autogen.sh --prefix=$(pwd)/../vroot || (cat config.log && exit 1)
- - $MAKE -j $(getconf _NPROCESSORS_ONLN) -C docs
- - $MAKE -j $(getconf _NPROCESSORS_ONLN) -C docs install
+ - $MAKE -C docs
+ - $MAKE -C docs install
- cd ..
- mv vroot/share/doc/libvirt/html/ website
image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest
@@ -183,11 +189,13 @@ website:
codestyle:
stage: prebuild
+ before_script:
+ - *script_variables
script:
- mkdir build
- cd build
- ../autogen.sh || (cat config.log && exit 1)
- - $MAKE -j $(getconf _NPROCESSORS_ONLN) syntax-check
+ - $MAKE syntax-check
image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest
@@ -198,12 +206,14 @@ potfile:
stage: prebuild
only:
- master
+ before_script:
+ - *script_variables
script:
- mkdir build
- cd build
- ../autogen.sh || (cat config.log && exit 1)
- - $MAKE -j $(getconf _NPROCESSORS_ONLN) -C src generated-sources
- - $MAKE -j $(getconf _NPROCESSORS_ONLN) -C po libvirt.pot
+ - $MAKE -C src generated-sources
+ - $MAKE -C po libvirt.pot
- cd ..
- mv build/po/libvirt.pot libvirt.pot
image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest
@@ -222,6 +232,8 @@ potfile:
dco:
stage: prebuild
image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest
+ before_script:
+ - *script_variables
script:
- ./scripts/require-dco.py
only: