name: run units target on FreeBSD

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  testing:
    runs-on: macos-10.15

    strategy:
      fail-fast: false
      matrix:
        freebsd-version: [12,13]

    steps:
    - uses: actions/checkout@v2

    # https://app.vagrantup.com/boxes/search?utf8=%E2%9C%93&sort=downloads&provider=&q=freebsd
    # https://github.com/leleliu008/github-actions-vagrant
    - uses: leleliu008/github-actions-vagrant@v2
      with:
        mem: 2048
        box: generic/freebsd${{ matrix.freebsd-version }}
        log: debug
        run: |
          run pkg install -y automake pkgconf gmake
          run freebsd-version
          run cc --version
          run ./autogen.sh
          run ./configure --prefix=/usr
          run gmake
          run gmake install
          run file ctags
          run ctags --version
          run gmake check CI=gha+vagrant+freebsd
          run gmake roundtrip CI=gha+vagrant+freebsd
