summaryrefslogtreecommitdiff
path: root/.gitlab-ci/generate-gitlab-ci.py
blob: b3a050757fce4f41febbc6fea35e6ed4d89d1567 (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
43
44
45
46
47
48
49
50
51
52
53
#!/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',
        'build': {
            'extra_variables': [
                'MESON_ARGS: \'-Ddocumentation=false\' # alpine does not have python-recommonmark',
                # We don't run the tests on alpine. The litest-selftest fails
                # for any tcase_add_exit_test/tcase_add_test_raise_signal
                # but someone more invested in musl will have to figure that out.
                'MESON_TEST_ARGS: \'\' # litest-selftest fails on musl',
            ]
        },
    }
]

# 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()