Skip to content

Commit 6c3aab0

Browse files
committed
simulate failure in public-symbols-check
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
1 parent 190ba8e commit 6c3aab0

3 files changed

Lines changed: 22 additions & 25 deletions

File tree

.github/workflows/generate_workflows.py

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,14 @@ def _generate_workflow(
141141
template_name: str,
142142
output_dir: Path,
143143
max_jobs: int = 250,
144-
) -> list:
144+
) -> int:
145145
"""Generate reusable workflow files, returns list of file numbers."""
146146
# GitHub limits workflows to 256 jobs per file. We use a lower default
147147
# (250)
148148
chunks = [
149149
job_datas[index : index + max_jobs]
150150
for index in range(0, len(job_datas), max_jobs)
151151
]
152-
file_numbers = []
153152
env = Environment(
154153
loader=FileSystemLoader(Path(__file__).parent.joinpath("templates"))
155154
)
@@ -163,13 +162,12 @@ def _generate_workflow(
163162
)
164163
)
165164
yml_file.write("\n")
166-
file_numbers.append(file_number)
167-
return file_numbers
165+
return len(chunks)
168166

169167

170168
def generate_test_workflow(
171169
tox_ini_path: Path, workflow_directory_path: Path, operating_systems
172-
) -> list:
170+
) -> int:
173171
return _generate_workflow(
174172
get_test_job_datas(get_tox_envs(tox_ini_path), operating_systems),
175173
"test",
@@ -180,7 +178,7 @@ def generate_test_workflow(
180178
def generate_lint_workflow(
181179
tox_ini_path: Path,
182180
workflow_directory_path: Path,
183-
) -> list:
181+
) -> int:
184182
return _generate_workflow(
185183
get_lint_job_datas(get_tox_envs(tox_ini_path)),
186184
"lint",
@@ -191,7 +189,7 @@ def generate_lint_workflow(
191189
def generate_misc_workflow(
192190
tox_ini_path: Path,
193191
workflow_directory_path: Path,
194-
) -> list:
192+
) -> int:
195193
return _generate_workflow(
196194
get_misc_job_datas(get_tox_envs(tox_ini_path)),
197195
"misc",
@@ -200,9 +198,9 @@ def generate_misc_workflow(
200198

201199

202200
def generate_ci_workflow(
203-
test_file_numbers: list,
204-
lint_file_numbers: list,
205-
misc_file_numbers: list,
201+
test_count: int,
202+
lint_count: int,
203+
misc_count: int,
206204
output_dir: Path,
207205
) -> None:
208206
"""Generate the parent CI orchestrator workflow."""
@@ -215,9 +213,9 @@ def generate_ci_workflow(
215213
)
216214
.get_template("ci.yml.j2")
217215
.render(
218-
test_file_numbers=test_file_numbers,
219-
lint_file_numbers=lint_file_numbers,
220-
misc_file_numbers=misc_file_numbers,
216+
test_count=test_count,
217+
lint_count=lint_count,
218+
misc_count=misc_count,
221219
)
222220
)
223221
ci_yml_file.write("\n")
@@ -226,11 +224,9 @@ def generate_ci_workflow(
226224
if __name__ == "__main__":
227225
tox_ini_path = Path(__file__).parent.parent.parent.joinpath("tox.ini")
228226
output_dir = Path(__file__).parent
229-
test_file_numbers = generate_test_workflow(
227+
test_count = generate_test_workflow(
230228
tox_ini_path, output_dir, ["ubuntu-latest", "windows-latest"]
231229
)
232-
lint_file_numbers = generate_lint_workflow(tox_ini_path, output_dir)
233-
misc_file_numbers = generate_misc_workflow(tox_ini_path, output_dir)
234-
generate_ci_workflow(
235-
test_file_numbers, lint_file_numbers, misc_file_numbers, output_dir
236-
)
230+
lint_count = generate_lint_workflow(tox_ini_path, output_dir)
231+
misc_count = generate_misc_workflow(tox_ini_path, output_dir)
232+
generate_ci_workflow(test_count, lint_count, misc_count, output_dir)

.github/workflows/templates/ci.yml.j2

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ concurrency:
1717
cancel-in-progress: true
1818

1919
jobs:
20-
{%- for n in misc_file_numbers %}
20+
{%- for n in range(misc_count) %}
2121

2222
misc_{{ n }}:
2323
uses: ./.github/workflows/misc_{{ n }}.yml
2424
{%- endfor %}
25-
{%- for n in lint_file_numbers %}
25+
{%- for n in range(lint_count) %}
2626

2727
lint_{{ n }}:
2828
uses: ./.github/workflows/lint_{{ n }}.yml
2929
{%- endfor %}
30-
{%- for n in test_file_numbers %}
30+
{%- for n in range(test_count) %}
3131

3232
tests_{{ n }}:
3333
uses: ./.github/workflows/test_{{ n }}.yml
@@ -46,13 +46,13 @@ jobs:
4646
check:
4747
if: always()
4848
needs:
49-
{%- for n in misc_file_numbers %}
49+
{%- for n in range(misc_count) %}
5050
- misc_{{ n }}
5151
{%- endfor %}
52-
{%- for n in lint_file_numbers %}
52+
{%- for n in range(lint_count) %}
5353
- lint_{{ n }}
5454
{%- endfor %}
55-
{%- for n in test_file_numbers %}
55+
{%- for n in range(test_count) %}
5656
- tests_{{ n }}
5757
{%- endfor %}
5858
- contrib_0

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ deps =
325325
toml
326326
commands =
327327
; griffe check before to fail fast if there are any issues
328+
breakthings
328329
python {toxinidir}/scripts/griffe_check.py
329330
python {toxinidir}/scripts/public_symbols_checker.py
330331

0 commit comments

Comments
 (0)