diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2024-04-23 15:02:23 +0200 |
|---|---|---|
| committer | Jakub Beránek <berykubik@gmail.com> | 2024-04-24 11:09:42 +0200 |
| commit | 2a7fe14acd4b4da3623797166b81aa35d6704508 (patch) | |
| tree | d3c6d8736f9e5a4cb06445e0b816995a3b8cd439 /src/ci/github-actions | |
| parent | e7da0fa62fc58f9d665a67bf2e7a6d6154d8d74c (diff) | |
| download | rust-2a7fe14acd4b4da3623797166b81aa35d6704508.tar.gz rust-2a7fe14acd4b4da3623797166b81aa35d6704508.zip | |
Use a type alias for a CI job
Diffstat (limited to 'src/ci/github-actions')
| -rwxr-xr-x | src/ci/github-actions/calculate-job-matrix.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ci/github-actions/calculate-job-matrix.py b/src/ci/github-actions/calculate-job-matrix.py index c24cefa8d89..a54081f83f1 100755 --- a/src/ci/github-actions/calculate-job-matrix.py +++ b/src/ci/github-actions/calculate-job-matrix.py @@ -19,8 +19,10 @@ import yaml JOBS_YAML_PATH = Path(__file__).absolute().parent / "jobs.yml" +Job = Dict[str, Any] -def name_jobs(jobs: List[Dict], prefix: str) -> List[Dict]: + +def name_jobs(jobs: List[Dict], prefix: str) -> List[Job]: """ Add a `name` attribute to each job, based on its image and the given `prefix`. """ @@ -29,7 +31,7 @@ def name_jobs(jobs: List[Dict], prefix: str) -> List[Dict]: return jobs -def add_base_env(jobs: List[Dict], environment: Dict[str, str]) -> List[Dict]: +def add_base_env(jobs: List[Job], environment: Dict[str, str]) -> List[Job]: """ Prepends `environment` to the `env` attribute of each job. The `env` of each job has higher precedence than `environment`. @@ -77,7 +79,7 @@ def find_job_type(ctx: GitHubCtx) -> Optional[JobType]: return None -def calculate_jobs(job_type: JobType, job_data: Dict[str, Any]) -> List[Dict[str, Any]]: +def calculate_jobs(job_type: JobType, job_data: Dict[str, Any]) -> List[Job]: if job_type == JobType.PR: return add_base_env(name_jobs(job_data["pr"], "PR"), job_data["envs"]["pr"]) elif job_type == JobType.Try: |
