Enable clippy pedantic, adjust CI to not fail tests on warnings #30
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
--- | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
name: Rust Validation | |
env: | |
RUSTDOCFLAGS: -D warnings | |
RUSTFLAGS: -C debuginfo=1 | |
RUST_LOG: debug | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
jobs: | |
check: | |
name: "Check (cargo clippy)" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/[email protected] | |
with: | |
components: clippy | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo clippy --all-features --all-targets -- -D warnings | |
env: | |
TEST_TANG_URL: '' # just for validation | |
- run: cargo clippy --no-default-features --all-targets -- -D warnings | |
test: | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-msvc] | |
name: "Test on ${{ matrix.os }} (cargo test)" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/[email protected] | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo test | |
integration: | |
name: "Integration testing (docker)" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Start docker | |
# the port used is "tang" in ascii, easy to remember | |
run: > | |
docker run --rm -d | |
-v $(pwd)/tang-db:/db | |
-e ENABLE_IPv6=1 | |
-p 11697:8080 | |
--name tang-backend | |
padhihomelab/tang | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- name: Run integration testing | |
env: | |
TEST_TANG_URL: localhost:11697 | |
# Run only integration tests with `--test '*'` | |
run: cargo test --test '*' --features _backend | |
- name: Print docker logs | |
if: always() | |
run: | | |
docker logs tang-backend | |
# If any critical / debug options were printed, error out | |
docker logs tang-backend 2>&1 | grep -iE '\[(Critical|Error)\]' || exit 0 && exit 1; | |
docker stop tang-backend | |
fmt: | |
name: "Format (cargo fmt)" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo fmt --all -- --check | |
doc: | |
name: "Docs (cargo doc)" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: dtolnay/rust-toolchain@nightly | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo doc | |
outdated: | |
name: Outdated | |
runs-on: ubuntu-latest | |
timeout-minutes: 45 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/install@cargo-outdated | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo outdated --workspace --exit-code 1 | |
security_audit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: rustsec/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} |