name: build
on:
  push:
    paths-ignore:
    - "README.rst"
    - "doc/*"
    - "po/*"
  pull_request:
    paths-ignore:
    - "README.rst"
    - "doc/*"
    - "po/*"
  schedule:
    - cron: '0 7 * * 6'
jobs:
  build-ubuntu:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Install the dependencies
      run: |
        sudo apt-get update;
        sudo apt-get install pkg-config gettext libgtk-3-dev libsoup2.4-dev libconfig-dev libssl-dev libsecret-1-dev \
        glib-networking libgtk3.0 libsoup2.4 libconfig9 libsecret-1-0;
    - name: Build
      run: |
        ./configure \
        --prefix=/usr/local \
        --datadir=/usr/local/share \
        --sysconfdir=/etc;
        make;
    - name: Install
      run: |
        sudo make install;
        /bin/sh -c "/usr/local/bin/srain --version";

  build-mingw64:
    runs-on: windows-latest
    defaults:
      run:
        shell: msys2 {0}
    steps:
    - uses: actions/checkout@v2
    - uses: msys2/setup-msys2@v1
      name: Init MSYS2/MINGW64 environment
      with:
        update: true
        msystem: MINGW64
        install: base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-gtk3 mingw-w64-x86_64-libconfig mingw-w64-x86_64-libsoup mingw-w64-x86_64-libsecret mingw-w64-x86_64-pkg-config mingw-w64-x86_64-gettext mingw-w64-x86_64-glib-networking
    - name: Build
      run: |
        ./configure \
        --prefix=$MINGW_PREFIX \
        --datadir=$MINGW_PREFIX/share \
        --sysconfdir=$MINGW_PREFIX/etc \
        --disable-debug && \
        make && \
        make install && \
        srain --version;
