name: Check build

on:
  push:
    branches:
      - master
    
  pull_request:
    branches:
      - master

  schedule:
    - cron: '0 0 * * *'
  
jobs:
  archlinux:
    name: on Archlinux
    runs-on: ubuntu-20.04
    container: docker.io/library/archlinux:latest
    steps:
      - name: Checkout ukui-sidebar source code
        uses: actions/checkout@v2
      - name: Refresh pacman repository
        run: pacman -Sy
      - name: Install build dependencies
        run: pacman -S --noconfirm base-devel qt5-base qt5-multimedia qt5-svg qt5-tools gsettings-qt dconf glib2 kwindowsystem glibc ruby-pkg-config libxrandr libxinerama libxcursor libxtst libx11 qt5-x11extras icu
      - name: QMake configure & Make
        run: |
          mkdir build;
          cd build;
          qmake-qt5 ..;
          make -j$(nproc);

  debian:
    name: on Debian Sid
    runs-on: ubuntu-20.04
    container: docker.io/library/debian:sid
    env:
      DEBIAN_FRONTEND: noninteractive
    steps:
      - name: Checkout ukui-sidebar source code
        uses: actions/checkout@v2
      - name: Update apt repository
        run: apt-get update -y
      - name: Install build dependcies
        run: apt-get install -y build-essential qttools5-dev-tools qtmultimedia5-dev libglib2.0-dev qtbase5-dev libqt5svg5-dev qttools5-dev-tools libgsettings-qt-dev libdconf-dev libkf5windowsystem-dev libburner-media3-1 gstreamer1.0-plugins-good gstreamer1.0-pulseaudio libqt5x11extras5-dev pkg-config libxrandr-dev libxinerama-dev libxcursor-dev libburner-media3-1 libxtst-dev
      - name: QMake configure & Make
        run: |
          mkdir build;
          cd build;
          qmake ..;
          make -j$(nproc);
  
  fedora:
    name: on Fedora 32
    runs-on: ubuntu-20.04
    container: docker.io/library/fedora:32
    steps:
      - name: Checkout ukui-sidebar source code
        uses: actions/checkout@v2
      - name: Install curl and patch
        run: dnf install --refresh -y curl patch
      - name: Install build dependencies
        run: dnf install -y which gcc gcc-c++ make cmake cmake-rpm-macros autoconf automake intltool rpm-build qt5-rpm-macros  qt5-qtbase-devel qt5-qttools-devel glib2-devel qt5-qtbase-devel qt5-qtsvg-devel dconf-devel gsettings-qt-devel qt5-qtmultimedia-devel kf5-kwindowsystem-devel libXtst-devel qt5-qtx11extras-devel pkgconf-pkg-config libXrandr-devel libXinerama-devel libXcursor-devel gstreamer1-plugins-good-qt
      - name: QMake configure & Make
        run: |
          mkdir build;
          cd build;
          qmake-qt5 ..;
          make -j$(nproc);

  ubuntu:
    name: on Ubuntu 20.04
    runs-on: ubuntu-20.04
    container: docker.io/library/ubuntu:focal
    env:
      DEBIAN_FRONTEND: noninteractive
    steps:
      - name: Checkout ukui-sidebar source code
        uses: actions/checkout@v2
      - name: Update apt repository
        run: apt-get update -y
      - name: Install build dependcies
        run: apt-get install -y build-essential qt5-default qttools5-dev-tools qtmultimedia5-dev libglib2.0-dev qtbase5-dev libqt5svg5-dev qttools5-dev-tools libgsettings-qt-dev libdconf-dev libkf5windowsystem-dev libburner-media3-1 gstreamer1.0-plugins-good gstreamer1.0-pulseaudio libqt5x11extras5-dev pkg-config libxrandr-dev libxinerama-dev libxcursor-dev libxtst-dev libburner-media3-1
      - name: QMake configure & Make
        run: |
          mkdir build;
          cd build;
          qmake ..;
          make -j$(nproc);
