Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/erlang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,42 @@ jobs:
run: make
- name: Check
run: make check

build-bazel:
runs-on: ubuntu-latest
strategy:
matrix:
erlang_version:
- "23.2"
- "24.0"
steps:
- name: CHECKOUT
uses: actions/checkout@v2
- name: CONFIGURE ERLANG
uses: gleam-lang/setup-erlang@v1.1.2
with:
otp-version: ${{ matrix.erlang_version }}
- name: CONFIGURE BAZEL
run: |
ERLANG_HOME="$(dirname $(dirname $(which erl)))"
cat << EOF >> .bazelrc
build --@bazel-erlang//:erlang_version=${{ matrix.erlang_version }}
build --@bazel-erlang//:erlang_home=${ERLANG_HOME}

build --incompatible_strict_action_env

build --test_strategy=exclusive
EOF
- name: TEST
run: |
bazelisk test //...
- name: RESOVLE TEST LOGS PATH
run: |
echo "::set-output name=LOGS_PATH::$(readlink -f bazel-testlogs)"
id: resolve-test-logs-path
- name: CAPTURE TEST LOGS ON FAILURE
uses: actions/upload-artifact@v2-preview
if: failure()
with:
name: bazel-testlogs-${{ matrix.erlang_version }}
path: ${{ steps.resolve-test-logs-path.outputs.LOGS_PATH }}/*
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ osiris.d
*.d

*.jar

/.bazelrc
/bazel-*
63 changes: 63 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
load(
"@bazel-erlang//:bazel_erlang_lib.bzl",
"erlang_lib",
"test_erlang_lib",
)
load("@bazel-erlang//:xref.bzl", "xref")
load("@bazel-erlang//:dialyze.bzl", "dialyze", "plt")
load("@bazel-erlang//:ct_sharded.bzl", "ct_suite")

NAME = "osiris"

VERSION = "0.1.0"

APP_ENV = """[
{data_dir, "/tmp/osiris"},
{port_range, {6000, 6500}},
{max_segment_size_chunks, 256000}
]"""

EXTRA_APPS = [
"sasl",
"crypto",
]

DEPS = [
"@gen_batch_server//:bazel_erlang_lib",
]

RUNTIME_DEPS = [
"@seshat//:bazel_erlang_lib",
]

erlang_lib(
app_env = APP_ENV,
app_name = NAME,
app_version = VERSION,
extra_apps = EXTRA_APPS,
runtime_deps = RUNTIME_DEPS,
deps = DEPS,
)

test_erlang_lib(
app_env = APP_ENV,
app_name = NAME,
app_version = VERSION,
extra_apps = EXTRA_APPS,
runtime_deps = RUNTIME_DEPS,
deps = DEPS,
)

xref()

plt(
name = "base_plt",
)

dialyze(
plt = ":base_plt",
)

[ct_suite(
name = f.replace("test/", "").replace(".erl", ""),
) for f in glob(["test/*_SUITE.erl"])]
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ dep_looking_glass = git https://github.com/rabbitmq/looking-glass.git master
DIALYZER_OPTS += --src -r test
EUNIT_OPTS = no_tty, {report, {eunit_progress, [colored, profile]}}
include $(if $(ERLANG_MK_FILENAME),$(ERLANG_MK_FILENAME),erlang.mk)

include mk/bazel.mk
32 changes: 32 additions & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "bazel-erlang",
sha256 = "422a9222522216f59a01703a13f578c601d6bddf5617bee8da3c43e3b299fc4e",
strip_prefix = "bazel-erlang-1.1.0",
urls = ["https://github.com/rabbitmq/bazel-erlang/archive/refs/tags/1.1.0.zip"],
)

load("@bazel-erlang//:bazel_erlang.bzl", "bazel_erlang_deps")

bazel_erlang_deps()

load("@bazel-erlang//:github.bzl", "github_bazel_erlang_lib")
load("@bazel-erlang//:hex_pm.bzl", "hex_pm_bazel_erlang_lib")

hex_pm_bazel_erlang_lib(
name = "gen_batch_server",
sha256 = "b78679349168f27d7047f3283c9d766760b234d98c762aca9a1907f4ee3fd406",
version = "0.8.6",
)

github_bazel_erlang_lib(
name = "seshat",
extra_apps = [
"sasl",
"crypto",
],
org = "rabbitmq",
ref = "main",
version = "main",
)
12 changes: 12 additions & 0 deletions mk/bazel.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
define BAZELRC
build --@bazel-erlang//:erlang_home=$(shell dirname $$(dirname $$(which erl)))
build --@bazel-erlang//:erlang_version=$(shell erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell)

build --incompatible_strict_action_env

build --test_strategy=exclusive
endef

export BAZELRC
.bazelrc:
echo "$$BAZELRC" > $@