Skip to content

Conversation

@Primebrook
Copy link
Collaborator

@Primebrook Primebrook commented Feb 7, 2025

Summary

Currently, users of Exstatic must manually build the Rust NIFs, requiring a Rust toolchain and dependencies. This PR introduces the RustlerPrecompiled package which streamlines the usage of precompiled NIFs, removing the need for users to build the Rust code themselves. This PR also enhances the CI/CD pipeline with GitHub Actions for testing, precompiling, and releasing NIFs.

Main Changes

RustlerPrecompiled Integration

  • Updates Exstatic.Native to use RustlerPrecompiled instead of direct compilation via Rustler.
  • Precompiled NIFs will be downloaded from GitHub Releases, reducing local build dependencies.
  • Defines nif_versions: ["2.16"] to target OTP 26 & 27.

GitHub Actions for Precompiled NIF Builds (release.yml)

  • Builds NIFs only for macOS & Linux (both ARM and x86_64 for each, we can probably do away with one of the linux builds in the CI depending on what we use for prod builds).
  • Uses philss/rustler-precompiled-action to cross-compile and upload binaries.
  • Triggers on:
    • New tags (e.g., v0.1.0).
    • Main branch pushes.
    • PRs that modify native code or the release.yml file.
  • Uploads NIFs to GitHub Releases when a tag is pushed.

Additional Notes

  • ⚠️ By default, mix compilation will attempt to fetch the precompiled NIFs from GitHub Releases (if it hasn't already cached it locally from a previous fetch). To force local compilation (e.g. if you're developing Exstatic locally), set EXSTATIC_BUILD=true.

  • I'll follow up with a RELEASE.md detailing the steps for publishing a new version.

@Primebrook Primebrook changed the title Precompile binaries Integrate RustlerPrecompiled for Precompiled NIFs & CI/CD Enhancements Feb 7, 2025
@Primebrook Primebrook merged commit 0dfd799 into main Feb 7, 2025
5 checks passed
@Primebrook Primebrook deleted the rustler-precompiled branch February 7, 2025 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants