diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..29375a4 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,38 @@ +name: Unit and style tests + +concurrency: # don't run the test when there's is a newer version + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + unit-tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + - uses: Swatinem/rust-cache@v2 + + - name: Test dev build + run: cargo test + + - name: Test release build + run: cargo test --release + + style-checks: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + - uses: Swatinem/rust-cache@v2 + + - name: Clippy check + run: cargo clippy # -- -D + # TODO! Uncomment this when code will be alright + - name: Format check + run: cargo fmt -- --check diff --git a/README.md b/README.md index 0f64eb4..4a12a22 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![Tests status](https://github.com/szymon-jozef/checkers/actions/workflows/tests.yml/badge.svg) + # Game of checkers online Currently WIP diff --git a/nix/shell.nix b/nix/shell.nix index cb5683e..0e5364e 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -3,6 +3,7 @@ devShells.default = pkgs.mkShell { packages = with pkgs; [ rustfmt + clippy ]; RUST_LOG = "debug"; diff --git a/src/logic/math/position.rs b/src/logic/math/position.rs index 5b12c47..6dcaf6b 100644 --- a/src/logic/math/position.rs +++ b/src/logic/math/position.rs @@ -32,9 +32,7 @@ impl Position { trace!("Adding row: {} + {} = {}", self.row, delta.row, new_row); trace!( "Adding column: {} + {} = {}", - self.column, - delta.column, - new_column + self.column, delta.column, new_column ); Some(Position { diff --git a/src/main.rs b/src/main.rs index 7da3a48..e7a11a9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,3 @@ - fn main() { println!("Hello, world!"); }