name: Build
on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

jobs:
  build:
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]

    steps:
    - uses: actions/checkout@v3
    - name: install autotools on macos
      run: brew install automake
      if: matrix.os == 'macos-latest'
    - name: install libpcap on linux
      run: |
        sudo apt-get update -qq
        sudo apt-get install -qq libpcap0.8-dev libcap-dev
      if: matrix.os == 'ubuntu-latest'
    - name: autoreconf
      run: autoreconf --install
    - name: configure
      run: ./configure
    - name: make
      run: make
    - name: make check
      run: make check
    - name: make distcheck
      run: make distcheck
    - name: print info
      run: |
        uname -a
        lsb_release -a || true
        sw_vers || true
        gcc --version
        autoconf --version
        automake --version
        ./arp-scan --version
