You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2021/11/06 14:30:14 UTC
[couchdb-erlfdb] branch main updated (956920e -> f9a2f0f)
This is an automated email from the ASF dual-hosted git repository.
kocolosk pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-erlfdb.git.
from 956920e Make dialyzer happy (#32)
new 68211f3 Upgrade to rebar3, add Windows support
new f4e7e2b Enable CI using GitHub Actions
new f9a2f0f Restore ignores for rebar2 artifacts
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.github/actions/msvc-dev-cmd | 1 +
.github/actions/setup-beam | 1 +
.github/actions/tmate | 1 +
.github/workflows/ci.yml | 83 ++++++++++++++++++++++++++++++++++++++++
.gitignore | 12 ++++--
.gitmodules | 9 +++++
Makefile | 7 ++--
README.md | 2 +
enc | Bin 26053 -> 0 bytes
rebar.config | 33 +++++++++++++---
rebar.lock | 1 +
src/erlfdb_util.erl | 3 +-
win32_external_fdbserver.config | 5 +++
13 files changed, 144 insertions(+), 14 deletions(-)
create mode 160000 .github/actions/msvc-dev-cmd
create mode 160000 .github/actions/setup-beam
create mode 160000 .github/actions/tmate
create mode 100644 .github/workflows/ci.yml
create mode 100644 .gitmodules
delete mode 100755 enc
create mode 100644 rebar.lock
create mode 100644 win32_external_fdbserver.config
[couchdb-erlfdb] 03/03: Restore ignores for rebar2 artifacts
Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kocolosk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-erlfdb.git
commit f9a2f0f70a7d64d14ff976e967420c3f21af783a
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Sat Nov 6 10:27:44 2021 -0400
Restore ignores for rebar2 artifacts
---
.gitignore | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.gitignore b/.gitignore
index a928261..c7b7b0c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,7 @@ c_src/*.d
c_src/*.o
priv/erlfdb_nif.*
_build/
+
+# Artifacts when an umbrella app (e.g. CouchDB) builds erlfdb using rebar2
+.rebar/
+ebin/
[couchdb-erlfdb] 01/03: Upgrade to rebar3, add Windows support
Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kocolosk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-erlfdb.git
commit 68211f31c26d4a42d27e59827a6507be7cbc2dc9
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Tue Nov 2 16:34:37 2021 -0400
Upgrade to rebar3, add Windows support
This patch updates erlfdb to build using rebar3. It relies on rebar3's
`pc` plugin to build the NIF instead of the compiled copy of davisp's
erlang-native-compiler, which does essentially the same thing. I left
the rebar_gdb_plugin code in the repo, although I did not update that
plugin to make it compatible with rebar3 yet.
With rebar3 in place, I also made the changes necessary to support
Windows. One gotcha is that the unit tests will fail unless you set
the erlfdb test_cluster_file environment variable to point to a running
fdb.cluster file. I didn't get through all the hoops to make the
approach of spinning up an embedded fdbserver work in a x-platform way.
Apparently Windows doesn't let you supply a Python script for the
spawn_executable argument of erlang:open_port/2. I added a rebar3
profile to help here. The following command will cause the test suite
to connect to an FDB server that is managing its configuration in the
default location on Windows:
rebar3 as win32_external_fdbserver eunit
---
.gitignore | 8 ++++----
Makefile | 7 ++++---
enc | Bin 26053 -> 0 bytes
rebar.config | 33 +++++++++++++++++++++++++++------
rebar.lock | 1 +
src/erlfdb_util.erl | 3 ++-
win32_external_fdbserver.config | 5 +++++
7 files changed, 43 insertions(+), 14 deletions(-)
diff --git a/.gitignore b/.gitignore
index 6782584..a928261 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,12 +1,12 @@
-
+# Unit testing
+.erlfdb/
.eunit/
-.rebar/
compile_commands.json
erln8.config
+# Build artifacts
c_src/*.d
c_src/*.o
-ebin/
-
priv/erlfdb_nif.*
+_build/
diff --git a/Makefile b/Makefile
index b6752bc..5f9396e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,11 @@
all: check
build:
- rebar compile
+ @rebar3 compile
check: build
- rebar eunit
+ @rebar3 eunit
clean:
- rebar clean
+ @rebar3 clean
+ @rm -rf _build
diff --git a/enc b/enc
deleted file mode 100755
index 5338498..0000000
Binary files a/enc and /dev/null differ
diff --git a/rebar.config b/rebar.config
index fb60112..617594c 100644
--- a/rebar.config
+++ b/rebar.config
@@ -1,22 +1,43 @@
+{plugins, [
+ pc
+]}.
+
+{provider_hooks, [
+ {pre, [
+ {compile, {pc, compile}},
+ {clean, {pc, clean}}
+ ]}
+]}.
+
{port_specs, [
{"priv/erlfdb_nif.so", ["c_src/*.c"]}
]}.
-{plugins, [rebar_gdb_plugin]}.
-
{port_env, [
{"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)",
"CFLAGS", "$CFLAGS -I/usr/local/include -Ic_src/ -g -Wall -Werror"},
{"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)",
"CXXFLAGS", "$CXXFLAGS -I/usr/local/include -Ic_src/ -g -Wall -Werror"},
+ {"win32",
+ "CFLAGS", "$CFLAGS /I\"c:/Program Files/foundationdb/include\" /O2 /DNDEBUG"},
+ {"win32",
+ "CXXFLAGS", "$CXXFLAGS /I\"c:/Program Files/foundationdb/include\" /O2 /DNDEBUG"},
{"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)",
- "LDFLAGS", "$LDFLAGS -L/usr/local/lib -lfdb_c"}
+ "LDFLAGS", "$LDFLAGS -L/usr/local/lib -lfdb_c"},
+ {"win32",
+ "LDFLAGS", "$LDFLAGS /LIBPATH:\"c:/Program Files/foundationdb/lib/foundationdb\" fdb_c.lib"}
+]}.
+
+{profiles, [
+ {win32_external_fdbserver, [
+ {eunit_opts, [
+ {sys_config, "win32_external_fdbserver.config"}
+ ]}
+ ]}
]}.
{eunit_opts, [
+ debug_info,
verbose
]}.
-
-{pre_hooks, [{"", compile, "escript enc compile"}]}.
-{post_hooks, [{"", clean, "escript enc clean"}]}.
diff --git a/rebar.lock b/rebar.lock
new file mode 100644
index 0000000..57afcca
--- /dev/null
+++ b/rebar.lock
@@ -0,0 +1 @@
+[].
diff --git a/src/erlfdb_util.erl b/src/erlfdb_util.erl
index 58fa12d..30c427a 100644
--- a/src/erlfdb_util.erl
+++ b/src/erlfdb_util.erl
@@ -215,9 +215,10 @@ init_fdb_db(ClusterFile, Options) ->
DefaultFDBCli = os:find_executable("fdbcli"),
FDBCli = case ?MODULE:get(Options, fdbcli_bin, DefaultFDBCli) of
false -> erlang:error(fdbcli_not_found);
+ DefaultFDBCli -> "fdbcli";
FDBCli0 -> FDBCli0
end,
- Fmt = "~s -C ~s --exec 'configure new single ssd'",
+ Fmt = "~s -C ~s --exec \"configure new single ssd\"",
Cmd = lists:flatten(io_lib:format(Fmt, [FDBCli, ClusterFile])),
case os:cmd(Cmd) of
"Database created" ++ _ -> ok;
diff --git a/win32_external_fdbserver.config b/win32_external_fdbserver.config
new file mode 100644
index 0000000..3ca1c6f
--- /dev/null
+++ b/win32_external_fdbserver.config
@@ -0,0 +1,5 @@
+[
+ {erlfdb, [
+ {test_cluster_file, <<"c:/ProgramData/foundationdb/fdb.cluster">>}
+ ]}
+].
[couchdb-erlfdb] 02/03: Enable CI using GitHub Actions
Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kocolosk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-erlfdb.git
commit f4e7e2beddb988418724f5ed42949840a98f00a8
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Tue Nov 2 16:42:51 2021 -0400
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.
---
.github/actions/msvc-dev-cmd | 1 +
.github/actions/setup-beam | 1 +
.github/actions/tmate | 1 +
.github/workflows/ci.yml | 83 ++++++++++++++++++++++++++++++++++++++++++++
.gitmodules | 9 +++++
README.md | 2 ++
6 files changed, 97 insertions(+)
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
===
+[](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].