diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..5fb3c7c --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,103 @@ +name: CI + +on: + workflow_dispatch: + push: + branches: [master, develop] + pull_request: + branches: [master] + +env: + CARGO_TERM_COLOR: always + +jobs: + test-linux: + name: Test (Linux) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + + - name: Cache cargo registry and build + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: linux-cargo-${{ hashFiles('Cargo.lock') }} + restore-keys: linux-cargo- + + - name: Build + run: cargo build --verbose + + - name: Run tests + run: cargo test --verbose + + - name: Check for warnings + run: cargo build 2>&1 | grep -c "warning" | xargs test 0 -eq + + test-windows: + name: Test (Windows MSVC) + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + + - name: Cache cargo registry and build + uses: actions/cache@v4 + with: + path: | + ~\.cargo\registry + ~\.cargo\git + target + key: windows-cargo-${{ hashFiles('Cargo.lock') }} + restore-keys: windows-cargo- + + - name: Build + run: cargo build --verbose + + - name: Run tests + run: cargo test --verbose + + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + components: clippy + + - name: Cache cargo registry and build + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: clippy-cargo-${{ hashFiles('Cargo.lock') }} + restore-keys: clippy-cargo- + + - name: Run clippy + run: cargo clippy -- -D warnings + + fmt: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + + - name: Check formatting + run: cargo fmt --check \ No newline at end of file