---
name: checks_pr
'on':
  pull_request:
    branches:
      - master
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:
jobs:
  check-format:
    runs-on: ubuntu-latest
    permissions:
      contents: read # to fetch code (actions/checkout)
    steps:
      - uses: actions/checkout@v4
      - uses: wolletd/clang-format-checker@v1.11
        with:
          target-ref: master
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: read # to fetch code (actions/checkout)
    container:
      image: ghcr.io/kamailio/pkg-kamailio-docker:master-${{ matrix.distribution }}
      credentials:
        username: ${{ github.actor }}
        password: ${{ secrets.GITHUB_TOKEN }}
      volumes:
        - ${{ github.workspace }}:/code
      env:
        DIST: ${{ matrix.distribution }}
        CC: ${{ matrix.compilier }}
    strategy:
      matrix:
        include:
          - distribution: bookworm
            compilier: gcc
          - distribution: bookworm
            compilier: clang
    steps:
      - uses: actions/checkout@v4
      - uses: ammaraskar/gcc-problem-matcher@0.3.0
      - name: build
        run: |
          cd /code
          ./test/travis/build_travis.sh
        shell: bash
