gen-matrix-build.py 817 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/env python3
  2. import json
  3. from ruamel.yaml import YAML
  4. yaml = YAML(typ='safe')
  5. entries = []
  6. with open('.github/data/distros.yml') as f:
  7. data = yaml.load(f)
  8. for i, v in enumerate(data['include']):
  9. if v['test'].get('skip-local-build', False):
  10. continue
  11. e = {
  12. 'artifact_key': v['distro'] + str(v['version']).replace('.', ''),
  13. 'version': v['version'],
  14. }
  15. if 'base_image' in v:
  16. e['distro'] = v['base_image']
  17. else:
  18. e['distro'] = ':'.join([v['distro'], str(v['version'])])
  19. if 'env_prep' in v:
  20. e['env_prep'] = v['env_prep']
  21. if 'jsonc_removal' in v:
  22. e['jsonc_removal'] = v['jsonc_removal']
  23. entries.append(e)
  24. entries.sort(key=lambda k: k['distro'])
  25. matrix = json.dumps({'include': entries}, sort_keys=True)
  26. print(matrix)