Generate matrix entries for Docker image builds.
(
runners: dict[str, Any],
python_entries: list[dict[str, str]],
platform_filter: str | None = None,
)
| 233 | |
| 234 | |
| 235 | def generate_docker_matrix_entries( |
| 236 | runners: dict[str, Any], |
| 237 | python_entries: list[dict[str, str]], |
| 238 | platform_filter: str | None = None, |
| 239 | ) -> list[dict[str, str]]: |
| 240 | """Generate matrix entries for Docker image builds.""" |
| 241 | if platform_filter and platform_filter != "linux": |
| 242 | return [] |
| 243 | |
| 244 | needed_archs = { |
| 245 | runners[entry["runner"]]["arch"] |
| 246 | for entry in python_entries |
| 247 | if entry.get("platform") == "linux" |
| 248 | } |
| 249 | |
| 250 | matrix_entries = [] |
| 251 | for image in DOCKER_BUILD_IMAGES: |
| 252 | if image["arch"] not in needed_archs: |
| 253 | continue |
| 254 | |
| 255 | # Find appropriate runner for Linux platform with the specified architecture. |
| 256 | runner = find_runner(runners, "linux", image["arch"], False) |
| 257 | |
| 258 | entry = { |
| 259 | "name": image["name"], |
| 260 | "arch": image["arch"], |
| 261 | "runner": runner, |
| 262 | } |
| 263 | matrix_entries.append(entry) |
| 264 | |
| 265 | return matrix_entries |
| 266 | |
| 267 | |
| 268 | def generate_crate_build_matrix_entries( |