Skip to content

Commit b3e9060

Browse files
committed
CI: fix auto builds and make sure that we always have at least a single CI job
1 parent bf8bcc4 commit b3e9060

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

Diff for: .github/workflows/ci.yml

-8
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,6 @@ jobs:
7777
matrix:
7878
# Check the `calculate_matrix` job to see how is the matrix defined.
7979
include: ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }}
80-
# GitHub Actions fails the workflow if an empty list of jobs is provided to
81-
# the workflow, so we need to skip this job if nothing was produced by
82-
# the Python script.
83-
#
84-
# Unfortunately checking whether a list is empty is not possible in a nice
85-
# way due to GitHub Actions expressions limits.
86-
# This hack is taken from https://github.com/ferrocene/ferrocene/blob/d43edc6b7697cf1719ec1c17c54904ab94825763/.github/workflows/release.yml#L75-L82
87-
if: fromJSON(needs.calculate_matrix.outputs.jobs)[0] != null
8880
steps:
8981
- if: contains(matrix.os, 'windows')
9082
uses: msys2/[email protected]

Diff for: src/ci/github-actions/calculate-job-matrix.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def calculate_jobs(run_type: WorkflowRunType, job_data: Dict[str, Any]) -> List[
136136
raise Exception(f"Custom job(s) `{unknown_jobs}` not found in auto jobs")
137137

138138
return add_base_env(name_jobs(jobs, "try"), job_data["envs"]["try"])
139-
elif run_type is AutoRunType:
139+
elif isinstance(run_type, AutoRunType):
140140
return add_base_env(name_jobs(job_data["auto"], "auto"), job_data["envs"]["auto"])
141141

142142
return []
@@ -192,6 +192,10 @@ def format_run_type(run_type: WorkflowRunType) -> str:
192192
if run_type is not None:
193193
jobs = calculate_jobs(run_type, data)
194194
jobs = skip_jobs(jobs, channel)
195+
196+
if not jobs:
197+
raise Exception("Scheduled job list is empty, this is an error")
198+
195199
run_type = format_run_type(run_type)
196200

197201
logging.info(f"Output:\n{yaml.dump(dict(jobs=jobs, run_type=run_type), indent=4)}")

0 commit comments

Comments
 (0)