Skip to content

Commit e572d04

Browse files
authored
Merge pull request #244 from epage/update
refactor(gh): Follow standard template
2 parents 3da1104 + f1ff331 commit e572d04

20 files changed

+553
-164
lines changed

.github/dependabot.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,13 @@ updates:
33
- package-ecosystem: cargo
44
directory: "/"
55
schedule:
6-
interval: daily
6+
interval: monthly
7+
time: "07:00"
8+
open-pull-requests-limit: 10
9+
10+
- package-ecosystem: "github-actions"
11+
directory: "/"
12+
schedule:
13+
interval: monthly
14+
time: "07:00"
715
open-pull-requests-limit: 10

.github/settings.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# These settings are synced to GitHub by https://probot.github.io/apps/settings/
2+
3+
repository:
4+
description: A logging implementation for `log` which is configured via an environment variable.
5+
homepage: https://docs.rs/env_logger
6+
topics: rust logging
7+
has_issues: true
8+
has_projects: false
9+
has_wiki: false
10+
has_downloads: false
11+
default_branch: main
12+
13+
allow_squash_merge: true
14+
allow_merge_commit: true
15+
allow_rebase_merge: true
16+
17+
# Manual: allow_auto_merge: true, see https://github.com/probot/settings/issues/402
18+
delete_branch_on_merge: true
19+
20+
branches:
21+
- name: main
22+
protection:
23+
required_pull_request_reviews: null
24+
required_conversation_resolution: true
25+
required_status_checks:
26+
# Required. Require branches to be up to date before merging.
27+
strict: false
28+
contexts: ["CI", "Lint Commits", "Spell Check with Typos"]
29+
enforce_admins: false
30+
restrictions: null

.github/workflows/audit.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Security audit
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
paths:
9+
- '**/Cargo.toml'
10+
- '**/Cargo.lock'
11+
push:
12+
branches:
13+
- main
14+
15+
env:
16+
RUST_BACKTRACE: 1
17+
CARGO_TERM_COLOR: always
18+
CLICOLOR: 1
19+
20+
jobs:
21+
security_audit:
22+
permissions:
23+
issues: write # to create issues (actions-rs/audit-check)
24+
checks: write # to create check (actions-rs/audit-check)
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v3
29+
- uses: actions-rs/audit-check@v1
30+
with:
31+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yml

Lines changed: 114 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,130 @@
1-
name: Continuous Integration
1+
name: CI
2+
3+
permissions:
4+
contents: read
25

36
on:
47
pull_request:
5-
paths:
6-
- "**.rs"
7-
- "Cargo.toml"
8-
- "Cargo.lock"
8+
push:
9+
branches:
10+
- main
11+
12+
env:
13+
RUST_BACKTRACE: 1
14+
CARGO_TERM_COLOR: always
15+
CLICOLOR: 1
916

1017
jobs:
11-
fmt:
12-
name: Source formatting check
18+
ci:
19+
permissions:
20+
contents: none
21+
name: CI
22+
needs: [test, msrv, docs, rustfmt, clippy]
1323
runs-on: ubuntu-latest
1424
steps:
15-
- name: Checkout sources
16-
uses: actions/checkout@v2
17-
18-
- name: Install Rust toolchain
19-
uses: actions-rs/toolchain@v1
20-
with:
21-
profile: minimal
22-
toolchain: nightly
23-
override: true
24-
components: rustfmt
25-
26-
- name: Check formatting
27-
uses: actions-rs/cargo@v1
28-
with:
29-
command: fmt
30-
args: -- --check
31-
32-
check:
33-
name: Compilation check
34-
runs-on: ubuntu-latest
25+
- name: Done
26+
run: exit 0
27+
test:
28+
name: Test
3529
strategy:
36-
fail-fast: true
3730
matrix:
38-
rust:
39-
- stable
40-
- beta
41-
- nightly
42-
- 1.41.0
31+
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
32+
rust: ["stable"]
33+
continue-on-error: ${{ matrix.rust != 'stable' }}
34+
runs-on: ${{ matrix.os }}
4335
steps:
44-
- name: Checkout sources
45-
uses: actions/checkout@v2
46-
47-
- name: Install Rust toolchain
48-
uses: actions-rs/toolchain@v1
49-
with:
50-
profile: minimal
51-
toolchain: ${{ matrix.rust }}
52-
override: true
53-
54-
- name: Run cargo check
55-
uses: actions-rs/cargo@v1
56-
with:
57-
command: check
58-
59-
clippy:
60-
name: Lint check
36+
- name: Checkout repository
37+
uses: actions/checkout@v3
38+
- name: Install Rust
39+
uses: actions-rs/toolchain@v1
40+
with:
41+
toolchain: ${{ matrix.rust }}
42+
profile: minimal
43+
override: true
44+
- uses: Swatinem/rust-cache@v1
45+
- name: Build
46+
run: cargo test --no-run --workspace --all-features
47+
- name: Default features
48+
run: cargo test --workspace
49+
- name: All features
50+
run: cargo test --workspace --all-features
51+
- name: No-default features
52+
run: cargo test --workspace --no-default-features
53+
- name: Check feature combinations
54+
run: cargo run -p ci
55+
- name: Run crate example
56+
run: cargo run --example default
57+
msrv:
58+
name: "Check MSRV: 1.41.0"
6159
runs-on: ubuntu-latest
6260
steps:
63-
- name: Checkout sources
64-
uses: actions/checkout@v2
65-
66-
- name: Install Rust toolchain
67-
uses: actions-rs/toolchain@v1
68-
with:
69-
profile: minimal
70-
toolchain: stable
71-
override: true
72-
components: clippy
73-
74-
- name: Run lints
75-
uses: actions-rs/cargo@v1
76-
with:
77-
command: clippy
78-
args: -- -D warnings
79-
80-
ci-crate:
81-
name: CI crate check
61+
- name: Checkout repository
62+
uses: actions/checkout@v3
63+
- name: Install Rust
64+
uses: actions-rs/toolchain@v1
65+
with:
66+
toolchain: 1.41.0 # MSRV
67+
profile: minimal
68+
override: true
69+
- uses: Swatinem/rust-cache@v1
70+
- name: Default features
71+
run: cargo check --workspace --all-targets
72+
- name: All features
73+
run: cargo check --workspace --all-targets --all-features
74+
- name: No-default features
75+
run: cargo check --workspace --all-targets --no-default-features
76+
docs:
77+
name: Docs
8278
runs-on: ubuntu-latest
8379
steps:
84-
- name: Checkout sources
85-
uses: actions/checkout@v2
86-
87-
- name: Install Rust toolchain
88-
uses: actions-rs/toolchain@v1
89-
with:
90-
profile: minimal
91-
92-
- name: Run ci crate
93-
uses: actions-rs/cargo@v1
94-
with:
95-
command: run
96-
args: -p ci
97-
98-
crate-example:
99-
name: Crate example check
80+
- name: Checkout repository
81+
uses: actions/checkout@v3
82+
- name: Install Rust
83+
uses: actions-rs/toolchain@v1
84+
with:
85+
toolchain: stable
86+
profile: minimal
87+
override: true
88+
- uses: Swatinem/rust-cache@v1
89+
- name: Check documentation
90+
env:
91+
RUSTDOCFLAGS: -D warnings
92+
run: cargo doc --workspace --all-features --no-deps --document-private-items
93+
rustfmt:
94+
name: rustfmt
10095
runs-on: ubuntu-latest
10196
steps:
102-
- name: Checkout sources
103-
uses: actions/checkout@v2
104-
105-
- name: Install Rust toolchain
106-
uses: actions-rs/toolchain@v1
107-
with:
108-
profile: minimal
109-
110-
- name: Run crate example
111-
uses: actions-rs/cargo@v1
112-
with:
113-
command: run
114-
args: --example default
97+
- name: Checkout repository
98+
uses: actions/checkout@v3
99+
- name: Install Rust
100+
uses: actions-rs/toolchain@v1
101+
with:
102+
# Not MSRV because its harder to jump between versions and people are
103+
# more likely to have stable
104+
toolchain: stable
105+
profile: minimal
106+
override: true
107+
components: rustfmt
108+
- uses: Swatinem/rust-cache@v1
109+
- name: Check formatting
110+
run: cargo fmt --all -- --check
111+
clippy:
112+
name: clippy
113+
runs-on: ubuntu-latest
114+
permissions:
115+
checks: write # to create check (actions-rs/audit-check)
116+
steps:
117+
- name: Checkout repository
118+
uses: actions/checkout@v3
119+
- name: Install Rust
120+
uses: actions-rs/toolchain@v1
121+
with:
122+
toolchain: 1.41.0 # MSRV
123+
profile: minimal
124+
override: true
125+
components: clippy
126+
- uses: Swatinem/rust-cache@v1
127+
- uses: actions-rs/clippy-check@v1
128+
with:
129+
token: ${{ secrets.GITHUB_TOKEN }}
130+
args: --workspace --all-features --all-targets -- -D warnings --allow deprecated

.github/workflows/committed.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Not run as part of pre-commit checks because they don't handle sending the correct commit
2+
# range to `committed`
3+
name: Lint Commits
4+
on: [pull_request]
5+
6+
permissions:
7+
contents: read
8+
9+
env:
10+
RUST_BACKTRACE: 1
11+
CARGO_TERM_COLOR: always
12+
CLICOLOR: 1
13+
14+
jobs:
15+
committed:
16+
name: Lint Commits
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout Actions Repository
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
- name: Lint Commits
24+
uses: crate-ci/committed@master

.github/workflows/docs.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/pre-commit.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: pre-commit
2+
3+
permissions: {} # none
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches: [main]
9+
10+
env:
11+
RUST_BACKTRACE: 1
12+
CARGO_TERM_COLOR: always
13+
CLICOLOR: 1
14+
15+
jobs:
16+
pre-commit:
17+
permissions:
18+
contents: read
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
- uses: actions/setup-python@v3
23+
- uses: pre-commit/[email protected]

0 commit comments

Comments
 (0)