Skip to content

Commit

Permalink
Run clippy in CI
Browse files Browse the repository at this point in the history
Install Rust stable *after* nightly so that the default is stable.
  • Loading branch information
tamird committed Oct 10, 2024
1 parent 44f3d43 commit 688737f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,18 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install latest stable
uses: dtolnay/rust-toolchain@master
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: stable
components: rust-src

- name: Install latest nightly
uses: dtolnay/rust-toolchain@master
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: rust-src
components: clippy

- uses: Swatinem/rust-cache@v2

- name: Install deps
uses: taiki-e/install-action@v2
- uses: taiki-e/install-action@v2
with:
tool: bpf-linker,cargo-generate

- name: Run tests
run: ./test.sh ${{ github.workspace }} ${{ matrix.program }}
- run: ./test.sh ${{ github.workspace }} ${{ matrix.program }}
6 changes: 6 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,11 @@ cargo generate --path "${TEMPLATE_DIR}" -n test -d program_type="${PROG_TYPE}" $
pushd test
cargo xtask build
cargo xtask build --release
# We cannot run clippy over the whole workspace at once due to feature unification. Since both test
# and test-ebpf both depend on test-common and test activates test-common's aya dependency, we end
# up trying to compile the panic handler twice: once from the bpf program, and again from std via
# aya.
cargo clippy --exclude test-ebpf --all-targets --workspace -- --deny warnings
cargo clippy --package test-ebpf --all-targets -- --deny warnings
popd
exit 0
2 changes: 1 addition & 1 deletion {{project-name}}-ebpf/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ use aya_ebpf::{

#[socket_filter]
pub fn {{crate_name}}(_ctx: SkBuffContext) -> i64 {
return 0
0
}
{%- when "cgroup_sysctl" %}
use aya_ebpf::{
Expand Down

0 comments on commit 688737f

Please sign in to comment.