Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions .github/workflows/rust-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: "Rust CI/CD Pipeline"

on:
push:
pull_request:
types: [opened, reopened]

env:
RUST_BACKTRACE: 1

jobs:
format:
name: "[RUST] Format Check"
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v7

- name: "Install Rust toolchain"
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: "Check formatting"
run: cargo fmt --all -- --check

lint:
name: "[RUST] Lint Check"
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v7

- name: "Install Rust toolchain"
uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- name: "Cache cargo registry"
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: "Run clippy"
run: cargo clippy --all-targets --all-features

build:
name: "[RUST] Build"
needs: [lint, format]
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v7

- name: "Install Rust toolchain"
uses: dtolnay/rust-toolchain@stable

- name: "Cache cargo registry"
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: "Build workspace"
run: cargo build --verbose --all-features

test:
name: "[RUST] Test"
needs: [build]
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v7

- name: "Install Rust toolchain"
uses: dtolnay/rust-toolchain@stable

- name: "Cache cargo registry"
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-report-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: "Test workspace"
run: cargo test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@
##
################
config/sagittarius.yml
gateway/target
target
Loading
Loading