File: github-ci-vars.py

package info (click to toggle)
python-drf-spectacular 0.28.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,748 kB
  • sloc: python: 14,174; javascript: 114; sh: 61; makefile: 30
file content (26 lines) | stat: -rw-r--r-- 743 bytes parent folder | download | duplicates (3)
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
import datetime
import json
import os
import re
import subprocess

envs = subprocess.check_output(['tox', '-l']).decode().rstrip().split('\n')
matrix = []

for env in envs:
    version = re.search(r'^py(?P<major>\d)(?P<minor>\d+)-', env)

    # github "commit" checks will fail even though workflow passes overall.
    # temp remove the optional targets to make github CI work.
    if 'master' in env:
        continue

    matrix.append({
        'toxenv': env,
        'python-version': f'{version.group("major")}.{version.group("minor")}',
        'experimental': bool('master' in env)
    })

with open(os.environ['GITHUB_OUTPUT'], "a") as fh:
    fh.write(f"date={datetime.date.today()}\n")
    fh.write(f"matrix={json.dumps(matrix)}\n")