Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4a9620c
Showing
23 changed files
with
682 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.eunit | ||
*.o | ||
*.beam | ||
*.plt | ||
erl_crash.dump | ||
ebin/*.beam | ||
.concrete/DEV_MODE | ||
.rebar | ||
_build | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
DOCKER = $(shell which docker) | ||
ifeq ($(DOCKER),) | ||
$(error "Docker not available on this system") | ||
endif | ||
|
||
DOCKER_COMPOSE = $(shell which docker-compose) | ||
ifeq ($(DOCKER_COMPOSE),) | ||
$(error "DockerCompose not available on this system") | ||
endif | ||
|
||
# use to override vars for your platform | ||
ifeq (env.mk,$(wildcard env.mk)) | ||
include env.mk | ||
endif | ||
|
||
all: build_imgs up tests rel | ||
|
||
build_imgs: | ||
@echo "Update docker images..." | ||
@${DOCKER_COMPOSE} build | ||
|
||
up: | ||
@${DOCKER_COMPOSE} up -d | ||
|
||
down: | ||
@${DOCKER_COMPOSE} down | ||
|
||
tests: | ||
@echo "Testing..." | ||
@${DOCKER_COMPOSE} exec test bash -c "cd /project && make -f sandbox.mk tests" | ||
|
||
rel: | ||
@echo "Build release..." | ||
@${DOCKER_COMPOSE} exec test bash -c "cd /project && make -f sandbox.mk prod" | ||
|
||
lint: | ||
@echo "Lint..." | ||
@${DOCKER_COMPOSE} exec test bash -c "cd /project && make -f sandbox.mk lint" | ||
|
||
xref: | ||
@echo "Xref analysis..." | ||
@${DOCKER_COMPOSE} exec test bash -c "cd /project && make -f sandbox.mk xref" | ||
|
||
dialyzer: | ||
@echo "Dialyzer..." | ||
@${DOCKER_COMPOSE} exec test bash -c "cd /project && make -f sandbox.mk dialyzer" | ||
|
||
upgrade_rebar: | ||
@${DOCKER_COMPOSE} exec test bash -c "cd /project && make -f sandbox.mk upgrade_rebar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# eapa | ||
Erlang Arbitrary Precision Arithmetics | ||
|
||
**release:** | ||
`rebar3 as prod release` | ||
|
||
**test:** | ||
`rebar3 as test ct` | ||
|
||
In Docker enviroment: | ||
* `make tests` - run tests | ||
* `make lint` - linter | ||
* `make xref` - xref analysis | ||
* `make prod` - generate release for target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## Name of the node | ||
-name eapa@127.0.0.1 | ||
|
||
## Cookie for distributed erlang | ||
-setcookie dev | ||
|
||
## Enable kernel poll and a few async threads | ||
##+K true | ||
##+A 5 | ||
|
||
## Increase number of concurrent ports/sockets | ||
##-env ERL_MAX_PORTS 4096 | ||
|
||
## Tweak GC to run more often | ||
##-env ERL_FULLSWEEP_AFTER 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
target/* | ||
.idea/* |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "eapa" | ||
version = "0.1.0" | ||
authors = ["Maxim Molchanov <m.molchanov@vonmo.com>"] | ||
license = "MIT/GPL" | ||
|
||
[lib] | ||
name = "eapa" | ||
crate-type = ["dylib"] | ||
|
||
[dependencies] | ||
erlang_nif-sys = "=0.6.4" | ||
lazy_static = "=1.1.*" | ||
rustler = "=0.18.0" | ||
rug = "=1.2.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#[macro_use] | ||
extern crate lazy_static; | ||
#[macro_use] | ||
extern crate rustler; | ||
|
||
use rustler::{Encoder, Env, NifResult, Term}; | ||
use rustler::resource::ResourceArc; | ||
use std::sync::RwLock; | ||
|
||
mod atoms { | ||
rustler_atoms! { | ||
atom ok; | ||
atom vn1; | ||
} | ||
} | ||
|
||
rustler_export_nifs!( | ||
"eapa", | ||
[ | ||
("lxcode", 0, lxcode), // library version code | ||
], | ||
Some(on_load) | ||
); | ||
|
||
fn on_load<'a>(env: Env<'a>, _load_info: Term<'a>) -> bool { | ||
true | ||
} | ||
|
||
fn lxcode<'a>(env: Env<'a>, _args: &[Term<'a>]) -> NifResult<Term<'a>> { | ||
Ok((atoms::ok(), atoms::vn1()).encode(env)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: '3.2' | ||
services: | ||
|
||
base: | ||
build: imgs/base | ||
|
||
test: | ||
image: eapa_base:latest | ||
depends_on: | ||
- base | ||
volumes: | ||
- "./:/project:Z" | ||
tmpfs: | ||
- /run | ||
- /tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
FROM elzor/erlang:20.3 AS erlang | ||
FROM rust:1.28 AS rust | ||
|
||
FROM debian:9.4 | ||
|
||
COPY --from=erlang /erl /erl | ||
ENV PATH=/erl/bin:$PATH | ||
|
||
COPY --from=rust /usr/local/rustup /usr/local/rustup | ||
COPY --from=rust /usr/local/cargo /usr/local/cargo | ||
|
||
ENV RUSTUP_HOME=/usr/local/rustup \ | ||
CARGO_HOME=/usr/local/cargo \ | ||
PATH=/usr/local/cargo/bin:$PATH | ||
|
||
RUN apt-get update \ | ||
&& apt-get install --no-install-recommends -y \ | ||
apt-transport-https \ | ||
wget \ | ||
curl \ | ||
build-essential \ | ||
git \ | ||
openssl \ | ||
libssl-dev \ | ||
libncurses5 \ | ||
libncurses5-dev \ | ||
xsltproc \ | ||
automake \ | ||
autoconf \ | ||
clang \ | ||
libclang-dev \ | ||
procps \ | ||
ca-certificates \ | ||
&& apt-get clean | ||
|
||
ADD ./docker-entry.sh /docker-entry.sh | ||
|
||
CMD ["/docker-entry.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
a=0 | ||
until [ ! $a -lt 10 ]; do | ||
sleep 1 | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.so |
Oops, something went wrong.