File tree Expand file tree Collapse file tree 3 files changed +39
-6
lines changed
.github/actions/docker-targets Expand file tree Collapse file tree 3 files changed +39
-6
lines changed Original file line number Diff line number Diff line change @@ -126,10 +126,8 @@ def main() -> int:
126126 stage_details : list [dict [str , str ]] = []
127127 want_platform = canonical_platform (args .platform ) if args .platform else ""
128128 for item in collect_non_eol (data , args .platform or None ):
129- if (
130- not all
131- and changed
132- and (item ["family" ], item ["distro" ]) not in changed
129+ if (not all and not changed ) or (
130+ not all and (item ["family" ], item ["distro" ]) not in changed
133131 ):
134132 continue
135133 include .append (item )
@@ -144,7 +142,9 @@ def main() -> int:
144142 if not stage :
145143 continue
146144 platforms = target .get ("platforms" , "" )
147- if want_platform and not platforms_support (platforms , want_platform ):
145+ if want_platform and not platforms_support (
146+ platforms , want_platform
147+ ):
148148 continue
149149 stage_details .append (
150150 {
Original file line number Diff line number Diff line change @@ -142,6 +142,32 @@ def test_main_returns_all_when_flag_set(self) -> None:
142142 ],
143143 )
144144
145+ def test_main_with_no_changes_produces_empty_outputs (self ) -> None :
146+ self ._write_templates (
147+ """
148+ ros2:
149+ - name: rolling
150+ targets:
151+ - target: base
152+ """
153+ )
154+
155+ argv = [
156+ "get_targets.py" ,
157+ "--all" ,
158+ "false" ,
159+ "--changed" ,
160+ "" ,
161+ ]
162+ with patch .object (sys , "argv" , argv ):
163+ exit_code = TARGETS_MODULE .main ()
164+
165+ self .assertEqual (exit_code , 0 )
166+ outputs = self ._outputs ()
167+ self .assertEqual (outputs .get ("distros" ), [])
168+ self .assertEqual (outputs .get ("families" ), [])
169+ self .assertEqual (outputs .get ("stages" ), [])
170+
145171 def test_collect_non_eol_respects_platform_filter (self ) -> None :
146172 data = {
147173 "ros2" : [
Original file line number Diff line number Diff line change 4545 }
4646 ]
4747 },
48+ {
49+ "label" : " action tests" ,
50+ "type" : " shell" ,
51+ "command" : " python -m unittest discover -s .github/actions -p 'test_*.py'" ,
52+ "problemMatcher" : " $python"
53+ },
4854 {
4955 "label" : " test" ,
5056 "dependsOn" : [
5157 " flake8" ,
52- " pydocstyle"
58+ " pydocstyle" ,
59+ " action tests"
5360 ]
5461 },
5562 {
You can’t perform that action at this time.
0 commit comments