Skip to content

Commit 2ed41d8

Browse files
authored
Merge pull request #74 from ocean/dev
Fix NIF compilation issues
2 parents 9362e44 + 804d230 commit 2ed41d8

3 files changed

Lines changed: 40 additions & 15 deletions

File tree

.github/workflows/release.yml

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ on:
55
tags:
66
- "v*"
77
workflow_dispatch:
8+
inputs:
9+
test_only:
10+
description: "Test run (skip publishing release)"
11+
required: false
12+
default: "false"
13+
type: choice
14+
options:
15+
- "false"
16+
- "true"
817

918
permissions:
1019
contents: write
@@ -19,11 +28,23 @@ jobs:
1928
nif: ["2.15"]
2029
job:
2130
- { target: aarch64-apple-darwin, os: macos-15 }
22-
- { target: x86_64-apple-darwin, os: macos-15-intel }
23-
- { target: aarch64-unknown-linux-gnu, os: ubuntu-24.04, use-cross: true }
24-
- { target: aarch64-unknown-linux-musl, os: ubuntu-24.04, use-cross: true }
31+
- { target: x86_64-apple-darwin, os: macos-15 }
32+
- {
33+
target: aarch64-unknown-linux-gnu,
34+
os: ubuntu-24.04,
35+
use-cross: true,
36+
}
37+
- {
38+
target: aarch64-unknown-linux-musl,
39+
os: ubuntu-24.04,
40+
use-cross: true,
41+
}
2542
- { target: x86_64-unknown-linux-gnu, os: ubuntu-24.04 }
26-
- { target: x86_64-unknown-linux-musl, os: ubuntu-24.04, use-cross: true }
43+
- {
44+
target: x86_64-unknown-linux-musl,
45+
os: ubuntu-24.04,
46+
use-cross: true,
47+
}
2748

2849
steps:
2950
- name: Checkout code
@@ -38,27 +59,27 @@ jobs:
3859
echo "::error::Failed to extract version from mix.exs"
3960
exit 1
4061
fi
41-
62+
4263
# Check if this is a tag push or workflow_dispatch
4364
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
4465
# Extract git tag from GITHUB_REF_NAME (e.g., "v0.8.10")
4566
GIT_TAG="${GITHUB_REF_NAME}"
46-
67+
4768
# Validate that git tag matches mix.exs version
4869
# Git tag should be v<version>, so strip the 'v' prefix for comparison
4970
TAG_VERSION="${GIT_TAG#v}"
50-
71+
5172
if [ "$VERSION" != "$TAG_VERSION" ]; then
5273
echo "::error::Version mismatch: mix.exs version is '$VERSION' but git tag is '$GIT_TAG' (without 'v': '$TAG_VERSION')"
5374
exit 1
5475
fi
55-
76+
5677
echo "✓ Version validation passed: mix.exs version '$VERSION' matches git tag '$GIT_TAG'"
5778
else
5879
# workflow_dispatch or other non-tag trigger
5980
echo "ℹ Using version from mix.exs: '$VERSION' (not a tag push)"
6081
fi
61-
82+
6283
echo "PROJECT_VERSION=$VERSION" >> $GITHUB_ENV
6384
6485
- name: Install Rust toolchain
@@ -69,16 +90,13 @@ jobs:
6990
- name: Build the project
7091
id: build-crate
7192
uses: philss/rustler-precompiled-action@v1.1.4
72-
env:
73-
CARGO_BUILD_TARGET: ${{ matrix.job.target }}
7493
with:
7594
project-name: ecto_libsql
7695
project-version: ${{ env.PROJECT_VERSION }}
7796
target: ${{ matrix.job.target }}
7897
nif-version: ${{ matrix.nif }}
79-
use-cross: ${{ matrix.job.use-cross }}
80-
cross-version: "from-source"
81-
project-dir: "native/ecto_libsql"
98+
use-cross: ${{ matrix.job.use-cross && 'true' || '' }}
99+
project-dir: "."
82100

83101
- name: Artifact upload
84102
uses: actions/upload-artifact@v6
@@ -91,4 +109,4 @@ jobs:
91109
with:
92110
files: |
93111
${{ steps.build-crate.outputs.file-path }}
94-
if: startsWith(github.ref, 'refs/tags/')
112+
if: startsWith(github.ref, 'refs/tags/') && inputs.test_only != 'true'

Cross.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Cross-compilation configuration for the `cross` tool.
2+
# See: https://hexdocs.pm/rustler_precompiled/precompilation_guide.html
3+
4+
[build.env]
5+
passthrough = [
6+
"RUSTLER_NIF_VERSION"
7+
]

0 commit comments

Comments
 (0)