From cd291cdf410a727397f061a9cc9c732484c488d6 Mon Sep 17 00:00:00 2001 From: Ali ghahremani Date: Tue, 16 Apr 2024 16:52:48 +0330 Subject: [PATCH] ci-cd: code style check and clippy added to github actions build-system: makefile added --- .github/workflows/rust.yml | 32 +++++++++++++++++++++++--------- Makefile | 18 ++++++++++++++++++ 2 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 Makefile diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b780e66..f95da37 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,22 +1,36 @@ name: Rust - on: push: - branches: [ "stable" ] + branches: + - "stable" pull_request: - branches: [ "stable" ] + branches: + - "stable" + - "dev" env: CARGO_TERM_COLOR: always jobs: - build: + style: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check style + run: make lint + clippy: runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Clippy + run: make clippy + test: + runs-on: ubuntu-latest + needs: + - build steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + - uses: actions/checkout@v4 + - name: Test + run: make test diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..147aedb --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +all: build check test docs + +fmt: + cargo fmt + +build: + cargo build --release + +check: clippy lint + +test: + cargo test + +clippy: + cargo clippy --all-features --no-deps + +lint: + cargo fmt --check --verbose