Skip to content

Commit dfd67a6

Browse files
committed
Add CIs
1 parent 5ddf729 commit dfd67a6

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

.github/workflows/lint.yml

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

0 commit comments

Comments
 (0)