-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7b73790
Showing
13 changed files
with
346 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: check | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
verify: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: clippy, rustfmt | ||
- uses: Swatinem/rust-cache@v2 | ||
- uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cargo-hack@0.6,just@1,cargo-msrv@0.15,cargo-deny@0.14 | ||
- run: just verify | ||
lint: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
env: | ||
RUSTFLAGS: "-D warnings" | ||
RUSTDOCFLAGS: "-D warnings" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: clippy, rustfmt | ||
- uses: Swatinem/rust-cache@v2 | ||
- uses: taiki-e/install-action@v2 | ||
with: | ||
tool: cargo-hack,just,cargo-deny | ||
- run: just lint doc | ||
- run: cargo deny check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: "Create Issues from TODO comments" | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
inputs: | ||
COMMIT_REF: | ||
description: The SHA of the commit to get the diff for | ||
required: true | ||
BASE_COMMIT: | ||
description: By default, the commit entered above is compared to the one directly before it; to go back further, enter an earlier SHA here | ||
required: false | ||
|
||
jobs: | ||
todo-to-issues: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
issues: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: alstr/todo-to-issue-action@master | ||
env: | ||
MANUAL_COMMIT_REF: ${{ inputs.COMMIT_REF }} | ||
MANUAL_BASE_REF: ${{ inputs.BASE_COMMIT }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Create github release | ||
|
||
permissions: | ||
contents: write | ||
|
||
on: | ||
push: | ||
tags: | ||
- v[0-9]+.* | ||
|
||
jobs: | ||
create-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: taiki-e/create-gh-release-action@v1 | ||
with: | ||
changelog: CHANGELOG.md | ||
token: ${{ github.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Rust | ||
/target | ||
/.cargo/*.toml | ||
/Cargo.lock | ||
|
||
# Nodes tools | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). | ||
|
||
|
||
## [Unreleased] | ||
|
||
|
||
[Unreleased]: https://github.com/jcornaz/rust-template/compare/...HEAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[package] | ||
name = "rust-template" | ||
version = "0.0.0" | ||
license = "Unlicense" | ||
authors = ["Jonathan Cornaz"] | ||
edition = "2021" | ||
rust-version = "1.74" | ||
repository = "https://github.com/jcornaz/rust-template" | ||
description = "" | ||
categories = [] | ||
keywords = [] | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
rustdoc-args = ["--cfg", "docsrs"] | ||
|
||
[dependencies] | ||
|
||
[dev-dependencies] | ||
|
||
[lints.rust] | ||
future_incompatible = "deny" | ||
nonstandard_style = "deny" | ||
unsafe_code = "deny" | ||
private_interfaces = "warn" | ||
private_bounds = "warn" | ||
rust_2018_idioms = "warn" | ||
missing_docs = "allow" | ||
|
||
[lints.clippy] | ||
exhaustive_enums = "warn" | ||
exhaustive_structs = "warn" | ||
pedantic = "warn" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# rust-template | ||
|
||
![rustc](https://img.shields.io/badge/rustc-1.74+-blue?logo=rust) | ||
|
||
* [ ] Replace all occurrences of `rust-template` by the name of the project | ||
* [ ] Write a description explaining the goals and/or motivation (here and in `Cargo.toml`) | ||
* For binaries only: | ||
* [ ] Rename `lib.rs` to `main.rs` and write a main function | ||
* [ ] Remove `Cargo.lock` from `.gitignore` | ||
|
||
|
||
## Maintenance status | ||
|
||
I made this project for my personal use. I'll be happy if it can be useful to anyone else, but there are a few things to keep in mind: | ||
* I only write documentation for my "future self", which may not be enough for people who are not in my head. | ||
* The project may never be "feature complete" as I only add new features when I need them. | ||
|
||
That being said, I also welcome suggestions and contributions. | ||
|
||
## MSRV | ||
|
||
The minimum supported rust version is currently `1.74`. | ||
|
||
It will be updated when required, and that will not be considered a breaking change (it can happen in a minor version). | ||
|
||
|
||
## Unlicense | ||
|
||
This is free and unencumbered software released into the public domain. | ||
|
||
Anyone is free to copy, modify, publish, use, compile, sell, or | ||
distribute this software, either in source code form or as a compiled | ||
binary, for any purpose, commercial or non-commercial, and by any | ||
means. | ||
|
||
In jurisdictions that recognize copyright laws, the author or authors | ||
of this software dedicate any and all copyright interest in the | ||
software to the public domain. We make this dedication for the benefit | ||
of the public at large and to the detriment of our heirs and | ||
successors. We intend this dedication to be an overt act of | ||
relinquishment in perpetuity of all present and future rights to this | ||
software under copyright law. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
For more information, please refer to <http://unlicense.org/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
This is free and unencumbered software released into the public domain. | ||
|
||
Anyone is free to copy, modify, publish, use, compile, sell, or | ||
distribute this software, either in source code form or as a compiled | ||
binary, for any purpose, commercial or non-commercial, and by any | ||
means. | ||
|
||
In jurisdictions that recognize copyright laws, the author or authors | ||
of this software dedicate any and all copyright interest in the | ||
software to the public domain. We make this dedication for the benefit | ||
of the public at large and to the detriment of our heirs and | ||
successors. We intend this dedication to be an overt act of | ||
relinquishment in perpetuity of all present and future rights to this | ||
software under copyright law. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
For more information, please refer to <http://unlicense.org/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[advisories] | ||
vulnerability = "deny" | ||
unmaintained = "deny" | ||
yanked = "deny" | ||
notice = "deny" | ||
ignore = [] | ||
|
||
[licenses] | ||
default = "deny" | ||
unlicensed = "deny" | ||
copyleft = "deny" | ||
unused-allowed-license = "allow" | ||
allow = [ | ||
"Unlicense", | ||
"MIT", | ||
"Apache-2.0", | ||
] | ||
|
||
[sources] | ||
unknown-registry = "deny" | ||
unknown-git = "deny" | ||
|
||
[bans] | ||
multiple-versions = "allow" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
set dotenv-load | ||
|
||
# Perform all verifications (compile, test, lint, etc.) | ||
verify: test lint doc check-msrv | ||
cargo deny check licenses | ||
|
||
# Watch the source files and run `just verify` when source changes | ||
watch: | ||
cargo watch --delay 0.1 --clear --why -- just verify | ||
|
||
# Run the tests | ||
test: | ||
cargo hack test --tests --feature-powerset | ||
cargo test --examples --all-features | ||
cargo test --doc --all-features | ||
|
||
# Run the static code analysis | ||
lint: | ||
cargo fmt -- --check | ||
cargo hack clippy --each-feature --all-targets | ||
|
||
# Build the documentation | ||
doc *args: | ||
cargo doc --all-features --no-deps {{args}} | ||
|
||
# Open the documentation page | ||
doc-open: (doc "--open") | ||
|
||
# Make sure the MSRV is satisfiable | ||
check-msrv: | ||
cargo msrv verify | ||
|
||
# Clean up compilation output | ||
clean: | ||
rm -rf target | ||
rm -f Cargo.lock | ||
rm -rf node_modules | ||
|
||
# Install cargo dev-tools used by the `verify` recipe (requires rustup to be already installed) | ||
install-dev-tools: | ||
rustup install stable | ||
rustup override set stable | ||
cargo install cargo-hack cargo-watch cargo-msrv | ||
|
||
# Install a git hook to run tests before every commits | ||
install-git-hooks: | ||
echo '#!/usr/bin/env sh' > .git/hooks/pre-push | ||
echo 'just verify' >> .git/hooks/pre-push | ||
chmod +x .git/hooks/pre-push | ||
|
||
release *args: verify | ||
test $GITHUB_TOKEN | ||
test $CARGO_REGISTRY_TOKEN | ||
cargo release {{args}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
allow-branch = ["main"] | ||
pre-release-commit-message = "release {{version}}" | ||
|
||
[[pre-release-replacements]] | ||
file = "CHANGELOG.md" | ||
search = "## \\[Unreleased\\]" | ||
replace = "## [Unreleased]\n\n\n## [{{version}}] - {{date}}" | ||
prerelease = true | ||
exactly = 1 | ||
|
||
[[pre-release-replacements]] | ||
file = "CHANGELOG.md" | ||
search = "\\.\\.\\.HEAD" | ||
replace = "...v{{version}}" | ||
prerelease = true | ||
exactly = 1 | ||
|
||
[[pre-release-replacements]] | ||
file = "CHANGELOG.md" | ||
search = "\\[Unreleased\\]:" | ||
replace = "[Unreleased]: https://github.com/jcornaz/rust-template/compare/v{{version}}...HEAD\n[{{version}}]:" | ||
prerelease = true | ||
exactly = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": ["config:recommended"], | ||
"timezone": "Europe/Zurich", | ||
"schedule": ["after 10pm", "before 5:00am"], | ||
"lockFileMaintenance": { | ||
"enabled": true, | ||
"automerge": true | ||
}, | ||
"packageRules": [ | ||
{ | ||
"matchCurrentVersion": ">=1.0.0", | ||
"matchUpdateTypes": [ | ||
"minor", | ||
"patch" | ||
], | ||
"automerge": true | ||
}, | ||
{ | ||
"matchCurrentVersion": ">=0.1.0 <1.0.0", | ||
"matchUpdateTypes": [ | ||
"patch" | ||
], | ||
"automerge": true | ||
}, | ||
{ | ||
"matchDepTypes": [ | ||
"dev-dependencies" | ||
], | ||
"automerge": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#![cfg_attr(docsrs, feature(doc_auto_cfg))] |