name: Rust
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache cargo directories
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo target dir
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Security audit
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check code format
run: make fmt VERBOSE=1 FMTFLAGS="-- --check"
- name: Run cargo clippy
run: RUSTFLAGS="-Dwarnings" make clippy VERBOSE=1 CLIPPYFLAGS="-- -D warnings"
- name: Annotate commit with clippy warnings
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
build-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache cargo directories
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo target dir
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Build (debug)
run: make build VERBOSE=1
- name: Test blockz (feature = singleton)
run: make test VERBOSE=1 PKG=blockz TESTFLAGS="--no-default-features --features=singleton"
- name: Test blockz (feature = configuration)
run: make test VERBOSE=1 PKG=blockz TESTFLAGS="--no-default-features --features=configuration"
- name: Test blockz (feature = env_configuration)
run: make test VERBOSE=1 PKG=blockz TESTFLAGS="--no-default-features --features=env_configuration"