---
name: Slow BSD test job

# yamllint disable-line rule:truthy
on:
  pull_request:
  release:
    types:
      - published
      - created
      - edited
  workflow_dispatch:

jobs:
  test_bsd:
    name: Test BSD
    runs-on: ubuntu-latest
    strategy:
      matrix:
        os:
          - name: freebsd
            architecture: x86-64
            version: '13.2'

    steps:
      - uses: actions/checkout@v7
        with:
          fetch-depth: 0
      - name: Fix Checkout
        run: |
          git fetch --force --tags

      - name: Start VM
        uses: cross-platform-actions/action@v1.3.0
        with:
          operating_system: ${{ matrix.os.name }}
          architecture: ${{ matrix.os.architecture }}
          version: ${{ matrix.os.version }}
          shell: bash
          memory: 5G
          cpu_count: 4

      - name: Test
        shell: cpa.sh {0}
        run: |
          sudo pkg install -y \
            autoconf \
            automake \
            git-tiny \
            gmake \
            python3 \
            jq \
            bash
          ./autogen.sh
          ./configure CC=clang
          gmake all

  test_openbsd:
    name: Test OpenBSD
    runs-on: ubuntu-latest
    strategy:
      matrix:
        os:
          - name: openbsd
            architecture: x86-64
            version: '7.5'

    steps:
      - uses: actions/checkout@v7
        with:
          fetch-depth: 0
      - name: Fix Checkout
        run: |
          git fetch --force --tags

      - name: Start VM
        uses: cross-platform-actions/action@v1.3.0
        with:
          operating_system: ${{ matrix.os.name }}
          architecture: ${{ matrix.os.architecture }}
          version: ${{ matrix.os.version }}
          shell: bash
          memory: 5G
          cpu_count: 4

      - name: Test
        shell: cpa.sh {0}
        run: |
          sudo pkg_add \
            autoconf-2.71 \
            automake-1.16.5 \
            git \
            gmake \
            python3 \
            jq \
            bash
          AUTOCONF_VERSION=2.71 AUTOMAKE_VERSION=1.16 ./autogen.sh
          ./configure CC=clang
          gmake all

  test_netbsd:
    name: Test NetBSD
    runs-on: ubuntu-latest
    strategy:
      matrix:
        os:
          - name: netbsd
            architecture: x86-64
            version: '10.1'

    steps:
      - uses: actions/checkout@v7
        with:
          fetch-depth: 0
      - name: Fix Checkout
        run: |
          git fetch --force --tags

      - name: Start VM
        uses: cross-platform-actions/action@v1.3.0
        with:
          operating_system: ${{ matrix.os.name }}
          architecture: ${{ matrix.os.architecture }}
          version: ${{ matrix.os.version }}
          shell: bash
          memory: 5G
          cpu_count: 4

      - name: Test
        shell: cpa.sh {0}
        run: |
          sudo env PKG_PATH=https://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/x86_64/10.1/All/ \
          pkg_add -u -v \
            autoconf \
            automake \
            git \
            gmake \
            jq \
            bash
          ./autogen.sh
          ./configure
          gmake all
