Skip to content

Commit

Permalink
Fix self hosted vs github hosted
Browse files Browse the repository at this point in the history
  • Loading branch information
dwoz committed Nov 9, 2024
1 parent f4349b7 commit 8edbb65
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tools/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ def runner_types(ctx: Context, event_name: str):
time.sleep(1)

ctx.info("Selecting which type of runners(self hosted runners or not) to run")
runners = {"github-hosted": False, "self-hosted": False}
runners = {"github-hosted": False, "self-hosted": False, "linux-arm64": False}
if "LINUX_ARM_RUNNER" in os.environ and os.environ["LINUX_ARM_RUNNER"] != "0":
runners["linux-arm64"] = True
if event_name == "pull_request":
ctx.info("Running from a pull request event")
pr_event_data = gh_event["pull_request"]
Expand Down Expand Up @@ -224,12 +226,13 @@ def runner_types(ctx: Context, event_name: str):
):
# This is running on a forked repository, don't run tests
ctx.info("The push event is on a forked repository")
runners["github-hosted"] = True
ctx.info("Writing 'runners' to the github outputs file:\n", runners)
with open(github_output, "a", encoding="utf-8") as wfh:
wfh.write(f"runners={json.dumps(runners)}\n")
ctx.exit(0)

if os.environ.get("FORK_HAS_SELF_HOSTED_RUNNERS", "0") == "1":
# This is running on a forked repository, don't run tests
runners["github-hosted"] = runners["self-hosted"] = True
ctx.info("Writing 'runners' to the github outputs file:\n", runners)
with open(github_output, "a", encoding="utf-8") as wfh:
wfh.write(f"runners={json.dumps(runners)}\n")
ctx.exit(0)
# Not running on a fork, or the fork has self hosted runners, run everything
ctx.info(f"The {event_name!r} event is from the main repository")
runners["github-hosted"] = runners["self-hosted"] = True
Expand Down

0 comments on commit 8edbb65

Please sign in to comment.