on:
  pull_request:
  push:
    branches:
      - 'main'
      - '[0-9].[0-9]'
jobs:
  distcheck:
    runs-on: debian
    steps:
      - name: apt-get
        run: |
          apt-get update
          apt-get install -y git
      - name: git config
        run: |
          git config --global core.autocrlf false
          git config --global --add safe.directory ${FORGEJO_WORKSPACE}
      - name: checkout
        uses: https://code.vinyl-cache.org/forgejo/sane-checkout.git@v0.3
      - name: install prerequisites
        run: |
          apt-get install -y \
            make \
            automake \
            autotools-dev \
            libedit-dev \
            libjemalloc-dev \
            libncurses-dev \
            libpcre2-dev \
            libtool \
            pkg-config \
            python3-docutils \
            python3-sphinx \
            cpio \
            \
            graphviz \
            pip furo
      - name: make distcheck
        run: |
          ./autogen.des
          make -j$(nproc) distcheck || (find . -name test-suite.log | xargs cat; exit 1)
