name: Rust
on:
push:
tags: [ "v*.*.*" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Run unit tests
run: cargo test --lib
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy, rustfmt
- name: Check formatting
run: cargo fmt --check
- name: Run clippy
run: cargo clippy -- -D warnings
integration-tests:
runs-on: ubuntu-latest
needs: [unit-tests, lint]
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install Kind
uses: helm/kind-action@v1
with:
cluster_name: test-cluster
wait: 120s
- name: Run integration tests (excludes E2E)
run: cargo test --test '*' -- --ignored
env:
KUBECONFIG: /home/runner/.kube/config
e2e-tests:
runs-on: ubuntu-latest
needs: [unit-tests, lint]
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install Kind
uses: helm/kind-action@v1
with:
cluster_name: e2e-cluster
wait: 120s
- name: Run E2E tests (requires Docker and is slow)
run: cargo test --test '*' -- --ignored
env:
KUBECONFIG: /home/runner/.kube/config
build:
runs-on: ubuntu-latest
needs: [unit-tests, lint, integration-tests, e2e-tests]
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Build Release
run: cargo build --release