Skip to content

Commit

Permalink
Merge pull request #261 from epage/template
Browse files Browse the repository at this point in the history
chore Update from '_rust/main' template
  • Loading branch information
epage committed Apr 5, 2023
2 parents 821a047 + 7146834 commit c9f36dc
Show file tree
Hide file tree
Showing 14 changed files with 489 additions and 257 deletions.
11 changes: 11 additions & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
msrv = "1.60.0" # MSRV
warn-on-all-wildcard-imports = true
allow-expect-in-tests = true
allow-unwrap-in-tests = true
allow-dbg-in-tests = true
allow-print-in-tests = true
disallowed-methods = [
{ path = "std::option::Option::map_or", reason = "use `map(..).unwrap_or(..)`" },
{ path = "std::option::Option::map_or_else", reason = "use `map(..).unwrap_or_else(..)`" },
{ path = "std::result::Result::map_or", reason = "use `map(..).unwrap_or(..)`" },
{ path = "std::result::Result::map_or_else", reason = "use `map(..).unwrap_or_else(..)`" },
]
26 changes: 26 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,33 @@
],
"semanticCommits": "enabled",
"configMigration": true,
"dependencyDashboard": true,
"regexManagers": [
{
"fileMatch": [
"^rust-toolchain\\.toml$",
"Cargo.toml$",
"clippy.toml$",
"\.clippy.toml$",
"^\.github/workflows/ci.yml$",
"^\.github/workflows/rust-next.yml$",
],
"matchStrings": [
"MSRV.*?(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)",
"(?<currentValue>\\d+\\.\\d+(\\.\\d+)?).*?MSRV",
],
"depNameTemplate": "rust",
"packageNameTemplate": "rust-lang/rust",
"datasourceTemplate": "github-releases",
}
],
"packageRules": [
{
"commitMessageTopic": "MSRV",
"matchManagers": ["regex"],
"matchPackageNames": ["rust"],
"stabilityDays": 252, // 6 releases * 6 weeks per release * 7 days per week
},
// Goals:
// - Keep version reqs low, ignoring compatible normal/build dependencies
// - Take advantage of latest dev-dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

repository:
description: A logging implementation for `log` which is configured via an environment variable.
homepage: https://docs.rs/env_logger
topics: rust logging
homepage: "https://docs.rs/env_logger"
topics: "rust logging"
has_issues: true
has_projects: false
has_wiki: false
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,27 @@ jobs:
issues: write # to create issues (actions-rs/audit-check)
checks: write # to create check (actions-rs/audit-check)
runs-on: ubuntu-latest
# Prevent sudden announcement of a new advisory from failing ci:
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

cargo_deny:
permissions:
issues: write # to create issues (actions-rs/audit-check)
checks: write # to create check (actions-rs/audit-check)
runs-on: ubuntu-latest
strategy:
matrix:
checks:
- bans licenses sources
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}
rust-version: stable
44 changes: 23 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,15 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-hack
- name: Build
run: cargo test --no-run --workspace --all-features
- name: Test
run: cargo hack test --feature-powerset
run: cargo hack test --workspace --feature-powerset
- name: Run crate example
run: cargo run --example default
msrv:
Expand All @@ -56,27 +54,23 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.60.0 # MSRV
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-hack
- name: Check
run: cargo hack check --feature-powerset
run: cargo hack check --workspace --all-targets --feature-powerset
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2
- name: Check documentation
env:
Expand All @@ -89,13 +83,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
# Not MSRV because its harder to jump between versions and people are
# more likely to have stable
toolchain: stable
profile: minimal
override: true
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Check formatting
Expand All @@ -104,19 +96,29 @@ jobs:
name: clippy
runs-on: ubuntu-latest
permissions:
checks: write # to create check (actions-rs/audit-check)
security-events: write # to upload sarif results
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.60.0 # MSRV
profile: minimal
override: true
components: clippy
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/clippy-check@v1
- name: Install SARIF tools
run: cargo install clippy-sarif --version 0.3.4 --locked # Held back due to msrv
- name: Install SARIF tools
run: cargo install sarif-fmt --version 0.3.4 --locked # Held back due to msrv
- name: Check
run: >
cargo clippy --workspace --all-features --all-targets --message-format=json -- -D warnings --allow deprecated
| clippy-sarif
| tee clippy-results.sarif
| sarif-fmt
continue-on-error: true
- name: Upload
uses: github/codeql-action/upload-sarif@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --all-features --all-targets -- -D warnings --allow deprecated
sarif_file: clippy-results.sarif
wait-for-processing: true
41 changes: 41 additions & 0 deletions .github/workflows/rust-next.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: rust-next

permissions:
contents: read

on:
schedule:
- cron: '5 5 5 * *'

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

jobs:
test:
name: Test
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
rust: ["stable", "beta"]
include:
- os: ubuntu-latest
rust: "nightly"
continue-on-error: ${{ matrix.rust != 'stable' }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-hack
- name: Build
run: cargo test --no-run --workspace --all-features
- name: Test
run: cargo hack test --workspace --feature-powerset
- name: Run crate example
run: cargo run --example default
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ Pre-requisites
- Running `cargo login`
- A member of `rust-cli:Maintainers`
- Push permission to the repo
- [`cargo-release`](https://github.com/crate-ci/cargo-release/)

When we're ready to release, a project owner should do the following
1. Update the changelog
1. Update the changelog (see `cargo release changes` for ideas)
2. Determine what the next version is, according to semver
3. Run [`cargo release -x <level>`](https://github.com/crate-ci/cargo-release)

[issues]: https://github.com/rust-cli/env_logger/issues
[new issue]: https://github.com/rust-cli/env_logger/issues/new
[all issues]: https://github.com/rust-cli/env_logger/issues?utf8=%E2%9C%93&q=is%3Aissue
[travis]: https://github.com/rust-cli/env_logger/blob/master/.travis.yml
4 changes: 0 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
[workspace]
members = [
]

[package]
name = "env_logger"
version = "0.10.0"
description = """
A logging implementation for `log` which is configured via an environment
variable.
"""
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-cli/env_logger/"
categories = ["development-tools::debugging"]
keywords = ["logging", "log", "logger"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.60.0" # MSRV
include = [
"build.rs",
"src/**/*",
"Cargo.toml",
"Cargo.lock",
"LICENSE*",
"README.md",
"tests/**/*",
"benches/**/*",
"examples/**/*"
]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.release]
pre-release-replacements = [
{file="CHANGELOG.md", search="Unreleased", replace="{{version}}", min=1},
Expand Down

0 comments on commit c9f36dc

Please sign in to comment.