Skip to content

ci: Fix PlanUML integration #40

ci: Fix PlanUML integration

ci: Fix PlanUML integration #40

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 (${{ matrix.os }})
strategy:
fail-fast: false # Don't stop all jobs if one fails
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: windows-latest
continue-on-error: true # Allow Windows to fail without stopping the workflow
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.continue-on-error || false }}
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 (Unix)
if: runner.os != 'Windows'
id: check-just-unix
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: Check if just is available (Windows)
if: runner.os == 'Windows'
id: check-just-windows
shell: powershell
run: |
if (Get-Command just -ErrorAction SilentlyContinue) {
echo "JUST_INSTALLED=true" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "Just is already installed"
} else {
echo "JUST_INSTALLED=false" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "Just needs to be installed"
}
- 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 (${{ matrix.os }})
strategy:
fail-fast: false # Don't stop all jobs if one fails
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: windows-latest
continue-on-error: true # Allow Windows to fail without stopping the workflow
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.continue-on-error || false }}
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 (Unix)
if: runner.os != 'Windows'
id: check-just-unix
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: Check if just is available (Windows)
if: runner.os == 'Windows'
id: check-just-windows
shell: powershell
run: |
if (Get-Command just -ErrorAction SilentlyContinue) {
echo "JUST_INSTALLED=true" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "Just is already installed"
} else {
echo "JUST_INSTALLED=false" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "Just needs to be installed"
}
- 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 (${{ matrix.os }})
strategy:
fail-fast: false # Don't stop all jobs if one fails
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: windows-latest
continue-on-error: true # Allow Windows to fail without stopping the workflow
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.continue-on-error || false }}
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 (Unix)
if: runner.os != 'Windows'
id: check-just-unix
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: Check if just is available (Windows)
if: runner.os == 'Windows'
id: check-just-windows
shell: powershell
run: |
if (Get-Command just -ErrorAction SilentlyContinue) {
echo "JUST_INSTALLED=true" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "Just is already installed"
} else {
echo "JUST_INSTALLED=false" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "Just needs to be installed"
}
- 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
run: just check
env:
# Disable error documentation checks for now
CLIPPY_DENY_WARNINGS: false
- name: Check imports (Unix only)
if: runner.os != 'Windows'
run: just check-imports
udeps:
name: Unused Dependencies (${{ matrix.os }})
strategy:
fail-fast: false # Don't stop all jobs if one fails
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: windows-latest
continue-on-error: true # Allow Windows to fail without stopping the workflow
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.continue-on-error || false }}
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 (Unix)
if: runner.os != 'Windows'
id: check-just-unix
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: Check if just is available (Windows)
if: runner.os == 'Windows'
id: check-just-windows
shell: powershell
run: |
if (Get-Command just -ErrorAction SilentlyContinue) {
echo "JUST_INSTALLED=true" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "Just is already installed"
} else {
echo "JUST_INSTALLED=false" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "Just needs to be installed"
}
- name: Install just
if: env.JUST_INSTALLED != 'true'
run: cargo install just --locked
- name: Check for unused dependencies
run: just check-udeps
docs:
name: Documentation (${{ matrix.os }})
strategy:
fail-fast: false # Don't stop all jobs if one fails
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: windows-latest
continue-on-error: true # Allow Windows to fail without stopping the workflow
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.continue-on-error || false }}
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 (Unix)
if: runner.os != 'Windows'
id: check-just-unix
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: Check if just is available (Windows)
if: runner.os == 'Windows'
id: check-just-windows
shell: powershell
run: |
if (Get-Command just -ErrorAction SilentlyContinue) {
echo "JUST_INSTALLED=true" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "Just is already installed"
} else {
echo "JUST_INSTALLED=false" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "Just needs to be installed"
}
- 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
# Install Java for PlantUML
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
# Install PlantUML and other dependencies
- name: Setup Rust targets and dependencies
run: |
just setup-ci-minimal
# Install PlantUML on Linux
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update
sudo apt-get install -y plantuml
# Install PlantUML on macOS
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install plantuml
# Install PlantUML on Windows
elif [ "$RUNNER_OS" == "Windows" ]; then
# Download and extract PlantUML JAR
mkdir -p $HOME/plantuml
curl -L https://github.com/plantuml/plantuml/releases/download/v1.2023.13/plantuml-1.2023.13.jar -o $HOME/plantuml/plantuml.jar
echo "#!/bin/sh" > $HOME/plantuml/plantuml
echo "java -jar $HOME/plantuml/plantuml.jar \"\$@\"" >> $HOME/plantuml/plantuml
chmod +x $HOME/plantuml/plantuml
echo "$HOME/plantuml" >> $GITHUB_PATH
fi
shell: bash
- name: Build docs with diagrams
run: |
just docs-with-diagrams
just check-docs
- name: Build Rust API docs
run: cargo doc --no-deps
# Coverage job is still Linux-only as tarpaulin only supports Linux
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 (${{ matrix.os }})
strategy:
fail-fast: false # Don't stop all jobs if one fails
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: windows-latest
continue-on-error: true # Allow Windows to fail without stopping the workflow
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.continue-on-error || false }}
steps:
- uses: actions/checkout@v4
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}