name: Check code formatting

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  check_format:
    runs-on: ubuntu-20.04

    steps:
    - uses: actions/checkout@v4
    - uses: DoozyX/clang-format-lint-action@v0.18
      with:
        source: '.'
        exclude: '*/third_party'
        extensions: 'h,cpp,js,ts,html'
        clangFormatVersion: 18
    - uses: actions/setup-python@v5
      with:
        python-version: '3.12' 
        cache: 'pip'
    - uses: psf/black@stable
      with:
        options: "--check --verbose"
        src: "./bindings/python/examples"
    - name: "gersemi cmake check"
      run: |
        pip3 install gersemi
        ./scripts/gersemi-check.sh

