From aced0f9ecf427fc9dcc3c24a93087e02eda49978 Mon Sep 17 00:00:00 2001 From: Julian Hofer Date: Fri, 6 Sep 2024 11:22:30 +0200 Subject: [PATCH] ci: setup github actions workflows This adds linting and tests --- .github/workflows/rust-linting.yml | 44 ++++++++++++++++++++++++++++++ .github/workflows/rust-tests.yml | 27 ++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .github/workflows/rust-linting.yml create mode 100644 .github/workflows/rust-tests.yml diff --git a/.github/workflows/rust-linting.yml b/.github/workflows/rust-linting.yml new file mode 100644 index 0000000..2deadcf --- /dev/null +++ b/.github/workflows/rust-linting.yml @@ -0,0 +1,44 @@ +name: Rust Linting + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + fmt: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + + - name: Run cargo fmt + run: cargo fmt -- --check + + clippy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + + - name: Run cargo clippy + run: cargo clippy --all-targets --workspace -- -D warnings diff --git a/.github/workflows/rust-tests.yml b/.github/workflows/rust-tests.yml new file mode 100644 index 0000000..541b407 --- /dev/null +++ b/.github/workflows/rust-tests.yml @@ -0,0 +1,27 @@ +name: Rust + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + tests: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + + - name: Run tests + run: cargo test --all-targets --workspace