Build HIL in CI prior to running them (#1388)
* xtask: allow building hil tests * check hil tests build in CI
This commit is contained in:
parent
13c81177c5
commit
969f9a15f6
17
.github/workflows/ci.yml
vendored
17
.github/workflows/ci.yml
vendored
@ -307,14 +307,6 @@ jobs:
|
||||
- name: rustfmt (examples)
|
||||
run: cargo fmt --all --manifest-path=examples/Cargo.toml -- --check
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# NOTE:
|
||||
#
|
||||
# This is (hopefully) a temporary workaround to allow us to run HIL tests
|
||||
# in merge queue, but not in pull requests. For more information see:
|
||||
#
|
||||
# https://github.com/esp-rs/esp-hal/issues/1328
|
||||
|
||||
riscv-hil:
|
||||
name: HIL Test | ${{ matrix.soc }}
|
||||
runs-on: ubuntu-latest
|
||||
@ -325,4 +317,11 @@ jobs:
|
||||
soc: [esp32c3, esp32c6, esp32h2]
|
||||
|
||||
steps:
|
||||
- run: echo "HIL tests are not run in pull requests!"
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
target: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf,riscv32imafc-unknown-none-elf
|
||||
toolchain: nightly
|
||||
components: rust-src
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo xtask build-examples hil-test ${{ matrix.soc }}
|
||||
|
||||
@ -23,6 +23,7 @@ pub enum Package {
|
||||
EspLpHal,
|
||||
EspRiscvRt,
|
||||
Examples,
|
||||
HilTest,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Display, EnumIter, ValueEnum, serde::Serialize)]
|
||||
@ -246,12 +247,11 @@ pub fn build_example(
|
||||
log::info!(" Features: {}", example.features().join(","));
|
||||
}
|
||||
|
||||
let bin = if example
|
||||
.example_path()
|
||||
.strip_prefix(package_path)?
|
||||
.starts_with("src/bin")
|
||||
{
|
||||
let package = example.example_path().strip_prefix(package_path)?;
|
||||
let bin = if package.starts_with("src/bin") {
|
||||
format!("--bin={}", example.name())
|
||||
} else if package.starts_with("tests") {
|
||||
format!("--test={}", example.name())
|
||||
} else {
|
||||
format!("--example={}", example.name())
|
||||
};
|
||||
|
||||
@ -212,11 +212,10 @@ fn build_examples(workspace: &Path, mut args: BuildExamplesArgs) -> Result<()> {
|
||||
// Absolute path of the package's root:
|
||||
let package_path = xtask::windows_safe_path(&workspace.join(args.package.to_string()));
|
||||
|
||||
// Absolute path to the directory containing the examples:
|
||||
let example_path = if args.package == Package::Examples {
|
||||
package_path.join("src").join("bin")
|
||||
} else {
|
||||
package_path.join("examples")
|
||||
let example_path = match args.package {
|
||||
Package::Examples => package_path.join("src").join("bin"),
|
||||
Package::HilTest => package_path.join("tests"),
|
||||
_ => package_path.join("examples"),
|
||||
};
|
||||
|
||||
// Determine the appropriate build target for the given package and chip:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user