From 64283325b840e3c3ebfa6d9e7d5b952a8a63925b Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Thu, 19 Dec 2024 00:17:41 -0500 Subject: [PATCH] Matrixify docker platform in CI --- .github/workflows/ci.yml | 2 +- docker/cross-toolchains | 1 - xtask/src/ci/target_matrix.rs | 35 ++++++++++++++++++++--------------- 3 files changed, 21 insertions(+), 17 deletions(-) delete mode 160000 docker/cross-toolchains diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f754a676b..d5d4e4377 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -186,7 +186,7 @@ jobs: id: build-docker-image if: steps.prepare-meta.outputs.has-image timeout-minutes: 120 - run: cargo xtask build-docker-image -v "${TARGET}${SUB:+.$SUB}" ${{ matrix.verbose && '-v' || '' }} + run: cargo xtask build-docker-image -v --platform ${{ matrix.platform }} "${TARGET}${SUB:+.$SUB}" ${{ matrix.verbose && '-v' || '' }} env: TARGET: ${{ matrix.target }} SUB: ${{ matrix.sub }} diff --git a/docker/cross-toolchains b/docker/cross-toolchains deleted file mode 160000 index 5504d9293..000000000 --- a/docker/cross-toolchains +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5504d9293334744cf2555286707d9907b89afbfb diff --git a/xtask/src/ci/target_matrix.rs b/xtask/src/ci/target_matrix.rs index 4b8a518c3..f159fc788 100644 --- a/xtask/src/ci/target_matrix.rs +++ b/xtask/src/ci/target_matrix.rs @@ -101,20 +101,25 @@ impl TargetMatrix { let matrix = matrix .iter() - .map(|target| TargetMatrixElement { - pretty: target.to_image_target().alt(), - platforms: target.platforms(), - target: &target.target, - sub: target.sub.as_deref(), - os: &target.os, - run: target.run.map(|b| b as u8), - deploy: target.deploy.map(|b| b as u8), - build_std: target.build_std.map(|b| b as u8), - cpp: target.cpp.map(|b| b as u8), - dylib: target.dylib.map(|b| b as u8), - runners: target.runners.as_deref(), - std: target.std.map(|b| b as u8), - verbose: app.verbose, + .flat_map(|target| { + target + .platforms() + .iter() + .map(move |platform| TargetMatrixElement { + pretty: format!("{} ({platform})", target.to_image_target().alt()), + platform: platform.to_string(), + target: &target.target, + sub: target.sub.as_deref(), + os: &target.os, + run: target.run.map(|b| b as u8), + deploy: target.deploy.map(|b| b as u8), + build_std: target.build_std.map(|b| b as u8), + cpp: target.cpp.map(|b| b as u8), + dylib: target.dylib.map(|b| b as u8), + runners: target.runners.as_deref(), + std: target.std.map(|b| b as u8), + verbose: app.verbose, + }) }) .collect::>(); @@ -244,7 +249,7 @@ fn process_try_comment(message: &str) -> cross::Result<(bool, TargetMatrixArgs)> #[serde(rename_all = "kebab-case")] struct TargetMatrixElement<'a> { pretty: String, - platforms: &'a [String], + platform: String, target: &'a str, #[serde(skip_serializing_if = "Option::is_none")] sub: Option<&'a str>,