📦 Crate Template
A minimal, production-ready Rust template designed to jumpstart library (crate) development. It establishes a workspace-friendly structure and comes pre-configured with automated release pipelines, versioning, and cross-platform distribution.
🚀 How to Use
Developing
- Add a new package:
cargo new --lib <package-name> - Work on the library:
cargo build/cargo test
CI Configuration
The project includes a GitHub Actions workflow for continuous integration. To modify the platforms used for testing (Clippy, tests, and documentation), edit .github/workflows/ci.yml and update the supported_os list:
matrix:
os:
Publishing
This project uses release-plz to automate updating CHANGELOG.md, bumping versions, tagging Git commits, and publishing to crates.io.
Steps to enable release-plz:
- Allow PR Creation: Navigate to
https://github.com/<user>/<repo>/settings/actions. Under the Workflow permissions section, check the box for "Allow GitHub Actions to create and approve pull requests". - Configure PAT: Navigate to
https://github.com/<user>/<repo>/settings/secrets/actionsand add a repository secret namedRELEASE_PLZ_TOKEN.- This must be a GitHub Personal Access Token (PAT).
- If using a Fine-grained PAT, grant
Contents: Read and write(to push Git tags) andPull Requests: Read and write(to open release PRs) permissions. - If using a Classic PAT, select the
reposcope.
- Enable
release-plzfor Your Repository: Updateif: github.repository == 'Atliac/crate-template'toif: github.repository == '<your-username>/<your-repo>'in.github/workflows/release-plz.yml. - Publishing to
crates.io**:- Enable in Config: Edit release-plz.toml and remove the
publish = falselines (or set them totrue). - First Publish: Run
cargo publishmanually from your local machine once. (Crates.io does not allow publishing a brand-new crate via automation). - Trusted Publishing: Follow the crates.io Trusted Publishing guide to link your GitHub repository.
- Enable in Config: Edit release-plz.toml and remove the
📜 License
This project is dual-licensed under:
You may choose either license at your discretion.
🤝 Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual-licensed as above, without any additional terms or conditions.