From 0ca6fbce4f31921300841580ad52d1f21fb15643 Mon Sep 17 00:00:00 2001 From: Yiannis Marangos Date: Tue, 16 Jan 2024 16:06:52 +0200 Subject: [PATCH] add CI --- .github/workflow/ci.yml | 85 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 .github/workflow/ci.yml diff --git a/.github/workflow/ci.yml b/.github/workflow/ci.yml new file mode 100644 index 0000000..f47b46c --- /dev/null +++ b/.github/workflow/ci.yml @@ -0,0 +1,85 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + +jobs: + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Install Protoc + uses: arduino/setup-protoc@v2 + with: + version: "23.3" + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Run clippy for native + run: cargo clippy --all --all-targets -- -D warnings + + + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Run fmt + run: cargo fmt -- --check + + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + + - name: Set up cargo cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: + cargo-${{ hashFiles('**/Cargo.lock') }} + cargo- + + - name: Install Protoc + uses: arduino/setup-protoc@v2 + with: + version: "23.3" + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Run tests + run: cargo test + + + unused-deps: + runs-on: ubuntu-latest + name: unused dependencies + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Install Protoc + uses: arduino/setup-protoc@v2 + with: + version: "23.3" + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install toolchain + uses: dtolnay/rust-toolchain@nightly + + - name: Install cargo-udeps + uses: taiki-e/cache-cargo-install-action@v1 + with: + tool: cargo-udeps@0.1.43 + + - name: Check for unused dependencies + run: cargo +nightly udeps --all-features --all-targets + env: + RUSTFLAGS: -D warnings