-
Notifications
You must be signed in to change notification settings - Fork 2
Feature rustler precompiled #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
433f2ce
feat: add rustler_precompiled support for prebuilt NIF binaries
ricardo-valero a7f6e7a
fix: address PR review feedback and remove unrelated .gitignore change
ricardo-valero a065abb
fix: NIF build workflow - ensure target-specific Cargo output directo…
ocean 015286f
fix: CI builds from source, doesn't depend on precompiled NIFs
ocean 688d6e8
refactor: Release workflow triggers only on version tags and manual d…
ocean 9cc9276
feat: Validate git tag matches mix.exs version before building release
ocean f5765f9
Merge branch 'main' into feature-rustler-precompiled
ocean 460c8e4
Merge branch 'feature-rustler-precompiled' of https://github.com/ocea…
ocean 1a8d4e6
chore: Check release tagging to verify whether it's a tag or non-tag …
ocean File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ on: | |
| env: | ||
| CARGO_TERM_COLOR: always | ||
| MIX_ENV: test | ||
| ECTO_LIBSQL_BUILD: "true" | ||
|
|
||
| jobs: | ||
| rust-checks: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| name: Build Precompiled NIFs | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v*" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| build_release: | ||
| name: NIF ${{ matrix.nif }} - ${{ matrix.job.target }} (${{ matrix.job.os }}) | ||
| runs-on: ${{ matrix.job.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| nif: ["2.15"] | ||
| job: | ||
| - { target: aarch64-apple-darwin, os: macos-15 } | ||
| - { target: x86_64-apple-darwin, os: macos-15-intel } | ||
| - { target: aarch64-unknown-linux-gnu, os: ubuntu-24.04, use-cross: true } | ||
| - { target: aarch64-unknown-linux-musl, os: ubuntu-24.04, use-cross: true } | ||
| - { target: x86_64-unknown-linux-gnu, os: ubuntu-24.04 } | ||
| - { target: x86_64-unknown-linux-musl, os: ubuntu-24.04, use-cross: true } | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Extract and validate project version | ||
| shell: bash | ||
| run: | | ||
| # Extract version from mix.exs @version attribute | ||
| VERSION=$(sed -n 's/^[[:space:]]*@version "\(.*\)"/\1/p' mix.exs | head -n1) | ||
| if [ -z "$VERSION" ]; then | ||
| echo "::error::Failed to extract version from mix.exs" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Check if this is a tag push or workflow_dispatch | ||
| if [[ "$GITHUB_REF" == refs/tags/* ]]; then | ||
| # Extract git tag from GITHUB_REF_NAME (e.g., "v0.8.10") | ||
| GIT_TAG="${GITHUB_REF_NAME}" | ||
|
|
||
| # Validate that git tag matches mix.exs version | ||
| # Git tag should be v<version>, so strip the 'v' prefix for comparison | ||
| TAG_VERSION="${GIT_TAG#v}" | ||
|
|
||
| if [ "$VERSION" != "$TAG_VERSION" ]; then | ||
| echo "::error::Version mismatch: mix.exs version is '$VERSION' but git tag is '$GIT_TAG' (without 'v': '$TAG_VERSION')" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "✓ Version validation passed: mix.exs version '$VERSION' matches git tag '$GIT_TAG'" | ||
| else | ||
| # workflow_dispatch or other non-tag trigger | ||
| echo "ℹ Using version from mix.exs: '$VERSION' (not a tag push)" | ||
| fi | ||
|
|
||
| echo "PROJECT_VERSION=$VERSION" >> $GITHUB_ENV | ||
|
|
||
| - name: Install Rust toolchain | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| targets: ${{ matrix.job.target }} | ||
|
|
||
| - name: Build the project | ||
| id: build-crate | ||
| uses: philss/rustler-precompiled-action@v1.1.4 | ||
| env: | ||
| CARGO_BUILD_TARGET: ${{ matrix.job.target }} | ||
| with: | ||
| project-name: ecto_libsql | ||
| project-version: ${{ env.PROJECT_VERSION }} | ||
| target: ${{ matrix.job.target }} | ||
| nif-version: ${{ matrix.nif }} | ||
| use-cross: ${{ matrix.job.use-cross }} | ||
| cross-version: "from-source" | ||
| project-dir: "native/ecto_libsql" | ||
|
|
||
| - name: Artifact upload | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ steps.build-crate.outputs.file-name }} | ||
| path: ${{ steps.build-crate.outputs.file-path }} | ||
|
|
||
| - name: Publish archives and packages | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| files: | | ||
| ${{ steps.build-crate.outputs.file-path }} | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Cross-compilation configuration for rustler_precompiled NIF builds. | ||
| # | ||
| # macOS: Use dynamic lookup for Erlang NIF symbols (resolved at load time). | ||
| # musl: Disable static CRT linking for compatibility with BEAM's dynamic loader. | ||
|
|
||
| [target.'cfg(target_os = "macos")'] | ||
| rustflags = [ | ||
| "-C", "link-arg=-undefined", | ||
| "-C", "link-arg=dynamic_lookup", | ||
| ] | ||
|
|
||
| [target.x86_64-unknown-linux-musl] | ||
| rustflags = [ | ||
| "-C", "target-feature=-crt-static", | ||
| ] | ||
|
|
||
| [target.aarch64-unknown-linux-musl] | ||
| rustflags = [ | ||
| "-C", "target-feature=-crt-static", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.