name: build

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

jobs:
  build-meson:
    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@v1
    - name: Install dependencies
      run: |
        sudo apt-get update
        sudo apt-get install meson libdrm-dev libgbm-dev libudev-dev libwayland-dev wayland-protocols libx11-dev
    - name: Setup
      run: meson setup build -Dflavors=x11-gl,x11-glesv2,x11-gl-egl,wayland-gl,wayland-glesv2,drm-gl,drm-glesv2
    - name: Build
      run: ninja -C build
    - name: Install
      run: DESTDIR=/tmp/glmark2-install ninja -C build install

  build-meson-only-drm:
    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@v1
    - name: Install dependencies
      run: |
        sudo apt-get update
        sudo apt-get install meson libdrm-dev libgbm-dev libudev-dev
    - name: Setup
      run: meson setup build -Dflavors=drm-gl,drm-glesv2
    - name: Build
      run: ninja -C build
    - name: Install
      run: DESTDIR=/tmp/glmark2-install ninja -C build install

  build-meson-only-wayland:
    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@v1
    - name: Install dependencies
      run: |
        sudo apt-get update
        sudo apt-get install meson libwayland-dev wayland-protocols
    - name: Setup
      run: meson setup build -Dflavors=wayland-gl,wayland-glesv2
    - name: Build
      run: ninja -C build
    - name: Install
      run: DESTDIR=/tmp/glmark2-install ninja -C build install

  build-meson-only-x11:
    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@v1
    - name: Install dependencies
      run: |
        sudo apt-get update
        sudo apt-get install meson libx11-dev
    - name: Setup
      run: meson setup build -Dflavors=x11-gl,x11-glesv2,x11-gl-egl
    - name: Build
      run: ninja -C build
    - name: Install
      run: DESTDIR=/tmp/glmark2-install ninja -C build install

  build-waf:
    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@v1
    - name: Install dependencies
      run: |
        sudo apt-get update
        sudo apt-get install libdrm-dev libgbm-dev libudev-dev libwayland-dev wayland-protocols libx11-dev
    - name: Setup
      run: ./waf configure --with-flavors=x11-gl,x11-glesv2,wayland-gl,wayland-glesv2,drm-gl,drm-glesv2
    - name: Build
      run: ./waf build
    - name: Install
      run: DESTDIR=/tmp/glmark2-install ./waf install
