ci: add GitHub Actions

Change-Id: Ic7ed7356fef4af465843b44a5cefd0458c78774d
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..e7188d2
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,57 @@
+name: CI
+on:
+  push:
+  pull_request:
+  workflow_dispatch:
+
+jobs:
+  linux:
+    name: ${{ matrix.compiler }} on ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        compiler: [g++-8, g++-9, g++-10, g++-11,
+                   clang++-7, clang++-8, clang++-9, clang++-10, clang++-11, clang++-12]
+        os: [ubuntu-20.04]
+        include:
+          - compiler: g++-7
+            os: ubuntu-18.04
+          - compiler: clang++-5.0
+            os: ubuntu-18.04
+          - compiler: clang++-6.0
+            os: ubuntu-18.04
+    runs-on: ${{ matrix.os }}
+    env:
+      CXX: ${{ matrix.compiler }}
+      NODE_LABELS: Linux Ubuntu
+      WAF_JOBS: 2
+    steps:
+      - name: Install C++ compiler
+        run: |
+          sudo apt-get -qy install ${CXX/clang++/clang}
+          ${CXX} --version
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Build and test
+        run: ./.jenkins
+
+  macos:
+    name: Xcode ${{ matrix.xcode }} on ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        xcode: ['11.3', '11.7', '12.4']
+        os: [macos-10.15]
+    runs-on: ${{ matrix.os }}
+    env:
+      NODE_LABELS: OSX OSX-10.15
+      WAF_JOBS: 3
+    steps:
+      - name: Set up Xcode
+        uses: maxim-lobanov/setup-xcode@v1
+        with:
+          xcode-version: ${{ matrix.xcode }}
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Build and test
+        run: ./.jenkins
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 0000000..adccec2
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,31 @@
+name: Docs
+on:
+  push:
+  pull_request:
+  workflow_dispatch:
+
+jobs:
+  build:
+    strategy:
+      fail-fast: false
+      matrix:
+        os: [macos-10.15, ubuntu-20.04]
+    runs-on: ${{ matrix.os }}
+    env:
+      JOB_NAME: Docs
+      WAF_JOBS: 3
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Install dependencies
+        run: |
+          case ${RUNNER_OS} in
+            Linux) export NODE_LABELS="Linux Ubuntu Ubuntu-20.04" ;;
+            macOS) export NODE_LABELS="OSX OSX-10.15" ;;
+          esac
+          find .jenkins.d/ -type f -name '[1-9]*.sh' -exec chmod -x '{}' +
+          ./.jenkins
+      - name: Build documentation
+        run: |
+          ./waf --color=yes configure
+          ./waf --color=yes build --targets=manpages
diff --git a/.jenkins b/.jenkins
index bc1c847..1a12b6c 100755
--- a/.jenkins
+++ b/.jenkins
@@ -14,8 +14,10 @@
 for file in .jenkins.d/*; do
     [[ -f $file && -x $file ]] || continue
 
-    if [[ -n $TRAVIS ]]; then
-        label=$(basename "$file" | sed -E 's/[[:digit:]]+-(.*)\..*/\1/')
+    label=$(basename "$file" | sed -E 's/[[:digit:]]+-(.*)\..*/\1/')
+    if [[ -n $GITHUB_ACTIONS ]]; then
+        echo "::group::${label}"
+    elif [[ -n $TRAVIS ]]; then
         echo -ne "travis_fold:start:${label}\r"
         echo -ne "travis_time:start:${label}\r"
         start=$(nanos)
@@ -24,7 +26,9 @@
     echo "\$ $file"
     "$file"
 
-    if [[ -n $TRAVIS ]]; then
+    if [[ -n $GITHUB_ACTIONS ]]; then
+        echo "::endgroup::"
+    elif [[ -n $TRAVIS ]]; then
         finish=$(nanos)
         echo -ne "travis_time:end:${label}:start=${start},finish=${finish},duration=$((finish-start)),event=${label}\r"
         echo -ne "travis_fold:end:${label}\r"
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
index ce24355..3faaf09 100755
--- a/.jenkins.d/00-deps.sh
+++ b/.jenkins.d/00-deps.sh
@@ -7,9 +7,9 @@
         FORMULAE+=(python)
     fi
 
-    if [[ -n $TRAVIS ]]; then
-        # Travis images come with a large number of pre-installed
-        # brew packages, don't waste time upgrading all of them
+    if [[ -n $GITHUB_ACTIONS || -n $TRAVIS ]]; then
+        # GitHub Actions and Travis images come with a large number of
+        # pre-installed packages. Don't waste time upgrading all of them.
         brew list --versions "${FORMULAE[@]}" || brew update
         for FORMULA in "${FORMULAE[@]}"; do
             brew list --versions "$FORMULA" || brew install "$FORMULA"
@@ -23,15 +23,25 @@
         brew cleanup
     fi
 
+    if [[ $JOB_NAME == *"Docs" ]]; then
+        pip3 install --upgrade --upgrade-strategy=eager sphinx
+    fi
+
 elif has Ubuntu $NODE_LABELS; then
     sudo apt-get -qq update
     sudo apt-get -qy install build-essential pkg-config python3-minimal \
                              libboost-all-dev libssl-dev libsqlite3-dev \
                              libpcap-dev
 
-    if [[ $JOB_NAME == *"code-coverage" ]]; then
-        sudo apt-get -qy install gcovr lcov
-    fi
+    case $JOB_NAME in
+        *code-coverage)
+            sudo apt-get -qy install gcovr lcov
+            ;;
+        *Docs)
+            sudo apt-get -qy install python3-pip
+            pip3 install --user --upgrade --upgrade-strategy=eager sphinx
+            ;;
+    esac
 
 elif has CentOS-8 $NODE_LABELS; then
     sudo dnf config-manager --enable powertools