Skip to content
Permalink
Browse files
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.
  • Loading branch information
kocolosk committed Nov 6, 2021
1 parent 68211f3 commit f4e7e2beddb988418724f5ed42949840a98f00a8
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 0 deletions.
Submodule msvc-dev-cmd added at 9f8ae8
Submodule setup-beam added at c255c7
Submodule tmate added at 80a9fa
@@ -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
@@ -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
@@ -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].

0 comments on commit f4e7e2b

Please sign in to comment.