ci #2299
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
# trigger on pushes, PRs and every day at 03:00 GMT, 05:00 CEST | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: "0 3 * * *" | |
jobs: | |
# run tests on linux, macos and windows | |
test: | |
name: Test | |
env: | |
RUST_BACKTRACE: full | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
build: | |
[ | |
linux-msrv-release, | |
linux-msrv-debug, | |
linux-nightly-release, | |
linux-nightly-debug, | |
linux-stable-release, | |
linux-stable-debug, | |
linux-beta-release, | |
linux-beta-debug, | |
macos-nightly-release, | |
macos-nightly-debug, | |
windows-nightly-release, | |
windows-nightly-debug, | |
] | |
include: | |
- build: linux-msrv-release | |
os: ubuntu-latest | |
toolchain: 1.62 | |
release: true | |
- build: linux-msrv-debug | |
os: ubuntu-latest | |
toolchain: 1.62 | |
debug: true | |
- build: linux-nightly-release | |
os: ubuntu-latest | |
toolchain: nightly | |
release: true | |
- build: linux-nightly-debug | |
os: ubuntu-latest | |
toolchain: nightly | |
debug: true | |
- build: macos-nightly-release | |
os: macos-latest | |
toolchain: nightly | |
mode: release | |
release: true | |
- build: macos-nightly-debug | |
os: macos-latest | |
toolchain: nightly | |
debug: true | |
- build: windows-nightly-release | |
os: windows-latest | |
toolchain: nightly | |
release: true | |
- build: windows-nightly-debug | |
os: windows-latest | |
toolchain: nightly | |
debug: true | |
- build: linux-beta-release | |
os: ubuntu-latest | |
toolchain: beta | |
release: true | |
- build: linux-beta-debug | |
os: ubuntu-latest | |
toolchain: beta | |
debug: true | |
- build: linux-stable-release | |
os: ubuntu-latest | |
toolchain: stable | |
release: true | |
- build: linux-stable-debug | |
os: ubuntu-latest | |
toolchain: stable | |
debug: true | |
steps: | |
- uses: actions/checkout@v1 | |
- name: install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
override: true | |
profile: minimal | |
# build | |
- name: cargo build | |
run: cargo build --verbose --all | |
if: matrix.debug | |
- name: cargo build --release --all | |
run: cargo build --verbose --release | |
if: matrix.release | |
# run tests | |
- name: test | |
run: cargo test --verbose --all -- --nocapture | |
if: matrix.debug | |
- name: test --release | |
run: cargo test --verbose --release --all -- --nocapture | |
if: matrix.release | |
# run cargo cache | |
- name: cargo run | |
run: cargo run | |
if: matrix.debug | |
- name: cargo run --release | |
run: cargo run --release | |
if: matrix.release | |
# install cargo cache | |
- name: install cargo-cache | |
run: cargo install --force --path . --locked | |
if: matrix.release | |
- name: install cargo-cache --debug | |
run: cargo install --force --path . --debug --locked | |
if: matrix.debug | |
# in release mode, run the benchmarks, otherwise just test them | |
- name: test benchmarks debug | |
if: matrix.debug && matrix.toolchain == 'nightly' | |
run: cargo test --features bench | |
- name: test benchmarks release | |
if: matrix.release && matrix.toolchain == 'nightly' | |
run: cargo test --features bench --release | |
- name: run cargo bench | |
if: matrix.release && matrix.toolchain == 'nightly' | |
run: cargo bench | |
- name: actually run benchmarks | |
if: matrix.release && matrix.toolchain == 'nightly' | |
run: cargo bench --features bench | |
# run cargo cache | |
- name: run "cargo-cache" | |
run: cargo-cache | |
- name: run "cargo cache" | |
run: cargo cache | |
- name: run "cargo cache --help" | |
run: cargo cache --help | |
- name: run "cargo cache --top-cache-items 20" | |
run: cargo cache --top-cache-items 20 | |
- name: run "cargo cache --gc --dry-run" | |
run: cargo cache --gc --dry-run | |
- name: run "cargo cache --gc" | |
run: cargo cache --gc | |
- name: run "cargo cache --info" | |
run: cargo cache --info | |
- name: run "cargo cache --list-dirs" | |
run: cargo cache --list-dirs | |
- name: run "cargo cache verify" | |
run: cargo cache verify | |
- name: run "cargo cache --keep-duplicate-crates 10 --dry-run" | |
run: cargo cache --keep-duplicate-crates 10 --dry-run | |
- name: run "cargo cache --keep-duplicate-crates 1 --dry-run" | |
run: cargo cache --keep-duplicate-crates 1 --dry-run | |
- name: run "cargo cache --keep-duplicate-crates 0 --dry-run" | |
run: cargo cache --keep-duplicate-crates 0 --dry-run | |
# check ci-autoclean feature | |
- name: install with ci_autoclean feature | |
run: cargo install --force --git https://github.com/matthiaskrgr/cargo-cache --no-default-features --features ci-autoclean cargo-cache | |
- name: run ci_autoclean | |
run: cargo-cache | |
# check for vulns in deps with cargo-audit | |
cargo-audit: | |
runs-on: ubuntu-latest | |
env: | |
RUSTC_BACKTRACE: full | |
steps: | |
- uses: actions/checkout@v1 | |
- name: install nightly toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
profile: minimal | |
- name: install cargo-audit | |
run: cargo install cargo-audit --debug | |
- name: run cargo-audit | |
# as far as I see, cargo-cache is not using affected code in critical places | |
# and since there is no new chrono version out yet, there is not a lot I can do | |
run: cargo audit --ignore RUSTSEC-2020-0071 --ignore RUSTSEC-2020-0159 | |
# check code with clippy | |
run_clippy: | |
runs-on: ubuntu-latest | |
env: | |
RUSTC_BACKTRACE: full | |
steps: | |
- uses: actions/checkout@v1 | |
# we don't need rustfmt or anything here | |
- name: install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
components: clippy | |
- name: clippy version | |
run: cargo clippy --version | |
- name: clippy all targets all features | |
run: cargo clippy --all-targets --all-features -- -Dwarnings | |
- name: clippy ci_autoclean | |
run: cargo clippy --no-default-features --features ci-autoclean -- -Dwarnings | |
- name: clippy default features | |
run: cargo clippy --all-targets --features default -- -Dwarnings | |
# make sure code formatting is consistent | |
rustfmt: | |
runs-on: ubuntu-latest | |
env: | |
RUSTC_BACKTRACE: full | |
steps: | |
- uses: actions/checkout@v1 | |
- name: install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
components: rustfmt | |
- name: rustfmt check formatting | |
run: cargo fmt --all -- --check |