053cfb139396cb8d06d4478859e93e0a623feb6a
[platform/upstream/libinput.git] / .gitlab-ci / generate-gitlab-ci.py
1 #!/usr/bin/env python3
2 # vim: set expandtab shiftwidth=4:
3
4 # This file generates the .gitlab-ci.yml file that defines the pipeline.
5
6 import jinja2
7
8 distributions = [
9     {'name': 'fedora', 'version': '30'},
10     {'name': 'fedora', 'version': '31'},
11     {'name': 'ubuntu', 'version': '19.10'},
12     {'name': 'ubuntu', 'version': '19.04'},
13     {'name': 'arch', 'version': 'rolling'},
14     {
15         'name': 'alpine', 'version': 'latest',
16         'build': {
17             'extra_variables': [
18                 'MESON_ARGS: \'-Ddocumentation=false\' # alpine does not have python-recommonmark',
19                 # We don't run the tests on alpine. The litest-selftest fails
20                 # for any tcase_add_exit_test/tcase_add_test_raise_signal
21                 # but someone more invested in musl will have to figure that out.
22                 'MESON_TEST_ARGS: \'\' # litest-selftest fails on musl',
23             ]
24         },
25     }
26 ]
27
28 templates = sorted(set([x['name'] for x in distributions]))
29
30 # in reverse order of duration to get the slowest ones started first
31 test_suites = [
32     {'name': 'touchpad', 'suites': 'touchpad'},
33     {'name': 'tap', 'suites': 'tap'},
34     {'name': 'tablet', 'suites': 'tablet'},
35     {'name': 'gestures-device', 'suites': 'gestures device'},
36     {'name': 'others',
37      'suites': 'context config misc events totem udev lid log timer tablet-mode quirks trackball pad path keyboard switch touch trackpoint'},
38     {'name': 'pointer', 'suites': 'pointer'}
39 ]
40
41
42 def generate_template():
43     env = jinja2.Environment(loader=jinja2.FileSystemLoader('./.gitlab-ci'),
44                              trim_blocks=True, lstrip_blocks=True)
45
46     template = env.get_template('gitlab-ci.tmpl')
47     config = {'distributions': distributions,
48               'test_suites': test_suites,
49               'templates': templates}
50     with open('.gitlab-ci.yml', 'w') as fd:
51         template.stream(config).dump(fd)
52
53
54 if __name__ == '__main__':
55     generate_template()