提交 cab35ae3 编写于 作者: A Andrea Bolognani

gitlab: Add script_variables and define $MAKEFLAGS there

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: NAndrea Bolognani <abologna@redhat.com>
Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 8018858d
...@@ -7,6 +7,8 @@ stages: ...@@ -7,6 +7,8 @@ stages:
- native_build - native_build
- cross_build - cross_build
.script_variables: &script_variables |
export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
# Common templates # Common templates
...@@ -18,6 +20,7 @@ stages: ...@@ -18,6 +20,7 @@ stages:
- ccache/ - ccache/
key: "$CI_JOB_NAME" key: "$CI_JOB_NAME"
before_script: before_script:
- *script_variables
- mkdir -p ccache - mkdir -p ccache
- export CC="ccache gcc" - export CC="ccache gcc"
- export CCACHE_BASEDIR=${PWD} - export CCACHE_BASEDIR=${PWD}
...@@ -26,7 +29,7 @@ stages: ...@@ -26,7 +29,7 @@ stages:
- mkdir build - mkdir build
- cd build - cd build
- ../autogen.sh || (cat config.log && exit 1) - ../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 # Extra native build jobs that are only run post-merge, or
# when code is pushed to a branch with "ci-full-" name prefix # when code is pushed to a branch with "ci-full-" name prefix
...@@ -45,6 +48,7 @@ stages: ...@@ -45,6 +48,7 @@ stages:
- ccache/ - ccache/
key: "$CI_JOB_NAME" key: "$CI_JOB_NAME"
before_script: before_script:
- *script_variables
- mkdir -p ccache - mkdir -p ccache
- export CC="ccache ${ABI}-gcc" - export CC="ccache ${ABI}-gcc"
- export CCACHE_BASEDIR=${PWD} - export CCACHE_BASEDIR=${PWD}
...@@ -53,7 +57,7 @@ stages: ...@@ -53,7 +57,7 @@ stages:
- mkdir build - mkdir build
- cd build - cd build
- ../autogen.sh $CONFIGURE_OPTS || (cat config.log && exit 1) - ../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 # Extra cross build jobs that are only run post-merge, or
# when code is pushed to a branch with "ci-full-" name prefix # when code is pushed to a branch with "ci-full-" name prefix
...@@ -163,12 +167,14 @@ mingw64-fedora-30: ...@@ -163,12 +167,14 @@ mingw64-fedora-30:
# https://gitlab.com/libvirt/libvirt/-/jobs/artifacts/master/download?job=website # https://gitlab.com/libvirt/libvirt/-/jobs/artifacts/master/download?job=website
website: website:
stage: prebuild stage: prebuild
before_script:
- *script_variables
script: script:
- mkdir build - mkdir build
- cd build - cd build
- ../autogen.sh --prefix=$(pwd)/../vroot || (cat config.log && exit 1) - ../autogen.sh --prefix=$(pwd)/../vroot || (cat config.log && exit 1)
- $MAKE -j $(getconf _NPROCESSORS_ONLN) -C docs - $MAKE -C docs
- $MAKE -j $(getconf _NPROCESSORS_ONLN) -C docs install - $MAKE -C docs install
- cd .. - cd ..
- mv vroot/share/doc/libvirt/html/ website - mv vroot/share/doc/libvirt/html/ website
image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest
...@@ -183,11 +189,13 @@ website: ...@@ -183,11 +189,13 @@ website:
codestyle: codestyle:
stage: prebuild stage: prebuild
before_script:
- *script_variables
script: script:
- mkdir build - mkdir build
- cd build - cd build
- ../autogen.sh || (cat config.log && exit 1) - ../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 image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest
...@@ -198,12 +206,14 @@ potfile: ...@@ -198,12 +206,14 @@ potfile:
stage: prebuild stage: prebuild
only: only:
- master - master
before_script:
- *script_variables
script: script:
- mkdir build - mkdir build
- cd build - cd build
- ../autogen.sh || (cat config.log && exit 1) - ../autogen.sh || (cat config.log && exit 1)
- $MAKE -j $(getconf _NPROCESSORS_ONLN) -C src generated-sources - $MAKE -C src generated-sources
- $MAKE -j $(getconf _NPROCESSORS_ONLN) -C po libvirt.pot - $MAKE -C po libvirt.pot
- cd .. - cd ..
- mv build/po/libvirt.pot libvirt.pot - mv build/po/libvirt.pot libvirt.pot
image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest
...@@ -222,6 +232,8 @@ potfile: ...@@ -222,6 +232,8 @@ potfile:
dco: dco:
stage: prebuild stage: prebuild
image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest image: quay.io/libvirt/buildenv-libvirt-fedora-31:latest
before_script:
- *script_variables
script: script:
- ./scripts/require-dco.py - ./scripts/require-dco.py
only: only:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册