mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2026-03-13 08:10:39 +08:00
Build list of required jobs in generate-workflow (#4326)
* Build list of required jobs in generate-workflow Dump the list of all the jobs in the same format that is required for configuration in opentelemetry-admin terraform config files so that we don't miss required jobs. * Serialize also misc jobs * Document what this script is about
This commit is contained in:
committed by
GitHub
parent
78c948b15f
commit
22879d6b9f
42
.github/workflows/generate_required_checks.py
vendored
Normal file
42
.github/workflows/generate_required_checks.py
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"""
|
||||
This script builds a text file with the list of required checks based on
|
||||
the tox environments. Similarly to the system we are using to build the
|
||||
github workflows.
|
||||
The output is in the format than can be cut-and-pasted into the python-contrib
|
||||
terraform configuration in the admin repository.
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from generate_workflows_lib import (
|
||||
get_lint_job_datas,
|
||||
get_misc_job_datas,
|
||||
get_test_job_datas,
|
||||
get_tox_envs,
|
||||
)
|
||||
|
||||
tox_ini_path = Path(__file__).parent.parent.parent.joinpath("tox.ini")
|
||||
|
||||
|
||||
def get_gh_contexts_from_jobs(job_datas):
|
||||
def get_job_name(job):
|
||||
if isinstance(job, str):
|
||||
return job
|
||||
return job["ui_name"]
|
||||
|
||||
return [
|
||||
f""" {{ context = "{get_job_name(job)}" }},\n"""
|
||||
for job in job_datas
|
||||
]
|
||||
|
||||
|
||||
jobs = sorted(
|
||||
get_gh_contexts_from_jobs(get_lint_job_datas(get_tox_envs(tox_ini_path)))
|
||||
+ get_gh_contexts_from_jobs(
|
||||
get_test_job_datas(get_tox_envs(tox_ini_path), ["ubuntu-latest"])
|
||||
)
|
||||
+ get_gh_contexts_from_jobs(get_misc_job_datas(get_tox_envs(tox_ini_path)))
|
||||
)
|
||||
with open("opentelemetry-admin-jobs.txt", "w") as f:
|
||||
for job in jobs:
|
||||
f.write(job)
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -61,3 +61,6 @@ target
|
||||
|
||||
# Benchmark result files
|
||||
*-benchmark.json
|
||||
|
||||
# opentelemetry-admin jobs
|
||||
opentelemetry-admin-jobs.txt
|
||||
|
||||
Reference in New Issue
Block a user