Reusable Gitea Actions workflows for lint, test, build, and deploy: - lint-python, lint-node, lint-rust - test-python, test-node, test-rust - build-push (Docker build + push to Gitea registry) - deploy-k8s (GitOps image tag update in cluster repo) Plus example caller workflows for python-fullstack, rust-service, and node-frontend stacks. Branch refs aligned to staging per CON-570 standards.
48 lines
1.4 KiB
YAML
48 lines
1.4 KiB
YAML
# Reusable workflow: Rust testing with cargo test
|
|
# Usage: uses: wectrl-net/ci-templates/.gitea/workflows/test-rust.yaml@main
|
|
name: Test Rust (cargo)
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
rust-toolchain:
|
|
description: "Rust toolchain"
|
|
required: false
|
|
type: string
|
|
default: "stable"
|
|
working-directory:
|
|
description: "Directory containing the Rust project"
|
|
required: false
|
|
type: string
|
|
default: "."
|
|
cargo-test-args:
|
|
description: "Additional cargo test arguments"
|
|
required: false
|
|
type: string
|
|
default: "--all-features"
|
|
|
|
jobs:
|
|
test:
|
|
name: cargo test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ inputs.rust-toolchain }}
|
|
- name: Cache cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
${{ inputs.working-directory }}/target/
|
|
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: ${{ runner.os }}-cargo-test-
|
|
- name: Run tests
|
|
run: cargo test ${{ inputs.cargo-test-args }}
|
|
working-directory: ${{ inputs.working-directory }}
|