-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (77 loc) · 2.84 KB
/
release.yml
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
name: Compile & Upload NIFs
on:
push:
branches:
- main
paths:
- "native/**"
- ".github/workflows/release.yml"
tags:
- "*"
pull_request:
paths:
- ".github/workflows/release.yml"
workflow_dispatch:
jobs:
compile_nifs:
name: ${{ matrix.job.platform }} (NIF ${{ matrix.nif }})
runs-on: ${{ matrix.job.os }}
permissions:
contents: write
id-token: write
strategy:
fail-fast: false
matrix:
nif: ["2.16"]
job:
- { target: aarch64-apple-darwin, os: macos-13, platform: "macOS (ARM64)" }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04, use-cross: true, platform: "Linux (ARM64)" }
- { target: x86_64-apple-darwin, os: macos-13, platform: "MacOS (x86_64)" }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04, platform: "Linux (x86_64, default)" }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04, platform: "Linux (x86_64, legacy)", variant: "legacy_cpu" }
#- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04, use-cross: true, platform: "Linux (musl, static)" }
env:
EXSTATIC_BUILD: true # Ensure RustlerPrecompiled forces a build
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.job.target }}
- name: Install Cross for cross-compilation
if: ${{ matrix.job.use-cross }}
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Extract project version
shell: bash
run: |
echo "PROJECT_VERSION=$(sed -n 's/^ @version "\(.*\)"/\1/p' mix.exs | head -n1)" >> $GITHUB_ENV
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v0-precomp
shared-key: ${{ matrix.job.target }}-${{ matrix.nif }}
workspaces: |
native/exstatic
- name: Compile the NIFs
id: build-crate
uses: philss/rustler-precompiled-action@v1.1.4
with:
project-name: exstatic
project-version: ${{ env.PROJECT_VERSION }}
target: ${{ matrix.job.target }}
nif-version: ${{ matrix.nif }}
use-cross: ${{ matrix.job.use-cross }}
variant: ${{ matrix.job.variant }}
project-dir: "native/exstatic"
- name: Upload compiled NIF artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build-crate.outputs.file-name }}
path: ${{ steps.build-crate.outputs.file-path }}
- name: Publish NIFs to GitHub Releases
uses: softprops/action-gh-release@v2
with:
files: |
${{ steps.build-crate.outputs.file-path }}
if: startsWith(github.ref, 'refs/tags/')