chore: Require Docs in Private Items #1774
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: Rust | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
schedule: | |
- cron: "28 13 * * *" | |
env: | |
CARGO_TERM_COLOR: always | |
BRANCH: ${{github.head_ref || github.ref_name}} | |
jobs: | |
test: | |
name: Test | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{matrix.os}} | |
env: | |
RUSTFLAGS: -A warnings | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout Repository | |
- name: Setup Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
components: clippy | |
cache: false | |
- name: Rust Cache | |
uses: swatinem/rust-cache@v2 | |
with: | |
key: ${{matrix.os}} | |
- name: Test | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --all | |
build: | |
name: Build | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{matrix.os}} | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout Repository | |
- name: Setup Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Rust Cache | |
uses: swatinem/rust-cache@v2 | |
with: | |
key: ${{matrix.os}} | |
- name: Build Release | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release | |
format: | |
name: Format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout Repository | |
- name: Setup Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Rustfmt Check | |
uses: actions-rust-lang/rustfmt@v1 | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
security-events: write | |
actions: read | |
env: | |
RUSTFLAGS: -D warnings | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
components: clippy | |
- name: Install Clippy-Sarif | |
uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: clippy-sarif | |
- name: Install Sarif-fmt | |
uses: baptiste0928/cargo-install@v3 | |
with: | |
crate: sarif-fmt | |
- name: Run rust-clippy | |
run: cargo clippy --all --no-deps --all-features --message-format=json | sort | uniq | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt | |
continue-on-error: true | |
- name: Upload analysis results to GitHub | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: rust-clippy-results.sarif | |
wait-for-processing: true | |
cargo-lock: | |
name: Cargo Lock | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --all | |
- name: Check if Cargo.lock changed | |
id: verify-changed-files | |
uses: tj-actions/verify-changed-files@v19 | |
with: | |
files: | | |
Cargo.lock | |
- name: Fail if Cargo.lock changed | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
run: exit 1 | |
data-serde: | |
name: Data Serialization | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: run | |
args: -p data | |
- name: Check if Data Changed | |
id: verify-changed-files | |
uses: tj-actions/verify-changed-files@v19 | |
with: | |
files: | | |
data/data/**/* | |
- name: Fail if Cargo.lock changed | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
run: exit 1 | |
finish: | |
name: Finish Checks | |
needs: [clippy, test, build, format, cargo-lock, data-serde ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Finish Checks | |
run: echo "Checks Finnished" |