diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ae243ec --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + fmt: + name: Check formatting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - run: cargo fmt -- --check + + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - run: cargo build --verbose diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9528d20 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,38 @@ +# Contributing + +Thank you for your interest in contributing to Chai (: + +This document provides guidelines for contributing to the project. + +## Code Formatting + +This project uses **default rustfmt settings**. To ensure consistent code style across all contributions: + +1. **Check formatting locally** before pushing: + + ```sh + cargo fmt -- --check + ``` + +2. **Fix formatting** if the check fails: + + ```sh + cargo fmt + ``` + +3. **CI will block PRs** with incorrect formatting. Fix any issues before merging. + +**Important**: Do not create a `rustfmt.toml` file or override rustfmt settings. Chai uses the default configuration to ensure consistency. + +## Development Workflow + +1. Fork the repository +2. Create a feature branch +3. Make your changes +4. Run `cargo fmt -- --check` to verify formatting +5. Run `cargo build` and `cargo test` to verify everything works +6. Submit a pull request and link it to the relevant issue + +## Questions? + +Feel free to open an issue if you have questions about contributing! diff --git a/README.md b/README.md index d1c6baf..c00df66 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,10 @@ For examples, see [here](https://github.com/kllarena07/chai/tree/main/examples). --- +## Contributing + +Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines, including code formatting requirements. + ## Contributors diff --git a/examples/counter.rs b/examples/counter.rs index 1db1935..90764bb 100644 --- a/examples/counter.rs +++ b/examples/counter.rs @@ -67,6 +67,7 @@ async fn main() { ..Default::default() }; - let mut server = ChaiServer::::new(2222).with_tick_rate(std::time::Duration::from_millis(250)); + let mut server = + ChaiServer::::new(2222).with_tick_rate(std::time::Duration::from_millis(250)); server.run(config).await.expect("Failed running server"); } diff --git a/src/chai.rs b/src/chai.rs index 4bb2947..58b57c1 100644 --- a/src/chai.rs +++ b/src/chai.rs @@ -19,5 +19,4 @@ pub trait ChaiApp { /// called just before a client disconnects. fn on_disconnect(&mut self, _username: &str) {} - } diff --git a/src/server.rs b/src/server.rs index efaf073..b9bc3dc 100644 --- a/src/server.rs +++ b/src/server.rs @@ -507,4 +507,3 @@ pub fn load_host_keys(path: &str) -> Result