name: ci

on:
  pull_request:
    paths:
      - '**'
      - '!.gitignore'
      - '!LICENSE'
      - '!README.md'
      - '!TODO.md'
      - '.github/workflows/ci.yml'
  push:
    branches:
      - '*'

jobs:
  linux:
    name: Linux (Ubuntu)
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
    steps:
      - uses: actions/checkout@v6
      - name: build
        run: |
          ./configure
          make -j$(getconf _NPROCESSORS_ONLN)

  linux-32bits:
    name: Linux 32-bits
    runs-on: ubuntu-latest
    defaults:
      run:
        shell: alpine.sh {0}
    steps:
      - uses: actions/checkout@v6
      - uses: jirutka/setup-alpine@v1
        with:
          arch: x86
          packages: "build-base make"
      - name: build
        run: |
          ./configure
          make CONFIG_32BIT=y

#  linux-s390x:
#    runs-on: ubuntu-latest
#    defaults:
#      run:
#        shell: alpine.sh {0}
#    steps:
#      - uses: actions/checkout@v6
#      - uses: jirutka/setup-alpine@v1
#        with:
#          arch: s390x
#          packages: "build-base make"
#      - name: build
#        run: |
#          ./configure
#          make

  macos:
    name: macOS
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [macos-14, macos-15]
    steps:
      - uses: actions/checkout@v6
      - name: build
        run: |
          ./configure
          make -j$(getconf _NPROCESSORS_ONLN)

#  windows-mingw:
#    runs-on: windows-latest
#    strategy:
#      fail-fast: false
#      matrix:
#        sys:
#          - mingw32
#          - mingw64
#          - clang64
#          - ucrt64
#    defaults:
#      run:
#        shell: msys2 {0}
#    steps:
#    - uses: actions/checkout@v6
#    - name: Setup MSYS2
#      uses: msys2/setup-msys2@v2
#      with:
#        msystem: ${{matrix.sys}}
#        install: >-
#          git
#          make
#        pacboy: >-
#          ninja:p
#          toolchain:p
#    - name: build
#      run: |
#        ./configure
#        make
#
#  cygwin:
#    runs-on: windows-latest
#    defaults:
#      run:
#        shell: C:\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
#    env:
#      CYGWIN_NOWINPATH: 1
#      CHERE_INVOKING: 1
#    steps:
#      - name: Set up Cygwin
#        uses: cygwin/cygwin-install-action@master
#        with:
#            packages: make gcc-g++ bash
#
#      - uses: actions/checkout@v6
#
#      - name: build
#        run: |
#          ./configure
#          make

  openbsd:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: build
        uses: vmactions/openbsd-vm@v1
        with:
          usesh: true
          prepare: |
            pkg_add gmake
          run: |
            ./configure
            gmake MAKE=gmake

  freebsd:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: build
        uses: vmactions/freebsd-vm@v1
        with:
          usesh: true
          prepare: |
            pkg install -y gmake
          run: |
            ./configure
            gmake MAKE=gmake

#  netbsd:
#    runs-on: ubuntu-latest
#    steps:
#      - uses: actions/checkout@v6
#      - name: build
#        uses: vmactions/netbsd-vm@v1
#        with:
#          usesh: true
#          prepare: |
#            /usr/sbin/pkg_add gmake
#          run: |
#            ./configure
#            gmake MAKE=gmake
