name: Rust CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
build-test:
name: Build and Test
runs-on: ubuntu-latest
strategy:
matrix:
project: [anya-core, anya-enterprise, attachments]
steps:
- uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Build
run: cargo build --verbose --workspace --package ${{ matrix.project }}
- name: Run Tests
run: cargo test --verbose --workspace --package ${{ matrix.project }}
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Check Formatting
run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Run Clippy
run: cargo clippy --all-features --workspace -- -D warnings
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Install Tarpaulin
run: cargo install cargo-tarpaulin
- name: Run Tarpaulin
run: cargo tarpaulin --ignore-tests --workspace --verbose
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Build Project
run: cargo build --verbose --workspace
security:
name: Security Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Rust Security Tools
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Run Vulnerability Checks
run: cargo audit
- name: Run Deny License Check
run: cargo deny check licenses
- name: Run Deny Policy Check
run: cargo deny check
- name: Analyze Code for Security
run: echo "Running additional security analysis steps here..."
finalize:
name: Finalize CI
needs: [build-test, fmt, clippy, coverage, build, security]
runs-on: ubuntu-latest
steps:
- name: All checks passed
run: echo "CI pipeline completed successfully."
data-workflow:
name: Data Workflow
runs-on: ubuntu-latest
needs: [build-test, fmt, clippy, coverage, build, security]
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: ["rustfmt", "clippy"]
target: x86_64-unknown-linux-gnu
override: true
- name: Cache Dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Process Data
run: |
cargo run --bin data-processor
cargo test --test data_integration
- name: Validate Results
run: cargo run --bin validate-data
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: processed-data
path: data/processed
retention-days: 5