Practice what you preach
This commit is contained in:
parent
4859c12882
commit
afa25312c9
11 changed files with 264 additions and 186 deletions
107
github/workflows/check.yml
Normal file
107
github/workflows/check.yml
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
name: check
|
||||
jobs:
|
||||
fmt:
|
||||
runs-on: ubuntu-latest
|
||||
name: stable / fmt
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install stable
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
components: rustfmt
|
||||
- name: cargo fmt --check
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: fmt
|
||||
args: --check
|
||||
clippy:
|
||||
runs-on: ubuntu-latest
|
||||
name: ${{ matrix.toolchain }} / clippy
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
toolchain: [stable, beta]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install ${{ matrix.toolchain }}
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
default: true
|
||||
components: clippy
|
||||
- name: cargo clippy
|
||||
uses: actions-rs/clippy-check@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
doc:
|
||||
runs-on: ubuntu-latest
|
||||
name: nightly / doc
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly
|
||||
default: true
|
||||
- name: cargo doc
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: doc
|
||||
args: --no-deps --all-features
|
||||
env:
|
||||
RUSTDOCFLAGS: --cfg docsrs
|
||||
hack:
|
||||
runs-on: ubuntu-latest
|
||||
name: ubuntu / stable / features
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install stable
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
- name: cargo install cargo-hack
|
||||
uses: taiki-e/install-action@cargo-hack
|
||||
- name: cargo hack
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: hack
|
||||
args: --feature-powerset check --all-targets
|
||||
msrv:
|
||||
runs-on: ubuntu-latest
|
||||
# we use a matrix here just because env can't be used in job names
|
||||
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
|
||||
strategy:
|
||||
matrix:
|
||||
msrv: [1.56.1] # 2021 edition requires 1.56
|
||||
name: ubuntu / ${{ matrix.msrv }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install ${{ matrix.toolchain }}
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: ${{ matrix.msrv }}
|
||||
default: true
|
||||
- name: cargo +${{ matrix.msrv }} check
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
name: coverage
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
components: llvm-tools-preview
|
||||
- name: Install cargo-llvm-cov
|
||||
uses: taiki-e/install-action@cargo-llvm-cov
|
||||
- name: Generate code coverage
|
||||
run: cargo llvm-cov --all-features --lcov --output-path lcov.info
|
||||
- name: Upload to codecov.io
|
||||
uses: codecov/codecov-action@v2
|
||||
with:
|
||||
fail_ci_if_error: true
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
name: cargo hack
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install cargo-hack
|
||||
uses: taiki-e/install-action@cargo-hack
|
||||
- name: cargo hack
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: hack
|
||||
args: --feature-powerset check --all-targets
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
# TODO: https://twitter.com/jonhoo/status/1571290371124260865
|
||||
# Maybe also: https://twitter.com/alcuadrado/status/1571291687837732873
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
name: With dependencies at minimal versions
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: cargo update -Zminimal-versions
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: update
|
||||
toolchain: nightly
|
||||
args: -Zminimal-versions
|
||||
- name: cargo test
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --all-features --all-targets
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
name: Minimum Supported Rust Version
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: 1.56.1 # 2021 edition requires 1.56
|
||||
override: true
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: cargo +1.56.1 check
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
name: os check
|
||||
jobs:
|
||||
os-check:
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, windows-latest]
|
||||
steps:
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: cargo test
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --all-features --all-targets
|
||||
|
|
@ -1 +0,0 @@
|
|||
# TODO: https://twitter.com/mycoliza/status/1571295690063753218
|
||||
61
github/workflows/scheduled.yml
Normal file
61
github/workflows/scheduled.yml
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '7 7 * * *'
|
||||
name: cargo test (rolling)
|
||||
jobs:
|
||||
# https://twitter.com/mycoliza/status/1571295690063753218
|
||||
nightly:
|
||||
runs-on: ubuntu-latest
|
||||
name: ubuntu / nightly
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly
|
||||
default: true
|
||||
- name: cargo generate-lockfile
|
||||
if: hashFiles('Cargo.lock') == ''
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: generate-lockfile
|
||||
- name: cargo test --locked
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --locked --all-features --all-targets
|
||||
# https://twitter.com/alcuadrado/status/1571291687837732873
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
name: ubuntu / stable / updated
|
||||
# There's no point running this if no Cargo.lock was checked in in the
|
||||
# first place, since we'd just redo what happened in the regular test job.
|
||||
# Unfortunately, hashFiles only works in if on steps, so we reepeat it.
|
||||
# if: hashFiles('Cargo.lock') != ''
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install stable
|
||||
if: hashFiles('Cargo.lock') != ''
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
- name: cargo update
|
||||
if: hashFiles('Cargo.lock') != ''
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: update
|
||||
- name: cargo test
|
||||
if: hashFiles('Cargo.lock') != ''
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --locked --all-features --all-targets
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
name: lint
|
||||
jobs:
|
||||
style:
|
||||
runs-on: ubuntu-latest
|
||||
name: ${{ matrix.toolchain }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
toolchain: [stable, beta]
|
||||
steps:
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
components: rustfmt, clippy
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: cargo fmt --check
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: fmt
|
||||
args: --check
|
||||
- name: cargo clippy
|
||||
uses: actions-rs/clippy-check@v1
|
||||
if: always()
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
doc:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly
|
||||
- uses: actions/checkout@v3
|
||||
- name: cargo doc
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
toolchain: nightly
|
||||
command: doc
|
||||
args: --no-deps --all-features
|
||||
env:
|
||||
RUSTDOCFLAGS: --cfg docsrs
|
||||
|
|
@ -2,24 +2,112 @@ on:
|
|||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
name: cargo test
|
||||
name: test
|
||||
jobs:
|
||||
test:
|
||||
required:
|
||||
runs-on: ubuntu-latest
|
||||
name: ubuntu / ${{ matrix.toolchain }}
|
||||
strategy:
|
||||
matrix:
|
||||
toolchain: [stable, beta, nightly]
|
||||
toolchain: [stable, beta]
|
||||
steps:
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install ${{ matrix.toolchain }}
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
default: true
|
||||
- name: cargo generate-lockfile
|
||||
if: hashFiles('Cargo.lock') == ''
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: generate-lockfile
|
||||
# https://twitter.com/jonhoo/status/1571290371124260865
|
||||
- name: cargo test --locked
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --locked --all-features --all-targets
|
||||
minimal:
|
||||
runs-on: ubuntu-latest
|
||||
name: ubuntu / stable / minimal-versions
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install stable
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
- name: Install nightly for -Zminimal-versions
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly
|
||||
- name: cargo update -Zminimal-versions
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: update
|
||||
toolchain: nightly
|
||||
args: -Zminimal-versions
|
||||
- name: cargo test
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --all-features --all-targets
|
||||
args: --locked --all-features --all-targets
|
||||
os-check:
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: ${{ matrix.os }} / stable
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, windows-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install stable
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
- name: cargo generate-lockfile
|
||||
if: hashFiles('Cargo.lock') == ''
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: generate-lockfile
|
||||
- name: cargo test
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --locked --all-features --all-targets
|
||||
coverage:
|
||||
runs-on: ubuntu-latest
|
||||
name: ubuntu / stable / coverage
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install stable
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
components: llvm-tools-preview
|
||||
- name: cargo install cargo-llvm-cov
|
||||
uses: taiki-e/install-action@cargo-llvm-cov
|
||||
- name: cargo generate-lockfile
|
||||
if: hashFiles('Cargo.lock') == ''
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: generate-lockfile
|
||||
- name: cargo llvm-cov
|
||||
run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
|
||||
- name: Upload to codecov.io
|
||||
uses: codecov/codecov-action@v2
|
||||
with:
|
||||
fail_ci_if_error: true
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue