1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 04:18:10 +00:00

feat(tests): update_fixtures.py: github run_id

[no changelog]
This commit is contained in:
Martin Milata 2024-06-06 15:58:19 +02:00
parent 3760dd307c
commit 6ff7322408
2 changed files with 7 additions and 2 deletions

View File

@ -27,6 +27,7 @@ def get_branch_ui_fixtures_results(
branch_name: str, branch_name: str,
only_jobs: Iterable[str] | None, only_jobs: Iterable[str] | None,
exclude_jobs: Iterable[str] | None, exclude_jobs: Iterable[str] | None,
run_id: int | None,
) -> dict[str, AnyDict]: ) -> dict[str, AnyDict]:
print(f"Checking branch {branch_name}") print(f"Checking branch {branch_name}")
@ -34,7 +35,7 @@ def get_branch_ui_fixtures_results(
LIST_RUNS_TEMPLATE.format(branch=branch_name, workflow="core.yml") LIST_RUNS_TEMPLATE.format(branch=branch_name, workflow="core.yml")
) )
response.raise_for_status() response.raise_for_status()
run_id = response.json()["workflow_runs"][0]["id"] run_id = run_id or response.json()["workflow_runs"][0]["id"]
def yield_key_value() -> Iterator[tuple[str, AnyDict]]: def yield_key_value() -> Iterator[tuple[str, AnyDict]]:
for model in MODELS: for model in MODELS:

View File

@ -42,6 +42,7 @@ def _get_current_git_branch() -> str:
help="Fetch from GitHub Actions instead of GitLab CI", help="Fetch from GitHub Actions instead of GitLab CI",
) )
@click.option("-b", "--branch", help="Branch name") @click.option("-b", "--branch", help="Branch name")
@click.option("-r", "--run-id", help="GitHub Actions run id", type=int)
@click.option( @click.option(
"-o", "-o",
"--only-jobs", "--only-jobs",
@ -58,6 +59,7 @@ def _get_current_git_branch() -> str:
def ci( def ci(
github: bool, github: bool,
branch: str | None, branch: str | None,
run_id: int | None,
only_jobs: Iterable[str] | None, only_jobs: Iterable[str] | None,
exclude_jobs: Iterable[str] | None, exclude_jobs: Iterable[str] | None,
remove_missing: bool, remove_missing: bool,
@ -80,7 +82,9 @@ def ci(
if github: if github:
from github import get_branch_ui_fixtures_results from github import get_branch_ui_fixtures_results
ui_results = get_branch_ui_fixtures_results(branch, only_jobs, exclude_jobs) ui_results = get_branch_ui_fixtures_results(
branch, only_jobs, exclude_jobs, run_id
)
else: else:
from gitlab import get_branch_ui_fixtures_results, get_jobs_of_interest from gitlab import get_branch_ui_fixtures_results, get_jobs_of_interest