Skip to content

Commit

Permalink
chore: Update from _rust/main template
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jul 26, 2024
2 parents c7af471 + 266ead1 commit 063ac6d
Show file tree
Hide file tree
Showing 13 changed files with 198 additions and 68 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
permissions:
contents: none
name: CI
needs: [test, msrv, lockfile, docs, rustfmt, clippy]
needs: [test, msrv, lockfile, docs, rustfmt, clippy, minimal-versions]
runs-on: ubuntu-latest
if: "always()"
steps:
Expand All @@ -35,7 +35,7 @@ jobs:
name: Test
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-14"]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
rust: ["stable"]
continue-on-error: ${{ matrix.rust != 'stable' }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -67,6 +67,24 @@ jobs:
- uses: taiki-e/install-action@cargo-hack
- name: Default features
run: cargo hack check --feature-powerset --locked --rust-version --ignore-private --workspace --all-targets
minimal-versions:
name: Minimal versions
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install stable Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Install nightly Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
- name: Downgrade dependencies to minimal versions
run: cargo +nightly generate-lockfile -Z minimal-versions
- name: Compile with minimal versions
run: cargo +stable check --workspace --all-features --locked
lockfile:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rust-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
name: Test
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest", "macos-14"]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
rust: ["stable", "beta"]
include:
- os: ubuntu-latest
Expand Down
43 changes: 30 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,42 @@ Auto-cleans up your change according to some rules we have like:

### Process

When you first post a PR, we request that the commit history get cleaned
up. We recommend avoiding this during the PR to make it easier to review how
feedback was handled. Once the commit is ready, we'll ask you to clean up the
commit history. Once you let us know this is done, we can move forward with
merging! If you are uncomfortable with these parts of git, let us know and we
can help.

We ask that all new files have the copyright header. Please update the
copyright year for files you are modifying.

As a heads up, we'll be running your PR through the following gauntlet:
- warnings turned to compile errors
- `cargo test`
- `rustfmt`
- `clippy`
- `rustdoc`
- [`committed`](https://github.com/crate-ci/committed) to enforce [conventional commits](https://www.conventionalcommits.org)

Check out our [CI][CI] for more information.
- [`committed`](https://github.com/crate-ci/committed) as we use [Conventional](https://www.conventionalcommits.org) commit style
- [`typos`](https://github.com/crate-ci/typos) to check spelling

Not everything can be checked automatically though.

We request that the commit history gets cleaned up.
We ask that commits are atomic, meaning they are complete and have a single responsibility.
PRs should tell a cohesive story, with test and refactor commits that keep the
fix or feature commits simple and clear.

Specifically, we would encouage
- File renames be isolated into their own commit
- Add tests in a commit before their feature or fix, showing the current behavior.
The diff for the feature/fix commit will then show how the behavior changed,
making it clearer to reviewrs and the community and showing people that the
test is verifying the expected state.
- e.g. [clap#5520](https://github.com/clap-rs/clap/pull/5520)

Note that we are talking about ideals.
We understand having a clean history requires more advanced git skills;
feel free to ask us for help!
We might even suggest where it would work to be lax.
We also understand that editing some early commits may cause a lot of churn
with merge conflicts which can make it not worth editing all of the history.

For code organization, we recommend
- Grouping `impl` blocks next to their type (or trait)
- Grouping private items after the `pub` item that uses them.
- The intent is to help people quickly find the "relevant" details, allowing them to "dig deeper" as needed. Or put another way, the `pub` items serve as a table-of-contents.
- The exact order is fuzzy; do what makes sense

## Releasing

Expand Down
7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ default-members = ["crates/typos-cli"]
resolver = "2"

[workspace.package]
license = "MIT OR Apache-2.0"
repository = "https://github.com/crate-ci/typos"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.75" # MSRV
include = [
Expand All @@ -22,7 +22,7 @@ include = [
]

[workspace.lints.rust]
rust_2018_idioms = "warn"
rust_2018_idioms = { level = "warn", priority = -1 }
unreachable_pub = "warn"
unsafe_op_in_unsafe_fn = "warn"
unused_lifetimes = "warn"
Expand Down Expand Up @@ -63,7 +63,6 @@ let_and_return = "allow" # sometimes good to name what you are returning
linkedlist = "warn"
lossy_float_literal = "warn"
macro_use_imports = "warn"
match_wildcard_for_single_variants = "warn"
mem_forget = "warn"
mutex_integer = "warn"
needless_for_each = "warn"
Expand All @@ -77,14 +76,14 @@ rest_pat_in_fully_bound_structs = "warn"
same_functions_in_if_condition = "warn"
self_named_module_files = "warn"
semicolon_if_nothing_returned = "warn"
single_match_else = "warn"
str_to_string = "warn"
string_add = "warn"
string_add_assign = "warn"
string_lit_as_bytes = "warn"
string_to_string = "warn"
todo = "warn"
trait_duplication_in_bounds = "warn"
uninlined_format_args = "warn"
verbose_file_reads = "warn"
wildcard_imports = "warn"
zero_sized_map_values = "warn"
Expand Down
2 changes: 1 addition & 1 deletion crates/dictgen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version = "0.2.8"
description = "Compile-time case-insensitive map"
categories = ["development-tools", "text-processing"]
keywords = ["development", "spelling", "no_std"]
license.workspace = true
repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
include.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/misspell-dict/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ description = "Source Code Spelling Correction"
readme = "README.md"
categories = ["development-tools", "text-processing"]
keywords = ["development", "spelling"]
license.workspace = true
repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
include.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/typos-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ description = "Source Code Spelling Correction"
readme = "../../README.md"
categories = ["development-tools", "text-processing"]
keywords = ["development", "spelling"]
license.workspace = true
repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
include.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/typos-dict/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ description = "Source Code Spelling Correction"
readme = "../../README.md"
categories = ["development-tools", "text-processing"]
keywords = ["development", "spelling"]
license.workspace = true
repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
include.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/typos-vars/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ description = "Source Code Spelling Correction"
readme = "../../README.md"
categories = ["development-tools", "text-processing"]
keywords = ["development", "spelling"]
license.workspace = true
repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
include.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/typos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ description = "Source Code Spelling Correction"
readme = "../../README.md"
categories = ["development-tools", "text-processing"]
keywords = ["development", "spelling"]
license.workspace = true
repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
include.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/varcon-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version = "4.0.9"
description = "Varcon-relevant data structures"
readme = "../../README.md"
categories = ["text-processing"]
license.workspace = true
repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
include.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/varcon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ description = "Source Code Spelling Correction"
readme = "../../README.md"
categories = ["development-tools", "text-processing"]
keywords = ["development", "spelling"]
license.workspace = true
repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
include.workspace = true
Expand Down
Loading

0 comments on commit 063ac6d

Please sign in to comment.