Skip to content

chore: fail with more readable error if fdb is not installed #113

chore: fail with more readable error if fdb is not installed

chore: fail with more readable error if fdb is not installed #113

Workflow file for this run

name: CI
on:
push:
branches: [ main, dev ]
pull_request:
permissions:
contents: read
jobs:
eunit:
strategy:
matrix:
otp-version: ['25', '26']
fdb-version: ['7.3.27']
runs-on: ubuntu-22.04
env:
FDB_VERSION: ${{ matrix.fdb-version }}
# 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@v4
with:
persist-credentials: false
- name: Setup Erlang
uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp-version }}
rebar3-version: '3.17'
- name: Install FoundationDB
run: |
wget -q https://github.com/apple/foundationdb/releases/download/${FDB_VERSION}/foundationdb-clients_${FDB_VERSION}-1_amd64.deb
wget -q https://github.com/apple/foundationdb/releases/download/${FDB_VERSION}/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: Initialize FDB database
run: fdbcli --exec "configure tenant_mode=optional_experimental"
- name: Compile
run: rebar3 compile
- name: EUnit tests
run: rebar3 eunit
binding_tester:
runs-on: ubuntu-22.04
strategy:
matrix:
test-name: [api, directory, directory_hca, tuple]
api-version: [730]
container:
image: ghcr.io/emqx/couchdb-erlfdb:erlang-26-fdb-7.3.27
services:
foundationdb:
image: foundationdb/foundationdb:7.3.27
env:
REBAR_PROFILE: devcontainer
# 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@v4
with:
persist-credentials: false
- name: Compile erlfdb
run: rebar3 compile
- name: Create FDB cluster file
env:
# This needs to match the name of the service above so the script can do
# a DNS lookup to write down the coordinator IP in the fdb.cluster file
FDB_COORDINATOR: foundationdb
shell: bash
run: bash /usr/local/bin/create_cluster_file.bash
- name: Initialize FDB database
run: fdbcli --exec "configure new single ssd tenant_mode=optional_experimental"
- name: Execute unit tests
run: rebar3 eunit
- name: Execute binding test
env:
TEST_NAME: ${{ matrix.test-name }}
API_VERSION: ${{ matrix.api-version }}
COVER_ENABLED: true
ERL_LIBS: _build/devcontainer+test/lib/erlfdb/
run: |
mkdir -p /usr/src/erlfdb/test/
ln -s $GITHUB_WORKSPACE/test/tester.es /usr/src/erlfdb/test/tester.es
/usr/src/foundationdb/bindings/bindingtester/bindingtester.py erlang \
--test-name $TEST_NAME \
--api-version $API_VERSION \
--instruction-prefix $TEST_NAME \
--num-ops 10000
- name: Upload results to Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: bindingtest-${{ matrix.test-name }}-${{ matrix.api-version }}
run: rebar3 as test coveralls send
finalize_coverage_report:
needs: [binding_tester]
runs-on: ubuntu-latest
steps:
- name: Finalize Coveralls report
run: |
curl https://coveralls.io/webhook \
--header 'Content-Type: application/json' \
--data '{
"repo_name": "${{ github.repository }}",
"repo_token": "${{ secrets.GITHUB_TOKEN }}",
"payload": {
"build_num": ${{ github.run_number }},
"status": "done"
}
}'
macos:
strategy:
matrix:
otp-version: ['25', '26']
fdb-version: ['7.3.27']
runs-on: macos-14
env:
FDB_VERSION: ${{ matrix.fdb-version }}
# 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@v4
with:
persist-credentials: false
- name: Setup Erlang
run: |
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
brew install erlang@${{ matrix.otp-version }}
echo "$(brew --prefix erlang@${{ matrix.otp-version }})/bin" >> $GITHUB_PATH
wget https://s3.amazonaws.com/rebar3/rebar3
sudo mv rebar3 /usr/local/bin/ && sudo chmod +x /usr/local/bin/rebar3
export "PATH=$(brew --prefix erlang@${{ matrix.otp-version }})/bin:$PATH"
erl -eval 'erlang:display(erlang:system_info(system_version)),halt()'
- name: Install FoundationDB
run: |
wget -q https://github.com/apple/foundationdb/releases/download/${FDB_VERSION}/FoundationDB-${FDB_VERSION}_arm64.pkg
sudo installer -pkg FoundationDB-${FDB_VERSION}_arm64.pkg -target /
- name: Initialize FDB database
run: fdbcli --exec "configure tenant_mode=optional_experimental; status" --timeout 60
- name: Compile
run: rebar3 compile