Skip to content

Commit f236e42

Browse files
authored
Elixir SDK (#208)
1 parent 30a0062 commit f236e42

34 files changed

+3794
-10
lines changed

.changeset/light-socks-wait.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eppo_core": minor
3+
---
4+
5+
Adds elixir support for VariationType

.github/workflows/elixir.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
name: Elixir SDK
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- 'elixir-sdk/**'
10+
- 'eppo_core/**'
11+
- 'sdk-test-data/**'
12+
- 'mock-server/**'
13+
- 'package-lock.json'
14+
- 'package.json'
15+
pull_request:
16+
paths:
17+
- 'elixir-sdk/**'
18+
- 'eppo_core/**'
19+
- 'sdk-test-data/**'
20+
- 'mock-server/**'
21+
- 'package-lock.json'
22+
- 'package.json'
23+
24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.ref }}
26+
cancel-in-progress: true
27+
28+
jobs:
29+
elixir_test:
30+
runs-on: ${{ matrix.os }}-latest
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
include:
35+
# Elixir 1.18 with OTP 26 and 27
36+
- os: ubuntu
37+
elixir: '1.18'
38+
otp: '26.0'
39+
- os: ubuntu
40+
elixir: '1.18'
41+
otp: '27.0'
42+
# Elixir 1.17 with OTP 26 and 27
43+
- os: ubuntu
44+
elixir: '1.17'
45+
otp: '26.0'
46+
- os: ubuntu
47+
elixir: '1.17'
48+
otp: '27.0'
49+
# Elixir 1.16 with OTP 26 only
50+
- os: ubuntu
51+
elixir: '1.16'
52+
otp: '26.0'
53+
# Elixir 1.15 with OTP 26 only
54+
- os: ubuntu
55+
elixir: '1.15'
56+
otp: '26.0'
57+
58+
steps:
59+
- uses: actions/checkout@v4
60+
with:
61+
submodules: true
62+
63+
- name: Set up Elixir & Rust
64+
uses: erlef/setup-beam@v1
65+
with:
66+
elixir-version: ${{ matrix.elixir }}
67+
otp-version: ${{ matrix.otp }}
68+
69+
- name: Set up Rust
70+
uses: dtolnay/rust-toolchain@stable
71+
72+
- name: Cache Rust dependencies
73+
uses: Swatinem/rust-cache@v2
74+
75+
- name: Cache Mix dependencies
76+
uses: actions/cache@v3
77+
with:
78+
path: |
79+
deps
80+
_build
81+
key: ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('**/mix.lock') }}
82+
restore-keys: |
83+
${{ runner.os }}-mix-
84+
85+
- run: npm ci
86+
87+
- name: Override eppo_core for testing
88+
run: |
89+
mkdir -p ~/.cargo/
90+
echo "[patch.crates-io.eppo_core]" >> "${CARGO_HOME:-$HOME/.cargo}/config.toml"
91+
echo "path = '$PWD/eppo_core'" >> "${CARGO_HOME:-$HOME/.cargo}/config.toml"
92+
93+
- name: Install dependencies
94+
run: mix deps.get
95+
working-directory: elixir-sdk
96+
97+
- name: Compile
98+
run: mix compile
99+
working-directory: elixir-sdk
100+
101+
- name: Run tests
102+
run: npm run with-server test:elixir

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Eppo is a modular flagging and experimentation analysis tool. Eppo's SDKs are bu
2323

2424
1. Install [rustup](https://rustup.rs/).
2525
2. Install Ruby using your preferred package manager.
26+
3. To run tests, load the `sdk-test-data` submodule: `git submodule update --init --recursive`
2627

2728
### Release process
2829

elixir-sdk/.cargo/config.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[target.'cfg(target_os = "macos")']
2+
rustflags = [
3+
"-C", "link-arg=-undefined",
4+
"-C", "link-arg=dynamic_lookup",
5+
]

elixir-sdk/.formatter.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Used by "mix format"
2+
[
3+
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
4+
]

elixir-sdk/.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where third-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# Ignore .fetch files in case you like to edit your project deps locally.
14+
/.fetch
15+
16+
# If the VM crashes, it generates a dump, let's ignore it too.
17+
erl_crash.dump
18+
19+
# Also ignore archive artifacts (built via "mix archive.build").
20+
*.ez
21+
22+
# Ignore package tarball (built via "mix hex.build").
23+
eppo_sdk-*.tar
24+
25+
# Temporary files, for example, from tests.
26+
/tmp/
27+
28+
# Rust binary artifacts
29+
/target/

0 commit comments

Comments
 (0)