ci #146
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 | |
permissions: | |
contents: read | |
on: | |
push: | |
pull_request: | |
merge_group: | |
schedule: | |
- cron: '0 18 * * *' | |
jobs: | |
rustfmt: | |
name: Format | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Install rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: Check formatting | |
run: cargo fmt --all -- --check | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Install rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- run: cargo clippy --all-features --all-targets | |
deny: | |
name: Cargo Deny | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Install rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install cargo deny | |
uses: taiki-e/install-action@cargo-deny | |
- run: cargo deny check | |
# Verify that documentation builds. | |
rustdoc: | |
name: Check for documentation errors | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
rust_channel: | |
- stable | |
- beta | |
- nightly | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Install rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust_channel }} | |
- name: cargo doc (all features) | |
run: cargo doc --all-features | |
env: | |
RUSTDOCFLAGS: ${{ matrix.rust_channel == 'nightly' && '-Dwarnings --cfg=docsrs' || '-Dwarnings' }} | |
package: | |
name: Cargo Package | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Install rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- run: cargo package | |
test: | |
name: Build+test | |
runs-on: ${{ matrix.host_os }} | |
strategy: | |
matrix: | |
features: | |
- # Default | |
- --features=alloc | |
- --all-features | |
- --no-default-features | |
mode: | |
- # debug | |
- --release | |
rust_channel: | |
- stable | |
- nightly | |
- beta | |
exclude: | |
- features: # Default | |
- features: --features=alloc | |
- features: --no-default-features | |
- features: --all-features | |
mode: --release | |
- features: --all-features | |
mode: # debug | |
rust_channel: nightly | |
- features: --all-features | |
mode: # debug | |
rust_channel: beta | |
include: | |
- features: # Default | |
mode: # debug | |
rust_channel: stable | |
host_os: ubuntu-20.04 | |
- features: --features=alloc | |
mode: # debug | |
rust_channel: stable | |
host_os: ubuntu-20.04 | |
- features: --no-default-features | |
mode: # debug | |
rust_channel: stable | |
host_os: ubuntu-20.04 | |
- features: --all-features | |
mode: --release | |
rust_channel: stable | |
host_os: ubuntu-20.04 | |
- features: --all-features | |
mode: # debug | |
rust_channel: nightly | |
host_os: ubuntu-20.04 | |
- features: --all-features | |
mode: # debug | |
rust_channel: beta | |
host_os: ubuntu-20.04 | |
- features: --all-features | |
mode: # debug | |
rust_channel: stable | |
host_os: macos-latest | |
- features: --all-features | |
mode: # debug | |
rust_channel: stable | |
host_os: windows-latest | |
- features: --all-features | |
mode: # debug | |
rust_channel: stable | |
host_os: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Install rust ${{ matrix.rust_channel }} toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust_channel }} | |
- name: cargo test (${{ matrix.mode }}, ${{ matrix.features }}) | |
run: cargo test -vv ${{ matrix.features }} ${{ matrix.mode }} | |
env: | |
RUSTFLAGS: "-D warnings" | |
msrv: | |
name: MSRV | |
runs-on: ubuntu-20.04 | |
env: | |
codecov_upload_token: ${{ secrets.CODECOV_UPLOAD_TOKEN }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: "1.61" | |
- run: cargo check --lib --all-features | |
cross: | |
name: Check cross compilation targets | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Install rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install cross | |
uses: taiki-e/install-action@cross | |
- run: cross build --target i686-unknown-linux-gnu | |
semver: | |
name: Check semver compatibility | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Check semver | |
uses: obi1kenobi/cargo-semver-checks-action@v2 | |
coverage: | |
name: Measure coverage | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Install rust toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: llvm-tools | |
- name: Measure coverage | |
run: cargo llvm-cov --all-features --lcov --output-path ./lcov.info | |
- name: Report to codecov.io | |
if: ${{ env.codecov_upload_token }} | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_UPLOAD_TOKEN }} | |
files: ./lcov.info | |
fail_ci_if_error: true | |
verbose: true |