CI: start using github actions

Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
diff --git a/.github/workflows/docker-builds-checks.yml b/.github/workflows/docker-builds-checks.yml
new file mode 100644
index 0000000..c2f8586
--- /dev/null
+++ b/.github/workflows/docker-builds-checks.yml
@@ -0,0 +1,18 @@
+name: Docker builds and checks
+on: [push]
+
+jobs:
+  check_build:
+    runs-on: ubuntu-latest
+
+    strategy:
+      matrix:
+        os: [ubuntu-18.04, ubuntu-20.04, ubuntu-latest, centos7, centos8, fedora33, fedora34, docs ]
+    steps:
+      - uses: actions/checkout@v2
+      - name: Create Docker image
+        run: |
+          docker build --pull -t ${{ matrix.os }} -f opal-ci/Dockerfile-${{ matrix.os }} .
+      - name: build skiboot and run checks
+        run: |
+          docker run --security-opt seccomp=unconfined --volume `pwd`:/build --tmpfs /tmp/ --rm -t ${{ matrix.os }} bash -c "./opal-ci/build-${{ matrix.os }}.sh"
diff --git a/opal-ci/Dockerfile-centos8 b/opal-ci/Dockerfile-centos8
new file mode 100644
index 0000000..d289ff6
--- /dev/null
+++ b/opal-ci/Dockerfile-centos8
@@ -0,0 +1,13 @@
+FROM centos:8
+RUN yum -y update && yum clean all
+RUN yum -y install wget curl xterm gcc git xz make diffutils findutils expect valgrind valgrind-devel openssl-devel openssl
+
+RUN mkdir /opt/cross
+RUN if [ `arch` = "x86_64" ]; then wget https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/8.4.0/x86_64-gcc-8.4.0-nolibc-powerpc64-linux.tar.gz; tar -C /opt/cross -xf x86_64-gcc-8.4.0-nolibc-powerpc64-linux.tar.gz; fi
+RUN if [ `arch` = "ppc64le" ]; then wget https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/ppc64le/8.4.0/ppc64le-gcc-8.4.0-nolibc-powerpc64-linux.tar.gz; tar -C /opt/cross -xf ppc64le-gcc-8.4.0-nolibc-powerpc64-linux.tar.gz; fi
+
+RUN yum install -y flex bison
+RUN curl -L https://github.com/dgibson/dtc/archive/refs/tags/v1.6.1.tar.gz|tar xfz -
+RUN (cd dtc-1.6.1; make PREFIX=/usr/local install)
+COPY . /build/
+WORKDIR /build
diff --git a/opal-ci/Dockerfile-fedora34 b/opal-ci/Dockerfile-fedora34
new file mode 100644
index 0000000..5fc07ad
--- /dev/null
+++ b/opal-ci/Dockerfile-fedora34
@@ -0,0 +1,10 @@
+FROM fedora:34
+RUN dnf -y update
+RUN dnf -y install --allowerasing wget curl xterm gcc git xz make diffutils findutils expect valgrind valgrind-devel ccache dtc openssl openssl-devel gcc-powerpc64-linux-gnu mbedtls-devel
+# for building documentation and the coverage report
+RUN dnf -y install python-pip lcov
+# below packages are for building dtc
+RUN dnf -y install flex bison
+RUN if [ `arch` = "x86_64" ]; then dnf -y install http://public.dhe.ibm.com/software/server/powerfuncsim/p9/packages/v1.1-0/systemsim-p9-1.1-0.f22.x86_64.rpm; fi
+COPY . /build/
+WORKDIR /build
diff --git a/opal-ci/build-centos8.sh b/opal-ci/build-centos8.sh
new file mode 100755
index 0000000..b589e74
--- /dev/null
+++ b/opal-ci/build-centos8.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+set -uo pipefail
+set -e
+set -vx
+
+if [ $(arch) == "x86_64" ]; then
+    export CROSS=/opt/cross/gcc-8.4.0-nolibc/powerpc64-linux/bin/powerpc64-linux-
+fi
+if [ $(arch) == "ppc64le" ]; then
+    export CROSS=/opt/cross/gcc-8.4.0-nolibc/powerpc64-linux/bin/powerpc64-linux-
+fi
+
+MAKE_J=$(nproc)
+
+make -j${MAKE_J} all
+make -j${MAKE_J} check
+(make clean; cd external/gard && CROSS= make -j${MAKE_J})
+(cd external/pflash; make -j${MAKE_J})
+make clean
+SKIBOOT_GCOV=1 make -j${MAKE_J}
+SKIBOOT_GCOV=1 make -j${MAKE_J} check
+
+make clean
+rm -rf builddir
+mkdir builddir
+make SRC=$(pwd) -f ../Makefile -C builddir -j${MAKE_J}
+make clean
diff --git a/opal-ci/build-fedora34.sh b/opal-ci/build-fedora34.sh
new file mode 100755
index 0000000..7c607a1
--- /dev/null
+++ b/opal-ci/build-fedora34.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+set -uo pipefail
+set -e
+set -vx
+
+MAKE_J=$(nproc)
+export CROSS="ccache powerpc64-linux-gnu-"
+
+make -j${MAKE_J} all
+make -j${MAKE_J} check
+(make clean; cd external/gard && CROSS= make -j${MAKE_J})
+(cd external/pflash; make -j${MAKE_J})
+make clean
+SKIBOOT_GCOV=1 make -j${MAKE_J}
+SKIBOOT_GCOV=1 make -j${MAKE_J} check
+
+make clean
+rm -rf builddir
+mkdir builddir
+make SRC=$(pwd) -f ../Makefile -C builddir -j${MAKE_J}
+make clean