Skip to content

clippy + fmt

clippy + fmt #118

name: Static Analysis
on:
pull_request:
branches:
- '!release-plz-*'
push:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
clippy:
runs-on: ubuntu-latest
steps:
- name: Dependencies
run: sudo apt-get update && sudo apt-get install g++ pkg-config libx11-dev libasound2-dev libudev-dev clang lld
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-clippy-${{ hashFiles('**/Cargo.toml') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true
- name: CI job
run: "cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::type_complexity -W clippy::doc_markdown"
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-fmt-${{ hashFiles('**/Cargo.toml') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
override: true
- name: CI job
run: cargo fmt --all -- --check
check-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-docs-${{ hashFiles('**/Cargo.toml') }}
- name: Ensure docs compile
run: cargo doc --no-deps -p dexterous_developer
env:
RUSTDOCFLAGS: -Dwarnings
mdbook:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: "latest"
- run: mdbook build
check-markdown-links:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: check dead links
continue-on-error: true
id: run1
uses: gaurav-nelson/github-action-markdown-link-check@9710f0fec812ce0a3b98bef4c9d842fc1f39d976
with:
use-quiet-mode: "yes"
use-verbose-mode: "yes"
config-file: ".github/linters/markdown-link-check.json"
- name: Sleep for 30 seconds
if: steps.run1.outcome=='failure'
run: sleep 30s
shell: bash
- name: check dead links (retry)
continue-on-error: true
id: run2
if: steps.run1.outcome=='failure'
uses: gaurav-nelson/github-action-markdown-link-check@9710f0fec812ce0a3b98bef4c9d842fc1f39d976
with:
use-quiet-mode: "yes"
use-verbose-mode: "yes"
config-file: ".github/linters/markdown-link-check.json"
- name: Sleep for 30 seconds
if: steps.run2.outcome=='failure'
run: sleep 30s
shell: bash
- name: check dead links (retry 2)
continue-on-error: true
id: run3
if: steps.run2.outcome=='failure'
uses: gaurav-nelson/github-action-markdown-link-check@9710f0fec812ce0a3b98bef4c9d842fc1f39d976
with:
use-quiet-mode: "yes"
use-verbose-mode: "yes"
config-file: ".github/linters/markdown-link-check.json"
- name: set the status
if: always()
run: |
if ${{ steps.run1.outcome=='success' || steps.run2.outcome=='success' || steps.run3.outcome=='success' }}; then
echo success
else
exit 1
fi
markdownlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
- run: |
rm ./CHANGELOG.md
rm ./docs/src/SUMMARY.md
- name: Run Markdown Lint
uses: docker://ghcr.io/github/super-linter:slim-v4
env:
VALIDATE_ALL_CODEBASE: false
VALIDATE_MARKDOWN: true
DEFAULT_BRANCH: main
FILTER_REGEX_EXCLUDE: "(CHANGELOG.md | docs/src/SUMMARY.md)"