name: CI
on:
  push:
    branches: [master]
  pull_request:
    branches: [master]
  workflow_call:
env:
  CARGO_TERM_COLOR: always
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: Install additional packages
        run: sudo apt-get update && sudo apt-get install -y build-essential libgtksourceview-5-dev
      - name: Install Rust
        uses: actions-rust-lang/setup-rust-toolchain@v1
        with:
          components: clippy, rustfmt
      - name: Cache cargo
        uses: Swatinem/rust-cache@v2
      - name: Check formatting
        run: cargo fmt -- --check
      - name: Clippy
        run: cargo clippy --all-targets -- -D warnings -W clippy::pedantic
      - name: Run tests
        run: cargo test --all-targets --locked
