name: Rust CI

on:
  push:
    branches: [ "main", "master" ]
  pull_request:
    branches: [ "main", "master" ]

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3

    - name: Install system dependencies
      run: |
        sudo apt-get update
        sudo apt-get install -y libxcb-shape0-dev libxcb-xfixes0-dev libx11-dev libxcb1-dev

    - name: Build
      run: cargo build --verbose

    - name: Run tests
      run: cargo test --verbose

    - name: Check formatting
      run: cargo fmt -- --check
