Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update from _rust/main template #356

Merged
merged 12 commits into from
Jul 26, 2024
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,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 @@ -72,9 +72,6 @@ jobs:
run: cargo hack check --all-features --locked --rust-version --ignore-private --workspace --all-targets
- name: No-default features
run: cargo hack check --no-default-features --locked --rust-version --ignore-private --workspace --all-targets
# Make sure the library builds with all dependencies downgraded to their
# oldest versions allowed by the semver spec. This ensures we have not
# under-specified any dependency
minimal-versions:
name: Minimal versions
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rust-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,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 Expand Up @@ -53,7 +53,7 @@ jobs:
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Update dependencues
- name: Update dependencies
run: cargo update
- name: Default features
run: cargo test --workspace --all-targets
Expand Down
45 changes: 30 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,42 @@ to re-work some of it and the discouragement that goes along with that.

### Process

Before posting a PR, we request that the commit history get cleaned up.
However, we recommend avoiding this during the review to make it easier to
check how feedback was handled. Once the PR is ready, we'll ask you to clean up
the commit history from the review. 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.

For commit messages, we use [Conventional](https://www.conventionalcommits.org)
style. If you already wrote your commits and don't feel comfortable changing
them, don't worry and go ahead and create your PR. We'll work with you on the
best route forward. You can check your branch locally with
[`committed`](https://github.com/crate-ci/committed).

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)
- [`typos`](https://github.com/crate-ci/typos)
- [`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
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ members = ["crates/*"]
resolver = "2"

[workspace.package]
repository = "https://github.com/assert-rs/snapbox/"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.65" # MSRV
Expand All @@ -17,7 +18,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
2 changes: 1 addition & 1 deletion crates/snapbox-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
name = "snapbox-macros"
version = "0.3.10"
description = "Snapshot testing toolbox"
repository = "https://github.com/assert-rs/trycmd/"
homepage = "https://github.com/assert-rs/trycmd/tree/main/crates/snapbox"
documentation = "http://docs.rs/snapbox/"
readme = "README.md"
categories = ["development-tools::testing"]
keywords = ["cli", "test", "assert", "command"]
repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/snapbox/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
name = "snapbox"
version = "0.6.16"
description = "Snapshot testing toolbox"
repository = "https://github.com/assert-rs/trycmd/"
homepage = "https://github.com/assert-rs/trycmd/tree/main/crates/snapbox"
documentation = "http://docs.rs/snapbox/"
readme = "README.md"
categories = ["development-tools::testing"]
keywords = ["cli", "test", "assert", "command"]
repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/trycmd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name = "trycmd"
version = "0.15.6"
description = "Snapshot testing for a herd of CLI tests"
authors = ["Ed Page <eopage@gmail.com>"]
repository = "https://github.com/assert-rs/trycmd.git"
homepage = "https://github.com/assert-rs/trycmd"
documentation = "http://docs.rs/trycmd/"
readme = "README.md"
categories = ["development-tools::testing"]
keywords = ["cli", "test", "assert", "command", "duct"]
repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/tryfn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name = "tryfn"
version = "0.2.3"
description = "File-driven snapshot testing for a function"
authors = ["Ed Page <eopage@gmail.com>"]
repository = "https://github.com/assert-rs/trycmd.git"
homepage = "https://github.com/assert-rs/trycmd"
documentation = "http://docs.rs/tryfn/"
readme = "README.md"
categories = ["development-tools::testing"]
keywords = ["test", "assert", "snapsjot"]
repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
Expand Down
Loading
Loading