-
Notifications
You must be signed in to change notification settings - Fork 15
104 lines (89 loc) · 3.43 KB
/
Copy pathprecompile.yml
File metadata and controls
104 lines (89 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Build precompiled NIFs
on:
push:
tags: ['v*']
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { target: x86_64-linux-gnu, os: ubuntu-latest }
- { target: aarch64-linux-gnu, os: ubuntu-latest }
- { target: aarch64-macos-none, os: macos-15 }
- { target: x86_64-windows-gnu, os: windows-2022 }
steps:
- uses: actions/checkout@v4
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.16.0
- uses: erlef/setup-beam@v1
with:
otp-version: '27'
elixir-version: '1.18'
- name: Build NIF artifact
shell: bash
env:
ZIG_LOCAL_CACHE_DIR: ${{ runner.temp }}/zig-local-cache
ZIG_GLOBAL_CACHE_DIR: ${{ runner.temp }}/zig-global-cache
run: |
mix local.hex --force
mix local.rebar --force
mix deps.get
# Zigler 0.16.0's Hex package omitted its Windows compatibility
# headers. Remove this pinned workaround after Zigler PR #596 ships.
if [ "${{ matrix.target }}" = "x86_64-windows-gnu" ]; then
header_dir="deps/zigler/priv/erl_nif_win"
header_url="https://raw.githubusercontent.com/E-xyza/zigler/b83bd59b9fec5543ae712c1838cfa7f526a882c4/priv/erl_nif_win"
mkdir -p "$header_dir"
curl --fail --silent --show-error --location \
"$header_url/erl_nif_win.h" -o "$header_dir/erl_nif_win.h"
curl --fail --silent --show-error --location \
"$header_url/erl_nif_api_funcs_win.h" -o "$header_dir/erl_nif_api_funcs_win.h"
echo "ee0162831e553eb559c1b884ce461b100a0ff792c401a66be9e6b5ad00883a77 $header_dir/erl_nif_win.h" | sha256sum -c -
echo "dd43c4dd22fb6a158af420754fb8cb6c255e069d87e1c294d09f3e9f897345ef $header_dir/erl_nif_api_funcs_win.h" | sha256sum -c -
fi
QUICKBEAM_BUILD=1 mix zigler_precompiled.build lib/quickbeam/native.ex \
--target "${{ matrix.target }}" \
--out artifacts
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: artifacts/*.tar.gz
if-no-files-found: error
- name: Upload to release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: artifacts/*.tar.gz
smoke-windows:
needs: build
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: '27'
elixir-version: '1.18'
- uses: actions/download-artifact@v4
with:
name: x86_64-windows-gnu
path: artifacts
- name: Load the precompiled Windows NIF
shell: bash
env:
ZIGLER_PRECOMPILED_GLOBAL_CACHE_PATH: ${{ runner.temp }}/quickbeam-precompiled
run: |
mix local.hex --force
mix local.rebar --force
mix deps.get
mkdir -p "$ZIGLER_PRECOMPILED_GLOBAL_CACHE_PATH"
cp artifacts/*.tar.gz "$ZIGLER_PRECOMPILED_GLOBAL_CACHE_PATH/"
rm checksum-QuickBEAM.Native.exs
mix compile
mix run -e '{:ok, runtime} = QuickBEAM.start(apis: false); {:ok, 42} = QuickBEAM.eval(runtime, "40 + 2"); QuickBEAM.stop(runtime)'