name: run units target on OpenBSD

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

jobs:
  testing:
    runs-on: macos-10.15

    steps:
    - uses: actions/checkout@v2

    - uses: leleliu008/github-actions-vagrant@v2
      with:
        mem: 2048
        box: generic/openbsd6
        log: debug
        run: |
          export AUTOCONF_VERSION=2.69
          export AUTOMAKE_VERSION=1.16
              
          export CFLAGS='-I/usr/local/include -L/usr/local/lib'
              
          if [ ! -f /usr/local/lib/libiconv.so ] ; then
            sudo ln -s /usr/local/lib/libiconv.so.* /usr/local/lib/libiconv.so
          fi
              
          run sudo pkg_add automake-1.16.3 gmake

          run cc --version
            
          run ./autogen.sh
          run ./configure --prefix=/usr
          run gmake
          run sudo gmake install
          run file /usr/bin/ctags
          run ctags --version
          # bugs to fix
          #run make check CI=gha+vagrant+openbsd
          run gmake roundtrip CI=gha+vagrant+openbsd
