Enable CI using GitHub Actions

This patch sets up a simple GH Action configuration to build and unit
test erlfdb on Windows and Linux. We could get a lot fancier here; my
initial goal was simply to avoid regressions in x-platform support.

I'm using a handful of third-party actions to make this setup work:

- https://github.com/erlef/setup-beam
- https://github.com/ilammy/msvc-dev-cmd
- https://github.com/mxschmitt/action-tmate

ASF policy prohibits the direct use of third-party Actions because it's
not possible to code review each chamnge to them. Importing them as a
submodule pins the action to a specific commit and is the accepted
workaround at this time.
diff --git a/.github/actions/msvc-dev-cmd b/.github/actions/msvc-dev-cmd
new file mode 160000
index 0000000..9f8ae83
--- /dev/null
+++ b/.github/actions/msvc-dev-cmd
@@ -0,0 +1 @@
+Subproject commit 9f8ae839b01883414208f29e3e24524387f48e1f
diff --git a/.github/actions/setup-beam b/.github/actions/setup-beam
new file mode 160000
index 0000000..c255c7e
--- /dev/null
+++ b/.github/actions/setup-beam
@@ -0,0 +1 @@
+Subproject commit c255c7e97f15c92985793fe937175930f5c056ca
diff --git a/.github/actions/tmate b/.github/actions/tmate
new file mode 160000
index 0000000..80a9fae
--- /dev/null
+++ b/.github/actions/tmate
@@ -0,0 +1 @@
+Subproject commit 80a9fae9f2f90408784fb3cfbc192b2de04b7432
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..d575464
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,83 @@
+name: CI
+
+on:
+  push:
+    branches: [ main ]
+  pull_request:
+
+jobs:
+
+  build_on_linux:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Check out repository code
+        uses: actions/checkout@v2
+        with:
+          persist-credentials: false
+          submodules: recursive
+      - name: Install FoundationDB
+        env:
+          FDB_VERSION: '6.2.30'
+        run: |
+          wget https://www.foundationdb.org/downloads/${FDB_VERSION}/ubuntu/installers/foundationdb-clients_${FDB_VERSION}-1_amd64.deb
+          wget https://www.foundationdb.org/downloads/${FDB_VERSION}/ubuntu/installers/foundationdb-server_${FDB_VERSION}-1_amd64.deb
+          sudo dpkg -i foundationdb-clients_${FDB_VERSION}-1_amd64.deb
+          sudo dpkg -i foundationdb-server_${FDB_VERSION}-1_amd64.deb
+      - name: Setup Erlang
+        uses: ./.github/actions/setup-beam
+        with:
+          otp-version: '24'
+          rebar3-version: '3.17'
+      - name: Compile
+        run: rebar3 compile
+      - name: EUnit tests
+        run: rebar3 eunit
+      - name: Setup tmate session on job failure
+        uses: ./.github/actions/tmate
+        if: ${{ failure() }}
+        with:
+          limit-access-to-actor: true
+
+  build_on_windows:
+    runs-on: windows-latest
+    env:
+      # Set to 1 for verbose rebar3 logging
+      DEBUG: 0
+      # Set to 1 for even more verbose rebar3 logging
+      DIAGNOSTIC: 0
+    steps:
+      - name: Check out repository code
+        uses: actions/checkout@v2
+        with:
+          persist-credentials: false
+          submodules: recursive
+      - name: Install FoundationDB
+        env:
+          FDB_VERSION: '6.2.30'
+        # Download FDB .msi, install it, and add FDB to the $env:Path for all future steps
+        run: |
+          Set-PSDebug -Trace 1
+          Invoke-WebRequest -Uri https://www.foundationdb.org/downloads/$env:FDB_VERSION/windows/installers/foundationdb-$env:FDB_VERSION-x64.msi -OutFile foundationdb-$env:FDB_VERSION-x64.msi
+          msiexec /i foundationdb-$env:FDB_VERSION-x64.msi /passive
+          echo "c:/Program Files/foundationdb/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
+      - name: Setup Erlang
+        uses: ./.github/actions/setup-beam
+        with:
+          otp-version: '24'
+          rebar3-version: '3.17'
+      - name: Setup MSVC toolchain
+        uses: ./.github/actions/msvc-dev-cmd
+      - name: Compile
+        run: rebar3 compile
+      - name: EUnit tests
+        env:
+          # This profile uses the FDB server started in the "Install FoundationDB" step
+          # instead of starting another one (the code that manages the "local" FDB in the
+          # test suite is not designed with x-platform compatibility in mind)
+          REBAR_PROFILE: win32_external_fdbserver
+        run: rebar3 eunit
+      - name: Setup tmate session on job failure
+        uses: ./.github/actions/tmate
+        if: ${{ failure() }}
+        with:
+          limit-access-to-actor: true
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..d705fad
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,9 @@
+[submodule ".github/actions/setup-beam"]
+	path = .github/actions/setup-beam
+	url = https://github.com/erlef/setup-beam
+[submodule ".github/actions/msvc-dev-cmd"]
+	path = .github/actions/msvc-dev-cmd
+	url = https://github.com/ilammy/msvc-dev-cmd
+[submodule ".github/actions/tmate"]
+	path = .github/actions/tmate
+	url = https://github.com/mxschmitt/action-tmate
diff --git a/README.md b/README.md
index fcbdf6d..30e34e2 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
 An Erlang Binding to FoundationDB
 ===
 
+[![CI](https://github.com/apache/couchdb-erlfdb/actions/workflows/ci.yml/badge.svg)](https://github.com/apache/couchdb-erlfdb/actions/workflows/ci.yml)
+
 This project is a NIF wrapper for the FoundationDB C API. Documentation on
 the main API can be found [here][fdb_docs].