Replace Travis CI with Github Actions (#1047)

* Replace Travis CI with Github Actions

Signed-off-by: Kevin Petit <kevin.petit@arm.com>

* Fix OpenGL coverage

* Tidy up

- Fix shell warning
- Remove ENABLE_OPENCL30_PROVISIONAL ICD CMake option
diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml
new file mode 100644
index 0000000..85db407
--- /dev/null
+++ b/.github/workflows/presubmit.yml
@@ -0,0 +1,40 @@
+name: Presubmit
+on: [push, pull_request]
+
+jobs:
+  build:
+    name: Build ${{ matrix.os }} ${{ matrix.name }}
+    runs-on: ${{ matrix.os }}
+    env:
+      JOB_CHECK_FORMAT: ${{ matrix.format }}
+      JOB_ARCHITECTURE: ${{ matrix.arch }}
+      JOB_ENABLE_GL: ${{ matrix.gl }}
+    strategy:
+      matrix:
+        mainmatrix: [true]
+        os: [ubuntu-20.04, macos-11.0]
+        include:
+          - os: ubuntu-20.04
+            mainmatrix: true
+            gl: 1
+          - os: ubuntu-20.04
+            mainmatrix: false
+            name: Format
+            format: 1
+          - os: ubuntu-20.04
+            mainmatrix: false
+            name: Arm
+            arch: arm
+          - os: ubuntu-20.04
+            mainmatrix: false
+            name: AArch64
+            arch: aarch64
+    steps:
+      - name: Setup
+        run: if [[ "${{matrix.format}}" == "1" ]]; then sudo apt install -y clang-format; fi
+      - uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+      - name: Build
+        run: ./presubmit.sh
+
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 98984d8..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-language: cpp
-
-os:
-  - linux
-  - osx
-
-jobs:
-  include:
-  - os: linux
-    dist: bionic
-    env: JOB_CHECK_FORMAT=1
-    addons:
-        apt:
-          packages:
-            - clang-format-9
-  - os: linux
-    env: JOB_ARCHITECTURE=arm
-  - os: linux
-    env: JOB_ARCHITECTURE=aarch64
-
-script:
-  - ./travis.sh
diff --git a/travis.sh b/presubmit.sh
similarity index 90%
rename from travis.sh
rename to presubmit.sh
index 6b2b2de..646a7f0 100755
--- a/travis.sh
+++ b/presubmit.sh
@@ -4,7 +4,7 @@
 
 export TOP=$(pwd)
 
-if [ "${JOB_CHECK_FORMAT}" -eq 1 ]; then
+if [[ "${JOB_CHECK_FORMAT}" == "1" ]]; then
     ./check-format.sh
     exit $?
 fi
@@ -41,7 +41,7 @@
     echo "SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> ${TOOLCHAIN_FILE}
 fi
 
-if [[ ( ${JOB_ARCHITECTURE} == "" && ${TRAVIS_OS_NAME} == "linux" ) ]]; then
+if [[ ( ${JOB_ARCHITECTURE} == "" && ${JOB_ENABLE_GL} == "1" ) ]]; then
     BUILD_OPENGL_TEST="ON"
     sudo apt-get update
     sudo apt-get -y install libglu1-mesa-dev freeglut3-dev mesa-common-dev libglew-dev
@@ -57,7 +57,7 @@
 cd ${TOP}/OpenCL-ICD-Loader
 mkdir build
 cd build
-cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} -DENABLE_OPENCL30_PROVISIONAL=1 -DOPENCL_ICD_LOADER_HEADERS_DIR=${TOP}/OpenCL-Headers/ ..
+cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} -DOPENCL_ICD_LOADER_HEADERS_DIR=${TOP}/OpenCL-Headers/ ..
 make
 
 # Get libclcxx