Skip to content

Commit

Permalink
Add CI for Rust tests, clippy, fmt (#65)
Browse files Browse the repository at this point in the history
* Add CI for Rust tests, clippy, fmt

* Rename GH task to Rust
  • Loading branch information
adzialocha authored Aug 30, 2024
1 parent 3b429fa commit 257d890
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 360 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Rust

on: push

env:
CARGO_TERM_COLOR: always
RUST_TOOLCHAIN: 1.80.1

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: moonrepo/setup-rust@v1
with:
channel: ${{ env.RUST_TOOLCHAIN }}

- name: Run tests
# Ensure debug output is also tested
env:
RUST_LOG: debug
run: cargo test --all-features

check:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: moonrepo/setup-rust@v1
with:
channel: ${{ env.RUST_TOOLCHAIN }}

- name: Check project and dependencies
run: cargo check

fmt:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: moonrepo/setup-rust@v1
with:
components: rustfmt
channel: ${{ env.RUST_TOOLCHAIN }}

- name: Check formatting
run: cargo fmt -- --check

clippy:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: moonrepo/setup-rust@v1
with:
components: clippy
channel: ${{ env.RUST_TOOLCHAIN }}

- name: Check code with clippy
run: cargo clippy -- -D warnings --no-deps
Loading

0 comments on commit 257d890

Please sign in to comment.