-
Notifications
You must be signed in to change notification settings - Fork 9
67 lines (54 loc) · 1.82 KB
/
precompile.yml
File metadata and controls
67 lines (54 loc) · 1.82 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
name: Build precompiled NIFs
on:
push:
tags: ['v*']
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-macos-none, os: macos-latest }
steps:
- uses: actions/checkout@v4
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.15.2
- uses: erlef/setup-beam@v1
with:
otp-version: '27'
elixir-version: '1.18'
- name: Build NIF
run: |
mix local.hex --force
mix local.rebar --force
mix deps.get
QUICKBEAM_BUILD=1 mix compile
- name: Package artifact
run: |
VERSION=${GITHUB_REF#refs/tags/v}
BASENAME="Elixir.QuickBEAM.Native"
# Find the built library (could be .so or .dylib)
LIB_FILE=$(find priv/lib -name "*${BASENAME}.*" \
\( -name "*.so" -o -name "*.dylib" \) \
-not -name "*.[0-9]*" | sort | head -1)
if [ -z "$LIB_FILE" ]; then
echo "ERROR: Could not find built library"
find priv/lib -type f | head -20
exit 1
fi
echo "Found: ${LIB_FILE}"
# ZiglerPrecompiled expects: Elixir.QuickBEAM.Native-v0.5.0-target.so.tar.gz
# The .so extension is always used in the tar name, even for .dylib
mkdir -p artifacts
ARTIFACT_NAME="${BASENAME}-v${VERSION}-${{ matrix.target }}.so.tar.gz"
tar czf "artifacts/${ARTIFACT_NAME}" -C "$(dirname "$LIB_FILE")" "$(basename "$LIB_FILE")"
echo "Packaged: ${ARTIFACT_NAME}"
- name: Upload to release
uses: softprops/action-gh-release@v1
with:
files: artifacts/*.tar.gz