gitlab CI: move the configuration bits into a YAML file

Only one change: the meson boolean to decide whether to build with meson is
now inside the build: block.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2020-02-21 09:05:04 +10:00
parent 12211d452a
commit f26679c6eb
4 changed files with 47 additions and 35 deletions

View file

@ -130,7 +130,7 @@ check-ci-script:
stage: prep
before_script:
- apk add python3 git
- pip3 install --user jinja2
- pip3 install --user jinja2 PyYAML
script:
- python3 ./.gitlab-ci/generate-gitlab-ci.py
- git diff --exit-code && exit 0 || true

View file

@ -7,53 +7,27 @@ import argparse
import jinja2
import os
import sys
import yaml
from pathlib import Path
distributions = [
{'name': 'fedora', 'version': '30'},
{'name': 'fedora', 'version': '31'},
{'name': 'ubuntu', 'version': '19.10'},
{'name': 'ubuntu', 'version': '19.04'},
{'name': 'debian', 'version': 'stable'},
{'name': 'debian', 'version': 'sid'},
{
'name': 'centos', 'version': '7',
'build': {
'extra_variables': {
'MAKE_ARGS': ('\'\' # disable distcheck, requires doxygen'),
}
},
'meson': False
},
{
'name': 'centos', 'version': '8',
'build': {
'extra_variables': {
'MAKE_ARGS': ('\'\' # disable distcheck, requires doxygen'),
}
},
'meson': False
},
{'name': 'arch', 'version': 'rolling',
'flavor': 'archlinux' }, # see https://gitlab.freedesktop.org/wayland/ci-templates/merge_requests/19
{'name': 'alpine', 'version': 'latest'},
]
# The various sources for templating
SOURCE_DIR = Path('.gitlab-ci')
CONFIG_FILE = 'gitlab-ci-config.yaml'
TEMPLATE_FILE = 'gitlab-ci.tmpl'
BASE_DIR = Path('.')
OUTPUT_FILE = '.gitlab-ci.yml'
def generate_template():
with open(SOURCE_DIR / CONFIG_FILE) as fd:
config = yaml.safe_load(fd)
env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.fspath(SOURCE_DIR)),
trim_blocks=True, lstrip_blocks=True)
template = env.get_template(TEMPLATE_FILE)
config = {'distributions': distributions}
with open(BASE_DIR / OUTPUT_FILE, 'w') as fd:
template.stream(config).dump(fd)

View file

@ -0,0 +1,38 @@
# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0:
#
# This file contains the configuration for the gitlab ci.
# See the .gitlab-ci/generate-gitlab-ci.py file for more info
distributions:
- name: fedora
version: '30'
- name: fedora
version: '31'
- name: ubuntu
version: '19.10'
- name: ubuntu
version: '19.04'
- name: debian
version: 'stable'
- name: debian
version: 'sid'
- name: centos
version: 7
build:
meson: False
extra_variables:
# note: the variable value includes the comment because we want that in the gitlab-ci file
MAKE_ARGS: "'' # disable distcheck, requires doxygen"
- name: centos
version: 8
build:
meson: False
extra_variables:
# note: the variable value includes the comment because we want that in the gitlab-ci file
MAKE_ARGS: "'' # disable distcheck, requires doxygen"
- name: arch
version: 'rolling'
flavor: 'archlinux' # see https://gitlab.freedesktop.org/wayland/ci-templates/merge_requests/19
- name: alpine
version: 'latest'

View file

@ -132,7 +132,7 @@ check-ci-script:
stage: prep
before_script:
- apk add python3 git
- pip3 install --user jinja2
- pip3 install --user jinja2 PyYAML
script:
- python3 ./.gitlab-ci/generate-gitlab-ci.py
- git diff --exit-code && exit 0 || true
@ -343,7 +343,7 @@ fedora:31@qemu-prep:
{% endif %}
needs: ['{{ distro.name }}:{{ distro.version }}@container-prep']
{% if distro.meson|default(True) %}
{% if not distro.build is defined or distro.build.meson|default(True) %}
{{ distro.name }}:{{ distro.version }}@meson-build:
extends: .meson-build@template
stage: meson