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

jobs:
  build-linux-gcc:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v1
      - name: install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -qq libsdl2-dev libglew-dev
      - name: build ded
        run: |
          ./build.sh
        env:
          CC: gcc
  build-linux-clang:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v1
      - name: install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -qq libsdl2-dev libglew-dev
      - name: build ded
        run: |
          ./build.sh
        env:
          CC: clang
  build-macos:
    runs-on: macOS-latest
    steps:
      - uses: actions/checkout@v1
      - name: install dependencies
        run: brew install sdl2 pkg-config glew
      - name: build ded
        run: |
          ./build.sh
        env:
          CC: clang
  # TODO(#29): build-windows-msvc is broken
  # ---
  # build-windows-msvc:
  #   runs-on: windows-2019
  #   steps:
  #     - uses: actions/checkout@v1
  #       # this runs vcvarsall for us, so we get the MSVC toolchain in PATH.
  #     - uses: seanmiddleditch/gha-setup-vsdevenv@master
  #     - name: Install dependencies
  #       run: |
  #         ./setup_dependencies.bat
  #     - name: build ded
  #       shell: cmd
  #       run: |
  #         ./build_msvc.bat
  #     - name: Prepare WindowsBinaries artifacts
  #       shell: cmd
  #       run: |
  #         mkdir winbin
  #         copy /B *.exe winbin
  #         copy /B *.png winbin
  #     - name: Upload WindowsBinaries artifacts
  #       uses: actions/upload-artifact@v2
  #       with:
  #         name: WindowsBinaries
  #         path: ./winbin/
