Skip to content

Commit 3eb1b07

Browse files
authored
Merge pull request #2 from khagankhan/workflow
Workflow
2 parents a581f5d + 3461a0d commit 3eb1b07

File tree

6 files changed

+304
-1
lines changed

6 files changed

+304
-1
lines changed

.github/codecov.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# .codecov.yml
2+
# Tresholds are lenient in the beginning
3+
4+
coverage:
5+
range: 70..100
6+
round: down
7+
precision: 1
8+
9+
status:
10+
project:
11+
default:
12+
threshold: 5%
13+
patch:
14+
default:
15+
target: 60%
16+
threshold: 10%
17+
18+
ignore:
19+
- "tests"
20+
- "examples"
21+
22+
comment:
23+
layout: "files"
24+
require_changes: true

.github/dependabot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# .dependabot.yml
2+
3+
version: 2
4+
5+
updates:
6+
- package-ecosystem: "github-actions"
7+
directory: "/"
8+
schedule:
9+
interval: "monthly"
10+
11+
- package-ecosystem: "cargo"
12+
directory: "/"
13+
schedule:
14+
interval: "daily"
15+
ignore:
16+
- dependency-name: "*"
17+
update-types:
18+
- "version-update:semver-patch"
19+
- "version-update:semver-minor"

.github/workflows/check.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# .check.yml
2+
3+
name: check
4+
5+
permissions:
6+
contents: read
7+
8+
on:
9+
push:
10+
branches: [ main ]
11+
pull_request:
12+
merge_group:
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
fmt:
20+
runs-on: ubuntu-latest
21+
name: stable / fmt
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: dtolnay/rust-toolchain@stable
25+
with:
26+
components: rustfmt
27+
- uses: Swatinem/rust-cache@v2
28+
- name: cargo fmt --check
29+
run: cargo fmt --all -- --check
30+
31+
clippy:
32+
runs-on: ubuntu-latest
33+
name: ${{ matrix.toolchain }} / clippy
34+
permissions:
35+
contents: read
36+
checks: write
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
toolchain: [stable, beta]
41+
steps:
42+
- uses: actions/checkout@v4
43+
- uses: dtolnay/rust-toolchain@master
44+
with:
45+
toolchain: ${{ matrix.toolchain }}
46+
components: clippy
47+
- uses: Swatinem/rust-cache@v2
48+
- name: cargo clippy (PR annotations)
49+
uses: giraffate/clippy-action@v1
50+
with:
51+
reporter: github-pr-check
52+
github_token: ${{ secrets.GITHUB_TOKEN }}
53+
54+
semver:
55+
if: startsWith(github.ref, 'refs/tags/v')
56+
runs-on: ubuntu-latest
57+
name: semver
58+
steps:
59+
- uses: actions/checkout@v4
60+
- uses: dtolnay/rust-toolchain@stable
61+
- uses: Swatinem/rust-cache@v2
62+
- name: cargo-semver-checks
63+
uses: obi1kenobi/cargo-semver-checks-action@v2
64+
65+
doc:
66+
runs-on: ubuntu-latest
67+
name: nightly / doc
68+
steps:
69+
- uses: actions/checkout@v4
70+
- uses: dtolnay/rust-toolchain@nightly
71+
- name: Install cargo-docs-rs
72+
uses: dtolnay/install@cargo-docs-rs
73+
- uses: Swatinem/rust-cache@v2
74+
- name: cargo docs-rs
75+
run: cargo docs-rs
76+
77+
hack:
78+
runs-on: ubuntu-latest
79+
name: ubuntu / stable / features
80+
steps:
81+
- uses: actions/checkout@v4
82+
- uses: dtolnay/rust-toolchain@stable
83+
- name: Install cargo-hack
84+
uses: taiki-e/install-action@cargo-hack
85+
- uses: Swatinem/rust-cache@v2
86+
- name: cargo hack
87+
run: cargo hack --feature-powerset check
88+
89+
msrv:
90+
runs-on: ubuntu-latest
91+
strategy:
92+
matrix:
93+
msrv: ["1.89.0"]
94+
name: ubuntu / ${{ matrix.msrv }}
95+
steps:
96+
- uses: actions/checkout@v4
97+
- uses: dtolnay/rust-toolchain@master
98+
with:
99+
toolchain: ${{ matrix.msrv }}
100+
- uses: Swatinem/rust-cache@v2
101+
- name: cargo +${{ matrix.msrv }} check
102+
run: cargo +${{ matrix.msrv }} check --all

.github/workflows/scheduled.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: rolling
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches: [ main ]
9+
pull_request:
10+
schedule:
11+
# Every Friday at 13:13 UTC. So help me God
12+
- cron: '13 13 * * 5'
13+
merge_group:
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
nightly:
21+
runs-on: ubuntu-latest
22+
name: ubuntu / nightly
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: dtolnay/rust-toolchain@nightly
26+
- uses: Swatinem/rust-cache@v2
27+
- name: cargo generate-lockfile
28+
if: hashFiles('Cargo.lock') == ''
29+
run: cargo generate-lockfile
30+
- name: cargo test --locked
31+
run: cargo test --locked --all-features --all-targets
32+
33+
update:
34+
runs-on: ubuntu-latest
35+
name: ubuntu / beta / updated
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: Install beta
39+
if: hashFiles('Cargo.lock') != ''
40+
uses: dtolnay/rust-toolchain@beta
41+
- uses: Swatinem/rust-cache@v2
42+
- name: cargo update
43+
if: hashFiles('Cargo.lock') != ''
44+
run: cargo update
45+
- name: cargo test
46+
if: hashFiles('Cargo.lock') != ''
47+
run: cargo test --locked --all-features --all-targets
48+
env:
49+
RUSTFLAGS: -D deprecated

.github/workflows/test.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# .test.yml
2+
3+
name: test
4+
5+
permissions:
6+
contents: read
7+
8+
on:
9+
push:
10+
branches: [ main ]
11+
pull_request:
12+
merge_group:
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
required:
20+
runs-on: ubuntu-latest
21+
name: ubuntu / ${{ matrix.toolchain }}
22+
strategy:
23+
matrix:
24+
toolchain: [stable, beta]
25+
steps:
26+
- uses: actions/checkout@v4
27+
- name: Install ${{ matrix.toolchain }}
28+
uses: dtolnay/rust-toolchain@master
29+
with:
30+
toolchain: ${{ matrix.toolchain }}
31+
- uses: Swatinem/rust-cache@v2
32+
- name: cargo generate-lockfile
33+
if: hashFiles('Cargo.lock') == ''
34+
run: cargo generate-lockfile
35+
- name: cargo test --locked (all targets)
36+
run: cargo test --locked --all-features --all-targets
37+
- name: cargo test --doc (locked)
38+
run: cargo test --locked --all-features --doc
39+
40+
minimal:
41+
runs-on: ubuntu-latest
42+
name: ubuntu / stable / minimal-versions
43+
steps:
44+
- uses: actions/checkout@v4
45+
- name: Install stable
46+
uses: dtolnay/rust-toolchain@stable
47+
- name: Install nightly for -Zminimal-versions
48+
uses: dtolnay/rust-toolchain@nightly
49+
- uses: Swatinem/rust-cache@v2
50+
- name: Set default to stable
51+
run: rustup default stable
52+
- name: cargo update -Z minimal-versions
53+
run: cargo +nightly update -Z minimal-versions
54+
- name: cargo test (locked)
55+
run: cargo test --locked --all-features --all-targets
56+
57+
os-check:
58+
runs-on: ${{ matrix.os }}
59+
name: ${{ matrix.os }} / stable
60+
strategy:
61+
fail-fast: false
62+
matrix:
63+
os: [macos-latest, windows-latest]
64+
steps:
65+
- uses: actions/checkout@v4
66+
- name: Install stable
67+
uses: dtolnay/rust-toolchain@stable
68+
- uses: Swatinem/rust-cache@v2
69+
- name: cargo generate-lockfile
70+
if: hashFiles('Cargo.lock') == ''
71+
run: cargo generate-lockfile
72+
- name: cargo test (locked)
73+
run: cargo test --locked --all-features --all-targets
74+
75+
coverage:
76+
runs-on: ubuntu-latest
77+
name: ubuntu / stable / coverage
78+
permissions:
79+
contents: read
80+
id-token: write
81+
steps:
82+
- uses: actions/checkout@v4
83+
- name: Install stable + llvm-tools
84+
uses: dtolnay/rust-toolchain@stable
85+
with:
86+
components: llvm-tools-preview
87+
- uses: Swatinem/rust-cache@v2
88+
- name: Install cargo-llvm-cov
89+
uses: taiki-e/install-action@cargo-llvm-cov
90+
- name: cargo generate-lockfile
91+
if: hashFiles('Cargo.lock') == ''
92+
run: cargo generate-lockfile
93+
- name: cargo llvm-cov (produce lcov.info)
94+
run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
95+
- name: Record OS/Rust (for Codecov)
96+
run: |
97+
echo "OS=${{ runner.os }}" >> "$GITHUB_ENV"
98+
echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
99+
- name: Upload to codecov.io (OIDC)
100+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false }}
101+
uses: codecov/codecov-action@v5
102+
with:
103+
use_oidc: true
104+
files: lcov.info
105+
env_vars: OS,RUST
106+
fail_ci_if_error: true

tests/cli.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ fn dies_no_args() -> TestResult {
1313

1414
cmd.assert()
1515
.failure()
16-
.stderr(contains("Usage: trait-winnower [OPTIONS] <COMMAND>"));
16+
.stderr(contains("Usage:"))
17+
.stderr(contains("[OPTIONS] <COMMAND>"))
18+
.stderr(contains("Commands:"));
19+
1720
Ok(())
1821
}

0 commit comments

Comments
 (0)