Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoernQ committed Feb 13, 2025
1 parent 411c7bc commit 92a1e3f
Showing 1 changed file with 122 additions and 116 deletions.
238 changes: 122 additions & 116 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,95 +930,101 @@ fn run_ci_checks(workspace: &Path, args: CiArgs) -> Result<()> {
// Clippy and docs checks

// Clippy
lint_packages(
workspace,
LintPackagesArgs {
packages: Package::iter().collect(),
chips: vec![args.chip],
fix: false,
},
)
.inspect_err(|_| failure = true)
.ok();

// Check doc-tests
run_doc_tests(
workspace,
ExampleArgs {
package: Package::EspHal,
chip: args.chip,
example: None,
debug: true,
},
)
.inspect_err(|_| failure = true)
.ok();

// Check documentation
build_documentation(
workspace,
BuildDocumentationArgs {
packages: vec![Package::EspHal, Package::EspWifi, Package::EspHalEmbassy],
chips: vec![args.chip],
base_url: None,
},
)
.inspect_err(|_| failure = true)
.ok();

// for chips with esp-lp-hal: Build all supported examples for the low-power
// core first
if args.chip.has_lp_core() {
// Build prerequisite examples (esp-lp-hal)
// `examples` copies the examples to a folder with the chip name as the last
// path element then we copy it to the place where the HP core example
// expects it
examples(
workspace,
ExampleArgs {
package: Package::EspLpHal,
chip: args.chip,
example: None,
debug: false,
},
CargoAction::Build(PathBuf::from(format!(
"./esp-lp-hal/target/{}/release/examples",
args.chip.target()
))),
)
.inspect_err(|_| failure = true)
.and_then(|_| {
let from_dir = PathBuf::from(format!(
"./esp-lp-hal/target/{}/release/examples/{}",
args.chip.target(),
args.chip.to_string()
));
let to_dir = PathBuf::from(format!(
"./esp-lp-hal/target/{}/release/examples",
args.chip.target()
));
from_dir.read_dir()?.for_each(|entry| {
let entry = entry.unwrap();
let path = entry.path();
let to = to_dir.join(entry.file_name());
fs::copy(path, to).expect("Failed to copy file");
});
Ok(())
})
.ok();

// Check documentation
build_documentation(
workspace,
BuildDocumentationArgs {
packages: vec![Package::EspLpHal],
chips: vec![args.chip],
base_url: None,
},
)
.inspect_err(|_| failure = true)
.ok();
}
// lint_packages(
// workspace,
// LintPackagesArgs {
// packages: Package::iter().collect(),
// chips: vec![args.chip],
// fix: false,
// },
// )
// .inspect_err(|_| failure = true)
// .ok();

// // Check doc-tests
// run_doc_tests(
// workspace,
// ExampleArgs {
// package: Package::EspHal,
// chip: args.chip,
// example: None,
// debug: true,
// },
// )
// .inspect_err(|_| failure = true)
// .ok();

// // Check documentation
// build_documentation(
// workspace,
// BuildDocumentationArgs {
// packages: vec![Package::EspHal, Package::EspWifi, Package::EspHalEmbassy],
// chips: vec![args.chip],
// base_url: None,
// },
// )
// .inspect_err(|_| failure = true)
// .ok();

// // for chips with esp-lp-hal: Build all supported examples for the low-power
// // core first
// if args.chip.has_lp_core() {
// // Build prerequisite examples (esp-lp-hal)
// // `examples` copies the examples to a folder with the chip name as the last
// // path element then we copy it to the place where the HP core example
// // expects it
// examples(
// workspace,
// ExampleArgs {
// package: Package::EspLpHal,
// chip: args.chip,
// example: None,
// debug: false,
// },
// CargoAction::Build(PathBuf::from(format!(
// "./esp-lp-hal/target/{}/release/examples",
// args.chip.target()
// ))),
// )
// .inspect_err(|_| failure = true)
// .and_then(|_| {
// let from_dir = PathBuf::from(format!(
// "./esp-lp-hal/target/{}/release/examples/{}",
// args.chip.target(),
// args.chip.to_string()
// ));
// let to_dir = PathBuf::from(format!(
// "./esp-lp-hal/target/{}/release/examples",
// args.chip.target()
// ));
// from_dir.read_dir()?.for_each(|entry| {
// let entry = entry.unwrap();
// let path = entry.path();
// let to = to_dir.join(entry.file_name());
// fs::copy(path, to).expect("Failed to copy file");
// });
// Ok(())
// })
// .ok();

// // Check documentation
// build_documentation(
// workspace,
// BuildDocumentationArgs {
// packages: vec![Package::EspLpHal],
// chips: vec![args.chip],
// base_url: None,
// },
// )
// .inspect_err(|_| failure = true)
// .ok();
// }

let output = Command::new("cargo")
.arg("--version")
.output()
.unwrap();
log::info!("cargo output: {:?}", output);

// Make sure we're able to build the HAL without the default features enabled
build_package(
Expand All @@ -1039,35 +1045,35 @@ fn run_ci_checks(workspace: &Path, args: CiArgs) -> Result<()> {
.ok();

// Build (examples)
examples(
workspace,
ExampleArgs {
package: Package::Examples,
chip: args.chip,
example: None,
debug: true,
},
CargoAction::Build(PathBuf::from(format!("./examples/target/"))),
)
.inspect_err(|_| failure = true)
.ok();

// Build (qa-test)
examples(
workspace,
ExampleArgs {
package: Package::QaTest,
chip: args.chip,
example: None,
debug: true,
},
CargoAction::Build(PathBuf::from(format!("./qa-test/target/"))),
)
.inspect_err(|_| failure = true)
.ok();
// examples(
// workspace,
// ExampleArgs {
// package: Package::Examples,
// chip: args.chip,
// example: None,
// debug: true,
// },
// CargoAction::Build(PathBuf::from(format!("./examples/target/"))),
// )
// .inspect_err(|_| failure = true)
// .ok();

// // Build (qa-test)
// examples(
// workspace,
// ExampleArgs {
// package: Package::QaTest,
// chip: args.chip,
// example: None,
// debug: true,
// },
// CargoAction::Build(PathBuf::from(format!("./qa-test/target/"))),
// )
// .inspect_err(|_| failure = true)
// .ok();

let completed_at = Instant::now();
log::debug!("CI checks completed in {:?}", completed_at - started_at);
log::info!("CI checks completed in {:?}", completed_at - started_at);

if failure {
bail!("CI checks failed");
Expand Down

0 comments on commit 92a1e3f

Please sign in to comment.