name: cross compile with mingw-w64

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

jobs:
  cross-compile:
    strategy:
      fail-fast: false
      matrix:
        build-machine-os: [ubuntu-18.04, ubuntu-20.04, macos-10.15, macos-11]
        target: [i686-w64-mingw32,x86_64-w64-mingw32]

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

    steps:
      - uses: actions/checkout@v2
      
      - run: brew install mingw-w64 gcc make automake autoconf file

      - run: ./autogen.sh

      - name: Run ./configure ...
        run: |
          ./configure \
              --host=${{ matrix.target }} \
              --disable-iconv \
              --disable-xml \
              --disable-json \
              --disable-yaml \
              --disable-pcre2 \
              CC=${{ matrix.target }}-gcc \
              CFLAGS='-v' \
              AR=${{ matrix.target }}-ar \
              RANLIB=${{ matrix.target }}-ranlib \
              WINDRES=${{ matrix.target }}-windres
      
      - run: make V=1
      
      - run: file ctags.exe | grep PE32
