Delete unused map/struct and Enable tests #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust Test | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: "-Dwarnings" | |
jobs: | |
test: | |
runs-on: ubuntu-24.04 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Rustup | |
run: | | |
rustup toolchain add nightly-2024-11-01 | |
rustup toolchain install nightly-2024-11-01 --component rust-src | |
- name: Install Protc | |
run: sudo apt install -y protobuf-compiler libprotobuf-dev | |
- name: Cache cargo registry | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Check codegen works fine | |
run: | | |
if [ -e /sys/kernel/btf/vmlinux ]; then | |
ls -l /sys/kernel/btf/vmlinux | |
else | |
echo "Warning: /sys/kernel/btf/vmlinux not found" | |
exit 1 | |
fi | |
if ! command -v bindgen > /dev/null 2>&1; then | |
echo "bindgen not found, running cargo install bindgen..." | |
cargo install bindgen-cli | |
fi | |
cargo xtask codegen | |
git diff tetragon-common/src/vmlinux.rs | |
# The following can be enabled after supporting multiple kernel versions and platforms. | |
# if git diff --name-only | grep -q "tetragon-common/src/vmlinux.rs"; then | |
# echo "tetragon-common/src/vmlinux.rs hasn't been update. Update it by cargo task codegen." | |
# exit 1 | |
# fi | |
- name: Check formatting | |
run: cargo fmt --all --check | |
- name: Lint with clippy | |
run: cargo clippy --all-targets --all-features | |
- name: Build test | |
run: cargo xtask build --release | |
- name: Run tests | |
run: cargo test --verbose |