name: Rust
permissions:
  contents: read

on:
  push:
    branches: [ "dev", "stable" ]
    paths:
      - '**/*.rs'
      - 'Cargo.toml'
      - 'rust-toolchain.toml'
      - '.cargo/**'
      - '!**/*.md'
      - '!docs/**'
  pull_request:
    branches: [ "dev", "stable" ]
    paths:
      - '**/*.rs'
      - 'Cargo.toml'
      - 'rust-toolchain.toml'
      - '.cargo/**'
      - '!**/*.md'
      - '!docs/**'

env:
  CARGO_TERM_COLOR: always

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4
    - name: Install dependencies
      run: |
        sudo apt update
        sudo apt install -y pkg-config libfreetype6-dev libfontconfig1-dev
    - name: Build
      run: cargo build --verbose
    - name: Run tests
      run: cargo test --verbose
