@@ -140,29 +140,17 @@ def _generate_workflow(
140140 job_datas : list ,
141141 template_name : str ,
142142 output_dir : Path ,
143- max_jobs : int = 250 ,
144- ):
145- # Github seems to limit the amount of jobs in a workflow file, that is why
146- # they are split in groups of 250 per workflow file.
147- for file_number , job_datas in enumerate (
148- [
149- job_datas [index : index + max_jobs ]
150- for index in range (0 , len (job_datas ), max_jobs )
151- ]
152- ):
153- with open (
154- output_dir .joinpath (f"{ template_name } _{ file_number } .yml" ), "w"
155- ) as test_yml_file :
156- test_yml_file .write (
157- Environment (
158- loader = FileSystemLoader (
159- Path (__file__ ).parent .joinpath ("templates" )
160- )
161- )
162- .get_template (f"{ template_name } .yml.j2" )
163- .render (job_datas = job_datas , file_number = file_number )
143+ ) -> None :
144+ env = Environment (
145+ loader = FileSystemLoader (Path (__file__ ).parent .joinpath ("templates" ))
146+ )
147+ with open (output_dir .joinpath (f"{ template_name } .yml" ), "w" ) as yml_file :
148+ yml_file .write (
149+ env .get_template (f"{ template_name } .yml.j2" ).render (
150+ job_datas = job_datas ,
164151 )
165- test_yml_file .write ("\n " )
152+ )
153+ yml_file .write ("\n " )
166154
167155
168156def generate_test_workflow (
@@ -197,6 +185,22 @@ def generate_misc_workflow(
197185 )
198186
199187
188+ def generate_ci_workflow (
189+ output_dir : Path ,
190+ ) -> None :
191+ with open (output_dir .joinpath ("ci.yml" ), "w" ) as ci_yml_file :
192+ ci_yml_file .write (
193+ Environment (
194+ loader = FileSystemLoader (
195+ Path (__file__ ).parent .joinpath ("templates" )
196+ )
197+ )
198+ .get_template ("ci.yml.j2" )
199+ .render ()
200+ )
201+ ci_yml_file .write ("\n " )
202+
203+
200204if __name__ == "__main__" :
201205 tox_ini_path = Path (__file__ ).parent .parent .parent .joinpath ("tox.ini" )
202206 output_dir = Path (__file__ ).parent
@@ -205,3 +209,4 @@ def generate_misc_workflow(
205209 )
206210 generate_lint_workflow (tox_ini_path , output_dir )
207211 generate_misc_workflow (tox_ini_path , output_dir )
212+ generate_ci_workflow (output_dir )
0 commit comments