name: run units target on Cygwin

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

jobs:
  testing:  
    runs-on: windows-latest

    defaults:
      run:
        shell: C:\tools\cygwin\bin\bash.exe -l -i {0}

    steps:
    - run: choco install -y --source cygwin gcc-g++ make automake autoconf pkg-config dos2unix libiconv-devel libjansson-devel libxml2-devel libyaml-devel
      shell: pwsh
    
    - run: git config --global core.autocrlf input
      shell: bash

    - uses: actions/checkout@v2
    
    - run: printf 'cd %s' "$(cygpath '${{ github.workspace }}')" >> ~/.bashrc

    - run: ./autogen.sh
    - run: ./configure --prefix=/usr
    - run: make V=1
    - run: make install
    - run: file /usr/bin/ctags
    - run: /usr/bin/ctags --version
    - run: make check V=1
    - run: make roundtrip
