file: Add an internal "mode"
[nbdkit.git] / .gitlab-ci.yml
blob6e3cda33a0aa1c2eb066df5872e106dfbcb17585
1 variables:
2   GIT_DEPTH: 100
3   DOCKER_DRIVER: overlay2
5 stages:
6   - containers
7   - builds
9 .script_variables: &script_variables |
10   export MAKEFLAGS="-j $(getconf _NPROCESSORS_ONLN)"
11   export CCACHE_BASEDIR="$(pwd)"
12   export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
13   export CCACHE_MAXSIZE="500M"
14   export PATH="$CCACHE_WRAPPERSDIR:$PATH"
16 include: '/ci/gitlab.yml'
18 .base_build_job:
19   stage: builds
20   cache:
21     paths:
22       - ccache/
23     key: "$CI_JOB_NAME"
24   before_script:
25     - *script_variables
26   script:
27     - ci/build.sh
28   artifacts:
29     paths:
30       - "config.log"
31       - "**/test-suite.log"
32     public: true
33     when: always
34     expire_in: 1 week
36 .native_build_job:
37   extends:
38     - .base_build_job
39     - .gitlab_native_build_job
41 .cross_build_job:
42   extends:
43     - .base_build_job
44     - .gitlab_cross_build_job
46 # Jobs that we delegate to Cirrus CI because they require an operating
47 # system other than Linux. These jobs will only run if the required
48 # setup has been performed on the GitLab account (see ci/README.rst).
50 # The Cirrus CI configuration is generated by replacing target-specific
51 # variables in a generic template: some of these variables are provided
52 # when the GitLab CI job is defined, others are taken from a shell
53 # snippet generated using lcitool.
55 # Note that the $PATH environment variable has to be treated with
56 # special care, because we can't just override it at the GitLab CI job
57 # definition level or we risk breaking it completely.
58 .cirrus_build_job:
59   stage: builds
60   image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:master
61   needs: []
62   script:
63     - source ci/cirrus/$NAME.vars
64     - sed -e "s|[@]CI_REPOSITORY_URL@|$CI_REPOSITORY_URL|g"
65           -e "s|[@]CI_COMMIT_REF_NAME@|$CI_COMMIT_REF_NAME|g"
66           -e "s|[@]CI_COMMIT_SHA@|$CI_COMMIT_SHA|g"
67           -e "s|[@]CIRRUS_VM_INSTANCE_TYPE@|$CIRRUS_VM_INSTANCE_TYPE|g"
68           -e "s|[@]CIRRUS_VM_IMAGE_SELECTOR@|$CIRRUS_VM_IMAGE_SELECTOR|g"
69           -e "s|[@]CIRRUS_VM_IMAGE_NAME@|$CIRRUS_VM_IMAGE_NAME|g"
70           -e "s|[@]UPDATE_COMMAND@|$UPDATE_COMMAND|g"
71           -e "s|[@]UPGRADE_COMMAND@|$UPGRADE_COMMAND|g"
72           -e "s|[@]INSTALL_COMMAND@|$INSTALL_COMMAND|g"
73           -e "s|[@]PATH@|$PATH_EXTRA${PATH_EXTRA:+:}\$PATH|g"
74           -e "s|[@]PKG_CONFIG_PATH@|$PKG_CONFIG_PATH|g"
75           -e "s|[@]PKGS@|$PKGS|g"
76           -e "s|[@]MAKE@|$MAKE|g"
77           -e "s|[@]PYTHON@|$PYTHON|g"
78           -e "s|[@]PIP3@|$PIP3|g"
79           -e "s|[@]PYPI_PKGS@|$PYPI_PKGS|g"
80       <ci/cirrus/build.yml >ci/cirrus/$NAME.yml
81     - cat ci/cirrus/$NAME.yml
82     - cirrus-run -v --show-build-log always ci/cirrus/$NAME.yml
83   rules:
84     - if: "$CIRRUS_GITHUB_REPO && $CIRRUS_API_TOKEN"