Skip to content

Commit 1194f49

Browse files
committed
Add rustler precompiled
1 parent ded8d53 commit 1194f49

File tree

5 files changed

+397
-42
lines changed

5 files changed

+397
-42
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@ name: Build precompiled NIFs
22

33
on:
44
push:
5-
branches:
6-
- main
7-
paths:
8-
# Just run on main branch if "native" path changed. Tags will always run.
9-
- "native/**"
10-
# Also run in case there is any changes to this file.
11-
- ".github/workflows/release.yml"
125
tags:
136
- "*"
147

@@ -81,7 +74,7 @@ jobs:
8174
use-cross: ${{ matrix.job.use-cross }}
8275

8376
- name: Artifact upload
84-
uses: actions/upload-artifact@v3
77+
uses: actions/upload-artifact@v4
8578
with:
8679
name: ${{ steps.build-crate.outputs.file-name }}
8780
path: ${{ steps.build-crate.outputs.file-path }}

RELEASE.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# How to release
2+
3+
Because we use
4+
[`RustlerPrecompiled`](https://hexdocs.pm/rustler_precompiled/RustlerPrecompiled.html), releasing
5+
is a bit more involved than it would be otherwise.
6+
7+
1. Cut a GitHub release and tag the commit with the version number.
8+
2. This will kick off the "Build precompiled NIFs" GitHub Action. Wait for this to complete. It
9+
usually takes around 40-60 minutes.
10+
3. While the NIFs are compiling, ensure you have the latest version of `main` and don't have any
11+
intermediate builds by running `rm -rf native/ex_tokenizers/target`.
12+
4. Once the NIFs are built, use `mix rustler_precompiled.download BamlElixir.Native --all --print` to download generate the checksum file.
13+
5. Run `mix hex.publish`.
14+
6. Bump the version in the `mix.exs` and add the `-dev` flag to it.

mix.exs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ defmodule BamlElixir.MixProject do
88
elixir: "~> 1.17",
99
start_permanent: Mix.env() == :prod,
1010
deps: deps(),
11-
aliases: aliases()
11+
package: package()
1212
]
1313
end
1414

@@ -22,14 +22,23 @@ defmodule BamlElixir.MixProject do
2222
# Run "mix help deps" to learn about dependencies.
2323
defp deps do
2424
[
25-
{:rustler, "~> 0.36.1", runtime: false}
25+
{:rustler, "~> 0.36.1", optional: true},
26+
{:rustler_precompiled, "~> 0.8"}
2627
]
2728
end
2829

29-
defp aliases do
30+
defp package do
3031
[
31-
# Add any custom mix aliases here
32-
"baml.generate": ["compile", "baml.generate"]
32+
files: [
33+
"lib",
34+
"native",
35+
"checksum-*.exs",
36+
"mix.exs",
37+
"LICENSE"
38+
],
39+
licenses: ["Apache-2.0"],
40+
links: %{"GitHub" => "https://github.com/emilsoman/baml_elixir"},
41+
maintainers: ["Emil Soman"]
3342
]
3443
end
3544
end

mix.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
%{
2+
"castore": {:hex, :castore, "1.0.12", "053f0e32700cbec356280c0e835df425a3be4bc1e0627b714330ad9d0f05497f", [:mix], [], "hexpm", "3dca286b2186055ba0c9449b4e95b97bf1b57b47c1f2644555879e659960c224"},
23
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
34
"rustler": {:hex, :rustler, "0.36.1", "2d4b1ff57ea2789a44756a40dbb5fbb73c6ee0a13d031dcba96d0a5542598a6a", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:toml, "~> 0.7", [hex: :toml, repo: "hexpm", optional: false]}], "hexpm", "f3fba4ad272970e0d1bc62972fc4a99809651e54a125c5242de9bad4574b2d02"},
5+
"rustler_precompiled": {:hex, :rustler_precompiled, "0.8.2", "5f25cbe220a8fac3e7ad62e6f950fcdca5a5a5f8501835d2823e8c74bf4268d5", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:rustler, "~> 0.23", [hex: :rustler, repo: "hexpm", optional: true]}], "hexpm", "63d1bd5f8e23096d1ff851839923162096364bac8656a4a3c00d1fff8e83ee0a"},
46
"toml": {:hex, :toml, "0.7.0", "fbcd773caa937d0c7a02c301a1feea25612720ac3fa1ccb8bfd9d30d822911de", [:mix], [], "hexpm", "0690246a2478c1defd100b0c9b89b4ea280a22be9a7b313a8a058a2408a2fa70"},
57
}

0 commit comments

Comments
 (0)