Skip to content

Commit 2bd718e

Browse files
cigraingerclaude
andcommitted
Fix precompile workflow: runners, NIF features, musl config
- macos-15-intel for x86_64, macos-15 for aarch64 (macos-13 retired) - Add nif_version_2_15 features to Cargo.toml (required since rustler 0.30) - Add .cargo/config.toml for musl target (disable static CRT) - Single NIF version (2.15, forward-compatible with 2.16/2.17) - Use philss/rustler-precompiled-action@v1.1.5 - Upload directly to release per job (no separate release job) - Based on philss/rustler_precompilation_example canonical workflow Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 25234a3 commit 2bd718e

3 files changed

Lines changed: 48 additions & 40 deletions

File tree

‎.github/workflows/precompile.yml‎

Lines changed: 37 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,65 @@
1-
name: Precompile NIFs
1+
name: Build precompiled NIFs
2+
23
on:
34
push:
45
tags:
56
- "v*"
67

7-
permissions:
8-
contents: write
9-
108
jobs:
11-
build_nif:
12-
name: NIF ${{ matrix.nif }} - ${{ matrix.job.target }}
9+
build_release:
10+
name: NIF ${{ matrix.nif }} - ${{ matrix.job.target }} (${{ matrix.job.os }})
1311
runs-on: ${{ matrix.job.os }}
12+
permissions:
13+
contents: write
14+
id-token: write
15+
attestations: write
1416
strategy:
1517
fail-fast: false
1618
matrix:
17-
nif: ["2.15", "2.16", "2.17"]
19+
nif: ["2.15"]
1820
job:
19-
- { target: aarch64-apple-darwin, os: macos-14 }
20-
- { target: x86_64-apple-darwin, os: macos-13 }
21-
- { target: x86_64-unknown-linux-gnu, os: ubuntu-22.04 }
22-
- { target: x86_64-unknown-linux-musl, os: ubuntu-22.04 }
23-
- { target: aarch64-unknown-linux-gnu, os: ubuntu-22.04 }
24-
- { target: aarch64-unknown-linux-musl, os: ubuntu-22.04 }
25-
- { target: x86_64-pc-windows-msvc, os: windows-2022 }
21+
- { target: aarch64-apple-darwin, os: macos-15 }
22+
- { target: x86_64-apple-darwin, os: macos-15-intel }
23+
- { target: x86_64-unknown-linux-gnu, os: ubuntu-22.04 }
24+
- { target: x86_64-unknown-linux-musl, os: ubuntu-22.04, use-cross: true }
25+
- { target: aarch64-unknown-linux-gnu, os: ubuntu-22.04, use-cross: true }
26+
- { target: aarch64-unknown-linux-musl, os: ubuntu-22.04, use-cross: true }
27+
- { target: x86_64-pc-windows-msvc, os: windows-2022 }
2628

2729
steps:
28-
- uses: actions/checkout@v4
30+
- name: Checkout source code
31+
uses: actions/checkout@v4
2932

30-
- name: Extract version
33+
- name: Extract project version
3134
shell: bash
3235
run: |
33-
VERSION=$(grep '@version "' mix.exs | cut -d'"' -f2)
34-
echo "PROJECT_VERSION=$VERSION" >> $GITHUB_ENV
36+
echo "PROJECT_VERSION=$(sed -n 's/^ @version "\(.*\)"/\1/p' mix.exs | head -n1)" >> $GITHUB_ENV
37+
38+
- name: Install Rust toolchain
39+
uses: dtolnay/rust-toolchain@stable
40+
with:
41+
target: ${{ matrix.job.target }}
3542

36-
- name: Build NIF
37-
id: build
38-
uses: philss/rustler-precompiled-action@v1.1.4
43+
- name: Build the project
44+
id: build-crate
45+
uses: philss/rustler-precompiled-action@v1.1.5
3946
with:
4047
project-name: simdxml_nif
4148
project-version: ${{ env.PROJECT_VERSION }}
4249
target: ${{ matrix.job.target }}
4350
nif-version: ${{ matrix.nif }}
44-
use-cross: ${{ matrix.job.os == 'ubuntu-22.04' && matrix.job.target != 'x86_64-unknown-linux-gnu' }}
45-
project-dir: native/simdxml_nif
51+
use-cross: ${{ matrix.job.use-cross }}
52+
project-dir: "native/simdxml_nif"
4653

47-
- name: Upload artifact
54+
- name: Artifact upload
4855
uses: actions/upload-artifact@v4
4956
with:
50-
name: ${{ steps.build.outputs.file-name }}
51-
path: ${{ steps.build.outputs.file-path }}
52-
53-
release:
54-
needs: build_nif
55-
runs-on: ubuntu-latest
56-
steps:
57-
- uses: actions/checkout@v4
58-
59-
- uses: actions/download-artifact@v4
60-
with:
61-
path: artifacts
62-
merge-multiple: true
57+
name: ${{ steps.build-crate.outputs.file-name }}
58+
path: ${{ steps.build-crate.outputs.file-path }}
6359

64-
- name: Create GitHub Release
60+
- name: Publish archives and packages
6561
uses: softprops/action-gh-release@v2
6662
with:
67-
files: artifacts/*
68-
generate_release_notes: true
63+
files: |
64+
${{ steps.build-crate.outputs.file-path }}
65+
if: startsWith(github.ref, 'refs/tags/')
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[target.x86_64-unknown-linux-musl]
2+
rustflags = ["-C", "target-feature=-crt-static"]
3+
4+
[target.aarch64-unknown-linux-musl]
5+
rustflags = ["-C", "target-feature=-crt-static"]

‎native/simdxml_nif/Cargo.toml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ edition = "2021"
77
name = "simdxml_nif"
88
crate-type = ["cdylib"]
99

10+
[features]
11+
default = ["nif_version_2_15"]
12+
nif_version_2_15 = ["rustler/nif_version_2_15"]
13+
nif_version_2_16 = ["rustler/nif_version_2_16"]
14+
nif_version_2_17 = ["rustler/nif_version_2_17"]
15+
1016
[dependencies]
1117
rustler = "0.37"
1218
simdxml = "0.2.1"

0 commit comments

Comments
 (0)