summaryrefslogtreecommitdiff
path: root/.gitlab-ci/generate-gitlab-ci.py
blob: 053cfb139396cb8d06d4478859e93e0a623feb6a (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
54
55
#!/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'},
    {
        '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',
            ]
        },
    }
]

templates = sorted(set([x['name'] for x in distributions]))

# 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,
              'templates': templates}
    with open('.gitlab-ci.yml', 'w') as fd:
        template.stream(config).dump(fd)


if __name__ == '__main__':
    generate_template()