diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..565dfb5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,72 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +env: + CARGO_TERM_COLOR: always + +jobs: + check: + name: Check + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy, rustfmt + - uses: Swatinem/rust-cache@v2 + - name: Check + run: cargo check --workspace --all-targets + + clippy: + name: Clippy (strict) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + - uses: Swatinem/rust-cache@v2 + - name: Clippy + run: | + cargo clippy --workspace --all-targets -- \ + -D warnings \ + -D clippy::unwrap_used \ + -D clippy::expect_used \ + -D clippy::panic \ + -D clippy::unimplemented \ + -D clippy::todo \ + -D clippy::dbg_macro \ + -D clippy::print_stdout \ + -D clippy::print_stderr + + fmt: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - name: Rustfmt + run: cargo fmt --all -- --check + + test: + name: Test + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - name: Run tests + run: cargo test --workspace diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..84b8c03 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/target +*.swp +*.swo +*~ +.DS_Store diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..9c823ce --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.94.0" +components = ["rustfmt", "clippy", "rust-analyzer"]