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 19, 2024
1 parent 7c27ff9 commit 514805f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 32 deletions.
43 changes: 14 additions & 29 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 @@ -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 514805f

Please sign in to comment.