Style #387
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
# Style-related actions, not related to availability. | |
name: Style | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: '0 0 * * 0' # Sunday | |
jobs: | |
style: | |
name: Style | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
runs-on: ubuntu-latest | |
needs: | |
- fmt | |
- check-readme | |
- docs | |
- clippy | |
steps: | |
- run: exit 0 | |
fmt: | |
name: Format | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust | |
run: rustup update stable | |
- name: Install rustfmt | |
run: rustup component add rustfmt | |
- name: "rustfmt --check" | |
run: | | |
if ! rustfmt --check --edition 2021 $(find . -name '*.rs' -print); then | |
printf "Please run \`rustfmt --edition 2021 \$(find . -name '*.rs' -print)\` to fix rustfmt errors.\nSee CONTRIBUTING.md for more details.\n" >&2 | |
exit 1 | |
fi | |
docs: | |
name: Docs | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
- run: cargo doc --lib --no-deps --all-features --document-private-items --workspace --exclude sentinel-envoy-module --exclude ebpf-probes --exclude ebpf-userspace | |
check-readme: | |
name: Check README # for correct README file on crates.io | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Verify that both READMEs are identical | |
run: diff README.md sentinel-core/README.md | |
- name: Verify that Sentinel version is up to date in README | |
working-directory: sentinel-core | |
run: grep -q "$(sed '/^version = /!d' Cargo.toml | head -n1)" README.md | |
clippy: | |
name: Clippy | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust | |
run: rustup update stable && rustup default stable | |
- name: Install clippy | |
run: rustup component add clippy | |
- name: "clippy --all" | |
run: cargo clippy --all-targets --workspace --exclude sentinel-envoy-module --exclude ebpf-probes --exclude ebpf-userspace | |