diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..0bac1e9 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,41 @@ +name: Rust + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + TARPAULIN_VERSION: 0.35.1 + +jobs: + linter: + runs-on: ubuntu-latest + name: Cargo fmt and clippy + + steps: + - uses: actions/checkout@v4 + - name: Check formatting + run: cargo fmt --all -- --check + + tests: + runs-on: ubuntu-latest + name: Cargo test and tarpaulin + needs: linter + + steps: + - uses: actions/checkout@v4 + + - name: Install cargo-tarpaulin@${{ env.TARPAULIN_VERSION }} + run: cargo install cargo-tarpaulin@${{ env.TARPAULIN_VERSION }} --locked + + - name: Build + run: cargo build --verbose + + - name: Run tests + run: cargo test --verbose + + - name: Run coverage + run: cargo tarpaulin --verbose diff --git a/tests/cli_tests.rs b/tests/cli_tests.rs index f85d6f3..f5fafc3 100644 --- a/tests/cli_tests.rs +++ b/tests/cli_tests.rs @@ -52,7 +52,7 @@ fn test_version_output() { let stdout = String::from_utf8_lossy(&output.stdout); let lower = stdout.to_lowercase(); assert!(lower.contains("clawshell")); - assert!(stdout.contains("v0.1.0")); + assert!(stdout.contains("v0.0.1")); assert!(lower.contains("openclaw")); }