Skip to content

Commit f0e2aff

Browse files
committed
feat: initial commit
0 parents  commit f0e2aff

24 files changed

+970
-0
lines changed

.codecov.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
comment: false
2+
3+
coverage:
4+
status:
5+
project:
6+
default:
7+
threshold: 100% # make CI green
8+
patch:
9+
default:
10+
threshold: 100% # make CI green
11+
12+
ignore:
13+
- "**/tests"
14+
- "**/benches"
15+
- "**/examples"

.cspell.config.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
words:
2+
- detrim
3+
- docsrs

.envrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.github/FUNDING.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: [robjtede]

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
- package-ecosystem: cargo
8+
directory: /
9+
schedule:
10+
interval: weekly
11+
versioning-strategy: lockfile-only

.github/workflows/ci.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
merge_group:
7+
types: [checks_requested]
8+
pull_request:
9+
branches: [main]
10+
11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
read_msrv:
20+
name: Read MSRV
21+
uses: actions-rust-lang/msrv/.github/workflows/msrv.yml@main
22+
23+
test:
24+
needs: read_msrv
25+
26+
name: Test
27+
runs-on: ubuntu-latest
28+
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
toolchain:
33+
- { name: msrv, version: "${{ needs.read_msrv.outputs.msrv }}" }
34+
- { name: stable, version: stable }
35+
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- name: Install Rust (${{ matrix.toolchain.name }})
40+
uses: actions-rust-lang/[email protected]
41+
with:
42+
toolchain: ${{ matrix.toolchain.version }}
43+
44+
- name: Install just, cargo-nextest
45+
uses: taiki-e/[email protected]
46+
with:
47+
tool: just,cargo-nextest
48+
49+
- name: Workaround MSRV issues
50+
if: matrix.toolchain.name == 'msrv'
51+
run: just downgrade-msrv
52+
53+
- name: Test
54+
run: cargo test --workspace --all-features

.github/workflows/coverage.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Coverage
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
coverage:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Install Rust
21+
uses: actions-rust-lang/[email protected]
22+
with:
23+
components: llvm-tools-preview
24+
25+
- name: Install just, cargo-llvm-cov
26+
uses: taiki-e/[email protected]
27+
with:
28+
tool: just,cargo-llvm-cov
29+
30+
- name: Generate code coverage
31+
run: just test-coverage-codecov
32+
33+
- name: Upload coverage to Codecov
34+
uses: codecov/[email protected]
35+
with:
36+
token: ${{ secrets.CODECOV_TOKEN }}
37+
files: codecov.json
38+
fail_ci_if_error: true
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Dependabot Reviewer
2+
3+
on: pull_request_target
4+
5+
permissions:
6+
pull-requests: write
7+
contents: write
8+
9+
jobs:
10+
review-dependabot-pr:
11+
name: Approve PR
12+
runs-on: ubuntu-latest
13+
if: ${{ github.actor == 'dependabot[bot]' }}
14+
env:
15+
PR_URL: ${{ github.event.pull_request.html_url }}
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
steps:
18+
- name: Fetch Dependabot metadata
19+
id: dependabot-metadata
20+
uses: dependabot/[email protected]
21+
22+
- name: Enable auto-merge for Dependabot PRs
23+
run: gh pr merge --auto --squash "$PR_URL"
24+
25+
- name: Approve patch and minor updates
26+
if: ${{ steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch'|| steps.dependabot-metadata.outputs.update-type == 'version-update:semver-minor'}}
27+
run: |
28+
gh pr review "$PR_URL" --approve --body "I'm **approving** this pull request because **it only includes patch or minor updates**."
29+
30+
- name: Approve major updates of dev dependencies
31+
if: ${{ steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:development'}}
32+
run: |
33+
gh pr review "$PR_URL" --approve --body "I'm **approving** this pull request because **it only includes major updates of dev dependencies**."
34+
35+
- name: Comment on major updates of normal dependencies
36+
if: ${{ steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' && steps.dependabot-metadata.outputs.dependency-type == 'direct:production'}}
37+
run: |
38+
gh pr comment "$PR_URL" --body "I'm **not approving** this PR because **it includes major updates of normal dependencies**."
39+
gh pr edit "$PR_URL" --add-label "requires-manual-qa"

.github/workflows/lint.yml

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Lint
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
clippy:
16+
runs-on: ubuntu-latest
17+
18+
permissions:
19+
contents: read
20+
checks: write
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Install Rust
26+
uses: actions-rust-lang/[email protected]
27+
with:
28+
components: clippy
29+
30+
- name: Install just, cargo-hack
31+
uses: taiki-e/[email protected]
32+
with:
33+
tool: just,cargo-hack
34+
35+
- name: Clippy
36+
run: just clippy
37+
38+
rustfmt:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- name: Install Rust (nightly)
44+
uses: actions-rust-lang/[email protected]
45+
with:
46+
toolchain: nightly
47+
components: rustfmt
48+
49+
- run: cargo fmt -- --check
50+
51+
docs:
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Install Rust
57+
uses: actions-rust-lang/[email protected]
58+
with:
59+
components: rust-docs
60+
61+
- name: Check for broken intra-doc links
62+
env:
63+
RUSTDOCFLAGS: -D warnings
64+
run: cargo doc --workspace --no-deps --all-features
65+
66+
public-api-diff:
67+
runs-on: ubuntu-latest
68+
steps:
69+
- name: Checkout main branch
70+
uses: actions/checkout@v4
71+
with:
72+
ref: ${{ github.base_ref }}
73+
74+
- name: Checkout PR branch
75+
uses: actions/checkout@v4
76+
77+
- name: Install Rust
78+
uses: actions-rust-lang/[email protected]
79+
with:
80+
toolchain: nightly-2023-08-25
81+
82+
- name: Install cargo-public-api
83+
uses: taiki-e/[email protected]
84+
with:
85+
tool: cargo-public-api
86+
87+
- name: Generate API diff
88+
run: cargo public-api diff ${{ github.event.pull_request.base.sha }}..${{ github.sha }}

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# rust
2+
/target/
3+
4+
# direnv
5+
/.direnv/
6+
7+
# code coverage
8+
/codecov.json
9+
/lcov.info

.prettierrc.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
overrides:
2+
- files: "*.md"
3+
options:
4+
printWidth: 9999
5+
proseWrap: never

.rustfmt.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
imports_granularity = "Crate"
2+
group_imports = "StdExternalCrate"
3+
use_field_init_shorthand = true

.taplo.toml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
exclude = ["target/*"]
2+
include = ["**/*.toml"]
3+
4+
[formatting]
5+
column_width = 100
6+
7+
[[rule]]
8+
include = ["**/Cargo.toml"]
9+
keys = ["dependencies", "*-dependencies"]
10+
11+
[rule.formatting]
12+
reorder_keys = true
13+
14+
[[rule]]
15+
include = ["**/Cargo.toml"]
16+
keys = ["dependencies.*", "*-dependencies.*"]
17+
18+
[rule.formatting]
19+
reorder_keys = false

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"cSpell.autoFormatConfigFile": true
3+
}

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
## Unreleased
4+
5+
## 0.1.0
6+
7+
- Add `string()` function.
8+
- Add `string_non_empty()` function.
9+
- Add `option_string_non_empty()` function.

0 commit comments

Comments
 (0)