name: "Build Documentation"

on:
  push:
    branches: [main, stable, oldstable]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  generate-doc-and-upload-coverage:
    name: Build XML documentation and upload coverage
    runs-on: ubuntu-latest
    container: greenbone/doxygen
    steps:
      - name: Run the c lang coverage action
        uses: greenbone/actions/doc-coverage-clang@v3
        with:
          token: ${{ secrets.CODECOV_TOKEN }}

  build-gmp-doc:
    name: Build GMP documentation
    runs-on: ubuntu-latest
    container: ghcr.io/greenbone/gvm-libs:stable
    steps:
      - name: Check out gvmd
        uses: actions/checkout@v6
      - name: Generate GMP documentation (HTML)
        run: |
          mkdir build
          cd build
          cmake -DSKIP_SRC=1 ..
          make doc-gmp
      - name: Upload GMP documentation artifact
        uses: actions/upload-artifact@v7
        with:
          name: gmp.html
          path: build/doc/gmp.html
          retention-days: 14
