name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libglib2.0-dev libcairo2-dev
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Run unit tests
run: cargo test --lib --verbose
env:
RUSTFLAGS: -D warnings
- name: Run integration tests
run: cargo test --test integration_tests --verbose
env:
RUSTFLAGS: -D warnings
- name: Run property-based tests
run: cargo test --test property_tests --verbose
env:
RUSTFLAGS: -D warnings
- name: Run doc tests
run: cargo test --doc --verbose
env:
RUSTFLAGS: -D warnings
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libglib2.0-dev libcairo2-dev
- name: Build release binary
run: cargo build --release --verbose
env:
RUSTFLAGS: -D warnings
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: map2fig-binary
path: target/release/map2fig