summaryrefslogtreecommitdiff
path: root/.gitlab-ci/generate-gitlab-ci.py
blob: e8be754f5406cd45cf7161d0f4abe4f14cbc2e56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
# vim: set expandtab shiftwidth=4:

# This file generates the .gitlab-ci.yml file that defines the pipeline.

import jinja2

distributions = [
    {'name': 'fedora', 'version': '30'},
    {'name': 'fedora', 'version': '31'},
    {'name': 'ubuntu', 'version': '19.10'},
    {'name': 'ubuntu', 'version': '19.04'},
    {'name': 'arch', 'version': 'rolling',
     'flavor': 'archlinux'},  # see https://gitlab.freedesktop.org/wayland/ci-templates/merge_requests/19
    {'name': 'alpine', 'version': 'latest'},
]

# in reverse order of duration to get the slowest ones started first
test_suites = [
    {'name': 'touchpad', 'suites': 'touchpad'},
    {'name': 'tap', 'suites': 'tap'},
    {'name': 'tablet', 'suites': 'tablet'},
    {'name': 'gestures-device', 'suites': 'gestures device'},
    {'name': 'others',
     'suites': 'context config misc events totem udev lid log timer tablet-mode quirks trackball pad path keyboard switch touch trackpoint'},
    {'name': 'pointer', 'suites': 'pointer'}
]


def generate_template():
    env = jinja2.Environment(loader=jinja2.FileSystemLoader('./.gitlab-ci'),
                             trim_blocks=True, lstrip_blocks=True)

    template = env.get_template('gitlab-ci.tmpl')
    config = {'distributions': distributions,
              'test_suites': test_suites}
    with open('.gitlab-ci.yml', 'w') as fd:
        template.stream(config).dump(fd)


if __name__ == '__main__':
    generate_template()