Skip to content

Commit

Permalink
Merge pull request #244 from epage/update
Browse files Browse the repository at this point in the history
refactor(gh): Follow standard template
  • Loading branch information
epage committed Nov 9, 2022
2 parents 3da1104 + f1ff331 commit e572d04
Show file tree
Hide file tree
Showing 20 changed files with 553 additions and 164 deletions.
10 changes: 9 additions & 1 deletion .github/dependabot.yml
Expand Up @@ -3,5 +3,13 @@ updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
interval: monthly
time: "07:00"
open-pull-requests-limit: 10

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: monthly
time: "07:00"
open-pull-requests-limit: 10
30 changes: 30 additions & 0 deletions .github/settings.yml
@@ -0,0 +1,30 @@
# These settings are synced to GitHub by https://probot.github.io/apps/settings/

repository:
description: A logging implementation for `log` which is configured via an environment variable.
homepage: https://docs.rs/env_logger
topics: rust logging
has_issues: true
has_projects: false
has_wiki: false
has_downloads: false
default_branch: main

allow_squash_merge: true
allow_merge_commit: true
allow_rebase_merge: true

# Manual: allow_auto_merge: true, see https://github.com/probot/settings/issues/402
delete_branch_on_merge: true

branches:
- name: main
protection:
required_pull_request_reviews: null
required_conversation_resolution: true
required_status_checks:
# Required. Require branches to be up to date before merging.
strict: false
contexts: ["CI", "Lint Commits", "Spell Check with Typos"]
enforce_admins: false
restrictions: null
31 changes: 31 additions & 0 deletions .github/workflows/audit.yml
@@ -0,0 +1,31 @@
name: Security audit

permissions:
contents: read

on:
pull_request:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
push:
branches:
- main

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

jobs:
security_audit:
permissions:
issues: write # to create issues (actions-rs/audit-check)
checks: write # to create check (actions-rs/audit-check)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
212 changes: 114 additions & 98 deletions .github/workflows/ci.yml
@@ -1,114 +1,130 @@
name: Continuous Integration
name: CI

permissions:
contents: read

on:
pull_request:
paths:
- "**.rs"
- "Cargo.toml"
- "Cargo.lock"
push:
branches:
- main

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

jobs:
fmt:
name: Source formatting check
ci:
permissions:
contents: none
name: CI
needs: [test, msrv, docs, rustfmt, clippy]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt

- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check

check:
name: Compilation check
runs-on: ubuntu-latest
- name: Done
run: exit 0
test:
name: Test
strategy:
fail-fast: true
matrix:
rust:
- stable
- beta
- nightly
- 1.41.0
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
rust: ["stable"]
continue-on-error: ${{ matrix.rust != 'stable' }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true

- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check

clippy:
name: Lint check
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- name: Build
run: cargo test --no-run --workspace --all-features
- name: Default features
run: cargo test --workspace
- name: All features
run: cargo test --workspace --all-features
- name: No-default features
run: cargo test --workspace --no-default-features
- name: Check feature combinations
run: cargo run -p ci
- name: Run crate example
run: cargo run --example default
msrv:
name: "Check MSRV: 1.41.0"
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy

- name: Run lints
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings

ci-crate:
name: CI crate check
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.41.0 # MSRV
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- name: Default features
run: cargo check --workspace --all-targets
- name: All features
run: cargo check --workspace --all-targets --all-features
- name: No-default features
run: cargo check --workspace --all-targets --no-default-features
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal

- name: Run ci crate
uses: actions-rs/cargo@v1
with:
command: run
args: -p ci

crate-example:
name: Crate example check
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- name: Check documentation
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --workspace --all-features --no-deps --document-private-items
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal

- name: Run crate example
uses: actions-rs/cargo@v1
with:
command: run
args: --example default
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
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@v1
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: clippy
runs-on: ubuntu-latest
permissions:
checks: write # to create check (actions-rs/audit-check)
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.41.0 # MSRV
profile: minimal
override: true
components: clippy
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --all-features --all-targets -- -D warnings --allow deprecated
24 changes: 24 additions & 0 deletions .github/workflows/committed.yml
@@ -0,0 +1,24 @@
# Not run as part of pre-commit checks because they don't handle sending the correct commit
# range to `committed`
name: Lint Commits
on: [pull_request]

permissions:
contents: read

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

jobs:
committed:
name: Lint Commits
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Lint Commits
uses: crate-ci/committed@master
40 changes: 0 additions & 40 deletions .github/workflows/docs.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/pre-commit.yml
@@ -0,0 +1,23 @@
name: pre-commit

permissions: {} # none

on:
pull_request:
push:
branches: [main]

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

jobs:
pre-commit:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0

0 comments on commit e572d04

Please sign in to comment.