name: C/C++ CI

on:
  push:
    branches: [master, develop, testing]
  pull_request:
    branches: [master, develop, testing]

jobs:
  # Linux

  # job_linux_16_04_64_gcc:
  #   name: ubuntu-16.04 gcc
  #   runs-on: ubuntu-16.04
  #   steps:
  #     - uses: actions/checkout@v2
  #     - name: Install dependencies
  #       run: sudo apt-get install gcc-5 libusb-1.0.0-dev libgtk-3-dev rpm
  #     - name: make debug
  #       run: sudo make clean && make debug
  #     - name: make test
  #       run: sudo make clean && make test
  #     - name: make release
  #       run: sudo make clean && make release
  #     - name: sudo make install
  #       run: sudo make clean && sudo make install
  #     - name: sudo make package
  #       run: sudo make package
  #     - name: sudo make uninstall
  #       run: sudo make uninstall && sudo make clean

  # job_linux_16_04_32_gcc:
  #   name: ubuntu-16.04 gcc 32-bit
  #   runs-on: ubuntu-16.04
  #   steps:
  #     - uses: actions/checkout@v2
  #     - name: Install dependencies
  #       run: sudo apt-get install gcc-5 libusb-1.0.0-dev libgtk-3-dev rpm
  #     - name: Set compiler flags
  #       run: |
  #         CFLAGS="$CFLAGS -m32"
  #         CXXFLAGS="$CXXFLAGS -m32"
  #         LDFLAGS="$LDFLAGS -m32"
  #     - name: make debug
  #       run: sudo make clean && make debug
  #     - name: make test
  #       run: sudo make clean && make test
  #     - name: make release
  #       run: sudo make clean && make release
  #     - name: sudo make install
  #       run: sudo make clean && sudo make install
  #     - name: sudo make package
  #       run: sudo make package
  #     - name: sudo make uninstall
  #       run: sudo make uninstall && sudo make clean

  # job_linux_16_04_64_clang:
  #   name: ubuntu-16.04 clang
  #   runs-on: ubuntu-16.04
  #   steps:
  #     - uses: actions/checkout@v2
  #     - name: Install dependencies
  #       run: sudo apt-get install clang-3.5 libusb-1.0.0-dev libgtk-3-dev rpm
  #     - name: make debug
  #       run: sudo make clean && make debug
  #     - name: make test
  #       run: sudo make clean && make test
  #     - name: make release
  #       run: sudo make clean && make release
  #     - name: sudo make install
  #       run: sudo make clean && sudo make install
  #     - name: sudo make package
  #       run: sudo make package
  #     - name: sudo make uninstall
  #       run: sudo make uninstall && sudo make clean

  # job_linux_16_04_32_clang:
  #   name: ubuntu-16.04 clang 32-bit
  #   runs-on: ubuntu-16.04
  #   steps:
  #     - uses: actions/checkout@v2
  #     - name: Install dependencies
  #       run: sudo apt-get install clang-3.5 libusb-1.0.0-dev libgtk-3-dev rpm
  #     - name: Set compiler flags
  #       run: |
  #         CFLAGS="$CFLAGS -m32"
  #         CXXFLAGS="$CXXFLAGS -m32"
  #         LDFLAGS="$LDFLAGS -m32"
  #     - name: make debug
  #       run: sudo make clean && make debug
  #     - name: make test
  #       run: sudo make clean && make test
  #     - name: make release
  #       run: sudo make clean && make release
  #     - name: sudo make install
  #       run: sudo make clean && sudo make install
  #     - name: sudo make package
  #       run: sudo make package
  #     - name: sudo make uninstall
  #       run: sudo make uninstall && sudo make clean

  job_linux_18_04_64_gcc:
    name: ubuntu-18.04 gcc
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - name: install dependencies
        run: sudo apt-get install gcc-6 libusb-1.0.0-dev libgtk-3-dev rpm
      - name: make debug
        run: sudo make clean && make debug
      - name: make test
        run: sudo make clean && make test
      - name: make release
        run: sudo make clean && make release
      - name: sudo make install
        run: sudo make clean && sudo make install
      - name: sudo make package
        run: sudo make package
      - name: sudo make uninstall
        run: sudo make uninstall && sudo make clean

  job_linux_18_04_32_gcc:
    name: ubuntu-18.04 gcc 32-bit
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - name: install dependencies
        run: sudo apt-get install gcc-6 libusb-1.0.0-dev libgtk-3-dev rpm
      - name: Set compiler flags
        run: |
          CFLAGS="$CFLAGS -m32"
          CXXFLAGS="$CXXFLAGS -m32"
          LDFLAGS="$LDFLAGS -m32"
      - name: make debug
        run: sudo make clean && make debug
      - name: make test
        run: sudo make clean && make test
      - name: make release
        run: sudo make clean && make release
      - name: sudo make install
        run: sudo make clean && sudo make install
      - name: sudo make package
        run: sudo make package
      - name: sudo make uninstall
        run: sudo make uninstall && sudo make clean

  job_linux_18_04_64_clang:
    name: ubuntu-18.04 clang
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - name: install dependencies
        run: sudo apt-get install clang-10 libusb-1.0.0-dev libgtk-3-dev rpm
      - name: make debug
        run: sudo make clean && make debug
      - name: make test
        run: sudo make clean && make test
      - name: make release
        run: sudo make clean && make release
      - name: sudo make install
        run: sudo make clean && sudo make install
      - name: sudo make package
        run: sudo make package
      - name: sudo make uninstall
        run: sudo make uninstall && sudo make clean

  job_linux_18_04_32_clang:
    name: ubuntu-18.04 clang 32-bit
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - name: Install dependencies
        run: sudo apt-get install clang-10 libusb-1.0.0-dev libgtk-3-dev rpm
      - name: Set compiler flags
        run: |
          CFLAGS="$CFLAGS -m32"
          CXXFLAGS="$CXXFLAGS -m32"
          LDFLAGS="$LDFLAGS -m32"
      - name: make debug
        run: sudo make clean && make debug
      - name: make test
        run: sudo make clean && make test
      - name: make release
        run: sudo make clean && make release
      - name: sudo make install
        run: sudo make clean && sudo make install
      - name: sudo make package
        run: sudo make package
      - name: sudo make uninstall
        run: sudo make uninstall && sudo make clean

  job_linux_20_04_64_gcc:
    name: ubuntu-20.04 gcc
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2
      - name: Install dependencies
        run: sudo apt-get install gcc-10 libusb-1.0.0-dev libgtk-3-dev rpm
      - name: make debug
        run: sudo make clean && make debug
      - name: make test
        run: sudo make clean && make test
      - name: make release
        run: sudo make clean && make release
      - name: sudo make install
        run: sudo make clean && sudo make install
      - name: sudo make package
        run: sudo make package
      - name: sudo make uninstall
        run: sudo make uninstall && sudo make clean

  job_linux_20_04_32_gcc:
    name: ubuntu-20.04 gcc 32-bit
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2
      - name: Install dependencies
        run: sudo apt-get install gcc-10 libusb-1.0.0-dev libgtk-3-dev rpm
      - name: Set compiler flags
        run: |
          CFLAGS="$CFLAGS -m32"
          CXXFLAGS="$CXXFLAGS -m32"
          LDFLAGS="$LDFLAGS -m32"
      - name: make debug
        run: sudo make clean && make debug
      - name: make test
        run: sudo make clean && make test
      - name: make release
        run: sudo make clean && make release
      - name: sudo make install
        run: sudo make clean && sudo make install
      - name: sudo make package
        run: sudo make package
      - name: sudo make uninstall
        run: sudo make uninstall && sudo make clean

  job_linux_20_04_64_clang:
    name: ubuntu-20.04 clang
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2
      - name: Install dependencies
        run: sudo apt-get install clang-10 libusb-1.0.0-dev libgtk-3-dev rpm
      - name: make debug
        run: sudo make clean && make debug
      - name: make test
        run: sudo make clean && make test
      - name: make release
        run: sudo make clean && make release
      - name: sudo make install
        run: sudo make clean && sudo make install
      - name: sudo make package
        run: sudo make package
      - name: sudo make uninstall
        run: sudo make uninstall && sudo make clean

  job_linux_20_04_32_clang:
    name: ubuntu-20.04 clang 32-bit
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2
      - name: Install dependencies
        run: sudo apt-get install clang-10 libusb-1.0.0-dev libgtk-3-dev rpm
      - name: Set compiler flags
        run: |
          CFLAGS="$CFLAGS -m32"
          CXXFLAGS="$CXXFLAGS -m32"
          LDFLAGS="$LDFLAGS -m32"
      - name: make debug
        run: sudo make clean && make debug
      - name: make test
        run: sudo make clean && make test
      - name: make release
        run: sudo make clean && make release
      - name: sudo make install
        run: sudo make clean && sudo make install
      - name: sudo make package
        run: sudo make package
      - name: sudo make uninstall
        run: sudo make uninstall && sudo make clean

  # macOS

  # job_macos_10_14_64_gcc:
  #   name: macos-10.14 gcc
  #   runs-on: macos-10.14
  #   steps:
  #     - uses: actions/checkout@v2
  #     - name: Install dependencies
  #       run: brew install gcc libusb gtk+3
  #     - name: make debug
  #       run: sudo make clean && make debug
  #     - name: make test
  #       run: sudo make clean && make test
  #     - name: make release
  #       run: sudo make clean && make release
  #     - name: sudo make install
  #       run: sudo make clean && sudo make install
  #     - name: sudo make package
  #       run: sudo make package
  #     - name: sudo make uninstall
  #       run: sudo make uninstall && sudo make clean

  # job_macos_10_14_32_gcc:
  #   name: macos-10.14 gcc 32-bit
  #   runs-on: macos-10.14
  #   steps:
  #     - uses: actions/checkout@v2
  #     - name: Install dependencies
  #       run: brew install gcc libusb gtk+3
  #     - name: Set compiler flags
  #       run: |
  #         CFLAGS="$CFLAGS -m32"
  #         CXXFLAGS="$CXXFLAGS -m32"
  #         LDFLAGS="$LDFLAGS -m32"
  #     - name: make debug
  #       run: sudo make clean && make debug
  #     - name: make test
  #       run: sudo make clean && make test
  #     - name: make release
  #       run: sudo make clean && make release
  #     - name: sudo make install
  #       run: sudo make clean && sudo make install
  #     - name: sudo make package
  #       run: sudo make package
  #     - name: sudo make uninstall
  #       run: sudo make uninstall && sudo make clean

  # job_macos_10_14_64_clang:
  #   name: macos-10.14 clang
  #   runs-on: macos-10.14
  #   steps:
  #     - uses: actions/checkout@v2
  #     - name: Install dependencies
  #       run: brew install llvm libusb gtk+3
  #     - name: make debug
  #       run: sudo make clean && make debug
  #     - name: make test
  #       run: sudo make clean && make test
  #     - name: make release
  #       run: sudo make clean && make release
  #     - name: sudo make install
  #       run: sudo make clean && sudo make install
  #     - name: sudo make package
  #       run: sudo make package
  #     - name: sudo make uninstall
  #       run: sudo make uninstall && sudo make clean

  # job_macos_10_14_32_clang:
  #   name: macos-10.14 clang 32-bit
  #   runs-on: macos-10.14
  #   steps:
  #     - uses: actions/checkout@v2
  #     - name: Install dependencies
  #       run: brew install llvm libusb gtk+3
  #     - name: Set compiler flags
  #       run: |
  #         CFLAGS="$CFLAGS -m32"
  #         CXXFLAGS="$CXXFLAGS -m32"
  #         LDFLAGS="$LDFLAGS -m32"
  #     - name: make debug
  #       run: sudo make clean && make debug
  #     - name: make test
  #       run: sudo make clean && make test
  #     - name: make release
  #       run: sudo make clean && make release
  #     - name: sudo make install
  #       run: sudo make clean && sudo make install
  #     - name: sudo make package
  #       run: sudo make package
  #     - name: sudo make uninstall
  #       run: sudo make uninstall && sudo make clean

  job_macos_10_15_gcc:
    name: macos-10.15 gcc
    runs-on: macos-10.15
    steps:
      - uses: actions/checkout@v2
      - name: Install dependencies
        run: brew install gcc libusb gtk+3
      - name: make debug
        run: sudo make clean && make debug
      - name: make test
        run: sudo make clean && make test
      - name: make release
        run: sudo make clean && make release
      - name: sudo make install
        run: sudo make clean && sudo make install
      - name: sudo make package
        run: sudo make package
      - name: sudo make uninstall
        run: sudo make uninstall && sudo make clean

  job_macos_10_15_clang:
    name: macos-10.15 clang
    runs-on: macos-10.15
    steps:
      - uses: actions/checkout@v2
      - name: Install dependencies
        run: brew install llvm libusb gtk+3
      - name: make debug
        run: sudo make clean && make debug
      - name: make test
        run: sudo make clean && make test
      - name: make release
        run: sudo make clean && make release
      - name: sudo make install
        run: sudo make clean && sudo make install
      - name: sudo make package
        run: sudo make package
      - name: sudo make uninstall
        run: sudo make uninstall && sudo make clean
  # job_macos_11_gcc:
  #   name: macos-11.0 gcc
  #   runs-on: macos-11.0
  #   steps:
  #     - uses: actions/checkout@v2
  #     - name: Install dependencies
  #       run: brew install gcc libusb gtk+3
  #     - name: make debug
  #       run: sudo make clean && make debug
  #     - name: make test
  #       run: sudo make clean && make test
  #     - name: make release
  #       run: sudo make clean && make release
  #     - name: sudo make install
  #       run: sudo make clean && sudo make install
  #     - name: sudo make package
  #       run: sudo make package
  #     - name: sudo make uninstall
  #       run: sudo make uninstall && sudo make clean
  # job_macos_11_clang:
  #   name: macos-11.0 clang
  #   runs-on: macos-11.0
  #   steps:
  #     - uses: actions/checkout@v2
  #     - name: Install dependencies
  #       run: brew install llvm libusb gtk+3
  #     - name: make debug
  #       run: sudo make clean && make debug
  #     - name: make test
  #       run: sudo make clean && make test
  #     - name: make release
  #       run: sudo make clean && make release
  #     - name: sudo make install
  #       run: sudo make clean && sudo make install
  #     - name: sudo make package
  #       run: sudo make package
  #     - name: sudo make uninstall
  #       run: sudo make uninstall && sudo make clean
# Linux MinGW cross compliation

# job_linux_20_04_cross:
#   name: ubuntu-20.04 mingw64
#   runs-on: ubuntu-20.04
#   steps:
#     - uses: actions/checkout@v2
#     - name: Install dependencies
#       run: sudo apt-get install gcc-10 libusb-1.0.0-dev libgtk-3-dev rpm mingw-w64
#     - name: Building Release for Windows (x86-64) ...
#       run: sudo mkdir -p build-mingw && cd build-mingw && sudo cmake \
#         -DCMAKE_SYSTEM_NAME=Windows \
#         -DTOOLCHAIN_PREFIX=x86_64-w64-mingw32 \
#         -DCMAKE_TOOLCHAIN_FILE=$PWD/../cmake/modules/set_toolchain.cmake \
#         -DCMAKE_INSTALL_PREFIX=$PWD/install $PWD && \
#         sudo make && sudo rm -rf build-mingw && cd -
