summaryrefslogtreecommitdiff
path: root/.gitlab-ci/generate-gitlab-ci.py
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2020-02-20 11:57:44 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2020-02-20 13:38:39 +1000
commitf5506d1f22c9147e09a331f956df7249da0fbca3 (patch)
tree55f3407d9252261e253b037fff55534ca970b547 /.gitlab-ci/generate-gitlab-ci.py
parentacc60b9fb0ec501f6a0ba51bd61c1c73b7307057 (diff)
downloadlibinput-f5506d1f22c9147e09a331f956df7249da0fbca3.tar.gz
gitlab CI: generate the CI script from a template
All the distro-specific stuff is the same template anyway, so let's generate this (like we already do in libevdev and the ci-templates). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to '.gitlab-ci/generate-gitlab-ci.py')
-rwxr-xr-x.gitlab-ci/generate-gitlab-ci.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/.gitlab-ci/generate-gitlab-ci.py b/.gitlab-ci/generate-gitlab-ci.py
new file mode 100755
index 00000000..5c382b9b
--- /dev/null
+++ b/.gitlab-ci/generate-gitlab-ci.py
@@ -0,0 +1,30 @@
+#!/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'},
+]
+
+
+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}
+ with open('.gitlab-ci.yml', 'w') as fd:
+ template.stream(config).dump(fd)
+
+
+if __name__ == '__main__':
+ generate_template()