11import os
22import shutil
3+ import sys
34import tempfile
45from contextlib import contextmanager
56from pathlib import Path
@@ -76,13 +77,18 @@ def test_copier(template: Path, run_copier: Callable[..., Path]):
7677
7778def test_bake_and_test (template : Path , run_copier : Callable [..., Path ]):
7879 NAME = "some-project"
79- output = run_copier (template , project_name = NAME , git_init = True )
80+ output = run_copier (
81+ template ,
82+ project_name = NAME ,
83+ git_init = True ,
84+ minimum_python = sys .version_info .minor , # use current minor version for CI
85+ )
8086 with inside_dir (str (output )):
8187 run (["uv" , "run" , "pytest" ], check = True )
8288
8389
8490def test_bake_and_build (template , run_copier : Callable [..., Path ]):
85- output = run_copier (template , git_init = True )
91+ output = run_copier (template , git_init = True , minimum_python = sys . version_info . minor )
8692
8793 with inside_dir (str (output )):
8894 run (["uv" , "run" , "check-manifest" ], check = True )
@@ -100,3 +106,36 @@ def test_bake_and_pre_commit(template, run_copier: Callable[..., Path]):
100106 run (["pre-commit" , "install" ], check = True )
101107 run (["git" , "add" , "." ], check = True )
102108 run (["pre-commit" , "run" , "--all-files" ], check = True )
109+
110+
111+ @pytest .mark .parametrize (
112+ "kwargs" ,
113+ [
114+ {"mode" : "simple" },
115+ {"mode" : "tooling" },
116+ {
117+ "mode" : "customize" ,
118+ "minimum_python" : 10 ,
119+ "test_lowest_pinned_dependencies" : True ,
120+ "test_pre_release" : True ,
121+ },
122+ ],
123+ ids = lambda d : d ["mode" ],
124+ )
125+ def test_actionlint_on_rendered_workflow (
126+ template : Path , run_copier : Callable [..., Path ], kwargs : dict [str , Any ]
127+ ):
128+ """Test that the rendered CI workflow passes actionlint validation."""
129+ # Test with default settings (should not have resolution matrix)
130+ output = run_copier (template , ** kwargs )
131+ ci_file = output / ".github" / "workflows" / "ci.yml"
132+ assert ci_file .exists ()
133+
134+ # Run actionlint on default configuration
135+ run (["actionlint" , str (ci_file )], check = True )
136+
137+ # Verify no resolution matrix in default output
138+ ci_content = ci_file .read_text (encoding = "utf-8" )
139+ is_custom = kwargs ["mode" ] == "customize"
140+ assert ("resolution:" in ci_content ) is is_custom
141+ assert ("[${{ matrix.resolution }}]" in ci_content ) is is_custom
0 commit comments