Skip to content

Commit

Permalink
split up clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
MabezDev committed Jul 24, 2024
1 parent e47ecbd commit fff707e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 33 deletions.
45 changes: 15 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,22 @@ jobs:
steps:
- uses: actions/checkout@v4

# Install the Rust toolchain for Xtensa devices:
- uses: esp-rs/xtensa-toolchain@v1.5
with:
default: true
ldproxy: false
# Install the Rust stable and nightly toolchains for RISC-V devices:
- if: ${{ !contains(fromJson('["esp32", "esp32s2", "esp32s3"]'), matrix.device.soc) }}
uses: dtolnay/rust-toolchain@v1
- uses: dtolnay/rust-toolchain@v1
with:
target: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf
toolchain: stable
components: rust-src
- if: ${{ !contains(fromJson('["esp32", "esp32s2", "esp32s3"]'), matrix.device.soc) }}
uses: dtolnay/rust-toolchain@v1
- uses: dtolnay/rust-toolchain@v1
with:
target: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf
toolchain: nightly
components: rust-src
# Install the Rust toolchain for Xtensa devices:
- if: contains(fromJson('["esp32", "esp32s2", "esp32s3"]'), matrix.device.soc)
uses: esp-rs/xtensa-toolchain@v1.5
with:
buildtargets: ${{ matrix.device.soc }}
default: true
ldproxy: false

- uses: Swatinem/rust-cache@v2

Expand All @@ -109,9 +105,14 @@ jobs:
run: cargo xtask build-examples esp-hal ${{ matrix.device.soc }}
# Check doc-tests
- name: Check doc-tests
run: cargo xtask run-doc-test esp-hal ${{ matrix.device.soc }}
run: cargo +esp xtask run-doc-test esp-hal ${{ matrix.device.soc }}
- name: Check documentation
run: RUSTDOCFLAGS="-D warnings" cargo xtask build-documentation --packages esp-hal --chips ${{ matrix.device.soc }}
# Run clippy
- name: Clippy
# We use the 'esp' toolchain for *all* targets, in order to get a
# semi-stable and consistent set of lints for all targets:
run: cargo +esp xtask lint-packages --chips ${{ matrix.device.soc }}

extras:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -165,7 +166,7 @@ jobs:
cargo xtask build-package --features=esp32h2,ci --target=riscv32imac-unknown-none-elf esp-hal
# Verify the MSRV for all Xtensa chips:
- name: msrv RISCV (esp-hal)
- name: msrv Xtensa (esp-hal)
run: |
cargo xtask build-package --toolchain=esp --features=esp32,ci --target=xtensa-esp32-none-elf esp-hal
cargo xtask build-package --toolchain=esp --features=esp32s2,ci --target=xtensa-esp32s2-none-elf esp-hal
Expand All @@ -178,23 +179,7 @@ jobs:
cargo xtask build-package --features=esp32s3 --target=riscv32imc-unknown-none-elf esp-lp-hal
# --------------------------------------------------------------------------
# Lint & Format

clippy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
# We use the 'esp' toolchain for *all* targets, in order to get a
# semi-stable and consistent set of lints for all targets:
- uses: esp-rs/xtensa-toolchain@v1.5
with:
default: true
ldproxy: false
- uses: Swatinem/rust-cache@v2

# Lint all packages:
- run: cargo xtask lint-packages
# Format

rustfmt:
runs-on: ubuntu-latest
Expand Down
15 changes: 12 additions & 3 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ struct LintPackagesArgs {
/// Package(s) to target.
#[arg(value_enum, default_values_t = Package::iter())]
packages: Vec<Package>,

/// Lint for a specific chip
#[arg(long, value_enum, default_values_t = Chip::iter())]
chips: Vec<Chip>,
}

#[derive(Debug, Args)]
Expand Down Expand Up @@ -464,7 +468,7 @@ fn lint_packages(workspace: &Path, args: LintPackagesArgs) -> Result<()> {
// building, so we need to handle each individually (though there
// is *some* overlap)

for chip in Chip::iter() {
for chip in &args.chips {
let device = Config::for_chip(&chip);

match package {
Expand Down Expand Up @@ -583,7 +587,6 @@ fn lint_packages(workspace: &Path, args: LintPackagesArgs) -> Result<()> {
"-Zbuild-std=core",
&format!("--target={}", chip.target()),
&format!("--features={chip},storage,nor-flash,low-level"),
"--release",
],
)?;
}
Expand Down Expand Up @@ -649,7 +652,13 @@ fn lint_package(path: &Path, args: &[&str]) -> Result<()> {
builder = builder.arg(arg.to_string());
}

let cargo_args = builder.arg("--").arg("-D").arg("warnings").build();
// build in release to reuse example artifacts
let cargo_args = builder
.arg("--release")
.arg("--")
.arg("-D")
.arg("warnings")
.build();

xtask::cargo::run(&cargo_args, &path)
}
Expand Down

0 comments on commit fff707e

Please sign in to comment.