Skip to content

Commit

Permalink
Matrixify docker platform in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ianks committed Dec 19, 2024
1 parent 101281f commit 6428332
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
1 change: 0 additions & 1 deletion docker/cross-toolchains
Submodule cross-toolchains deleted from 5504d9
35 changes: 20 additions & 15 deletions xtask/src/ci/target_matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>();

Expand Down Expand Up @@ -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>,
Expand Down

0 comments on commit 6428332

Please sign in to comment.