-
Notifications
You must be signed in to change notification settings - Fork 22
55 lines (46 loc) · 1.76 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Lint crates
on:
workflow_dispatch:
pull_request: # Workflow can be triggered by either a manual dispatch or a pull request
jobs:
Lint-Workspace:
name: Lint Workspace
runs-on: ubuntu-20.04
steps:
- run: echo "Starting Lint-Workspace"
lint:
name: Lint
needs: Lint-Workspace
# This job runs on an Ubuntu 20.04 runner
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3 # Checkout the code from the repository
# https://github.com/Swatinem/rust-cache
- name: Cache Rust and its Packages
# Cache Rust dependencies using Swatinem's rust-cache action to speed up builds
uses: Swatinem/rust-cache@v2
with:
prefix-key: "lint" # Using a locally shared cache key
shared-key: "trident-rust-cache" # Use a shared cache key across multiple jobs to reuse cache
cache-directories: "~/.rustup" # Additional non workspace directories to be cached, separated by newlines.
- name: Setup Rust Environment
# Set up the Rust environment (e.g., install nightly, Rust components)
uses: ./.github/actions/setup-rust/
- name: Cargo build
# Build the Trident workspace
run: cargo build --release --all-features
- name: Cargo fmt
# Run cargo fmt to check if the code is formatted correctly
run: cargo fmt --check
- name: Cargo clippy
# Run Clippy to check for code linting issues and fail on warnings
run: cargo clippy -- -D warnings
- name: Cargo test
# Run tests to ensure the project works as expected
run: cargo test
checks:
name: Lint-Workspace (Checks)
needs: lint
runs-on: ubuntu-20.04
steps:
- run: echo "Lint Workspace completed successfully"