Skip to content

New

New #24

Workflow file for this run

name: Rust CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Check if just is available
id: check-just
run: |
if command -v just &> /dev/null; then
echo "JUST_INSTALLED=true" >> $GITHUB_ENV
echo "Just is already installed"
else
echo "JUST_INSTALLED=false" >> $GITHUB_ENV
echo "Just needs to be installed"
fi
- name: Install just
if: env.JUST_INSTALLED != 'true'
run: cargo install just --locked
- name: Setup Rust targets
run: just setup-ci-minimal
- name: Run cargo check
run: just check
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Check if just is available
id: check-just
run: |
if command -v just &> /dev/null; then
echo "JUST_INSTALLED=true" >> $GITHUB_ENV
echo "Just is already installed"
else
echo "JUST_INSTALLED=false" >> $GITHUB_ENV
echo "Just needs to be installed"
fi
- name: Install just
if: env.JUST_INSTALLED != 'true'
run: cargo install just --locked
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- name: Setup Rust targets
run: just setup-ci-minimal
- name: Run tests
run: just test
style:
name: Code Style and Organization
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- name: Check if just is available
id: check-just
run: |
if command -v just &> /dev/null; then
echo "JUST_INSTALLED=true" >> $GITHUB_ENV
echo "Just is already installed"
else
echo "JUST_INSTALLED=false" >> $GITHUB_ENV
echo "Just needs to be installed"
fi
- name: Install just
if: env.JUST_INSTALLED != 'true'
run: cargo install just --locked
- name: Setup Rust targets
run: just setup-ci-minimal
- name: Check code style and organization
run: |
just check
just check-imports
env:
# Disable error documentation checks for now
CLIPPY_DENY_WARNINGS: false
udeps:
name: Unused Dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- name: Check if just is available
id: check-just
run: |
if command -v just &> /dev/null; then
echo "JUST_INSTALLED=true" >> $GITHUB_ENV
echo "Just is already installed"
else
echo "JUST_INSTALLED=false" >> $GITHUB_ENV
echo "Just needs to be installed"
fi
- name: Install just
if: env.JUST_INSTALLED != 'true'
run: cargo install just --locked
- name: Install cargo-udeps
run: cargo install cargo-udeps --locked
- name: Check for unused dependencies
run: just check-udeps
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Check if just is available
id: check-just
run: |
if command -v just &> /dev/null; then
echo "JUST_INSTALLED=true" >> $GITHUB_ENV
echo "Just is already installed"
else
echo "JUST_INSTALLED=false" >> $GITHUB_ENV
echo "Just needs to be installed"
fi
- name: Install just
if: env.JUST_INSTALLED != 'true'
run: cargo install just --locked
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- name: Setup Rust targets
run: just setup-ci-minimal
- name: Build docs
run: |
just docs-html
just check-docs
- name: Build Rust API docs
run: cargo doc --no-deps
# The comprehensive check job has been removed as it duplicates the existing
# jobs: check, test, style (with check-imports), udeps, and docs.
# Each of those individual jobs runs its own specific check,
# making this combined job redundant.
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: llvm-tools-preview
- name: Check if just is available
id: check-just
run: |
if command -v just &> /dev/null; then
echo "JUST_INSTALLED=true" >> $GITHUB_ENV
echo "Just is already installed"
else
echo "JUST_INSTALLED=false" >> $GITHUB_ENV
echo "Just needs to be installed"
fi
- name: Install just
if: env.JUST_INSTALLED != 'true'
run: cargo install just --locked
- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin --locked
- name: Setup Rust targets
run: just setup-ci-minimal
- name: Run coverage tests
run: just coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: target/coverage/lcov.info
fail_ci_if_error: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: target/coverage/junit.xml
audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}