Skip to content

Cicd fixes - #8

Merged
nyo16 merged 17 commits into
masterfrom
cicd_fixes
Nov 27, 2025
Merged

nyo16 merged 17 commits into
masterfrom
cicd_fixes

Conversation

@nyo16

@nyo16 nyo16 commented Nov 27, 2025

Copy link
Copy Markdown
Owner

No description provided.

nyo16 added 17 commits November 27, 2025 09:41
Removed .github/dependabot.yml - dependency management will be handled manually.
Fixed formatting issues in 4 files:
- lib/muninn/index.ex: Multi-line function call formatting
- lib/muninn/native.ex: Multi-line function definitions with many parameters
- test/muninn/fuzzy_search_test.exs: Multi-line map and function call formatting
- test/muninn/search_integration_test.exs: Multi-line map formatting

All files now comply with Elixir formatter standards for CI lint checks.
Added .githooks/pre-commit to automatically run mix format on staged files.

To install:
  cp .githooks/pre-commit .git/hooks/pre-commit
  chmod +x .git/hooks/pre-commit

Or configure globally:
  git config core.hooksPath .githooks

The hook will format all staged .ex and .exs files before committing.
Rust fixes:
- Removed unused import IndexWriter from writer.rs
- Removed unused imports BooleanQuery, Occur, PhraseQuery from searcher.rs
- Prefixed unused parameter max_snippet_chars with underscore

Elixir test fixes:
- Prefixed unused test_path variable with underscore in searcher_test.exs
- Prefixed unused index1, index2 variables with underscores in integration_test.exs
- Removed unused Schema alias from native_test.exs
- Fixed IndexWriter test cleanup to use File.rm_rf/1 instead of rm_rf!/1
- Added 10ms delay before cleanup to ensure resources are released

Test Results:
- All 175 tests passing
- No test failures
- Remaining warnings are from Rustler macros (known issue with Rustler 0.35)

CI should now pass all checks.
Updated action versions:
- actions/checkout: v4 → v6 (CI and release workflows)
- actions/upload-artifact: v4 → v5 (release workflow)

Benefits:
- Latest security patches
- Improved performance
- Better Node.js runtime compatibility
The sed regex was capturing the trailing comma after the version string
(e.g., "0.3.0," instead of "0.3.0") because .* is greedy.

Changed from: \(.*\)"
Changed to:   \([^"]*\)".*

The new pattern captures only non-quote characters, correctly extracting
just the version number.
Changed runs-on from self-hosted to ubuntu-latest and removed
the ImageOS env var which is not needed for GitHub-hosted runners.
- Updated mix.exs with rustler_precompiled dependency and package config
- Changed native.ex to use RustlerPrecompiled instead of Rustler
- Added support for multiple targets (darwin, linux gnu/musl, windows)
- Added legacy_cpu variant detection for x86_64 Linux and Windows
- Created empty checksum file (to be populated by release workflow)
- Force build available via MUNINN_BUILD=true env var

Targets supported:
- aarch64-apple-darwin
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- x86_64-apple-darwin
- x86_64-unknown-linux-gnu (+ legacy_cpu variant)
- x86_64-unknown-linux-musl
- x86_64-pc-windows-gnu (+ legacy_cpu variant)
musl targets don't support dynamic libraries (cdylib) which are
required for Erlang NIFs. Removed:
- aarch64-unknown-linux-musl
- x86_64-unknown-linux-musl

Remaining targets cover all major platforms with glibc.
Added .cargo/config.toml with target-feature=-crt-static for musl
targets. This enables cdylib (dynamic library) support which is
required for Erlang NIFs.

Without this flag, Rust drops cdylib support for musl targets.
See: rust-lang/rust#59302

Note: The resulting binary will dynamically link to musl and libgcc_s,
so Alpine users may need to install libgcc package.
Added -undefined dynamic_lookup flags for macOS targets to properly
handle undefined symbols when loading the NIF into the BEAM.

Also enabled LTO (Link Time Optimization) for release builds.
Added Muninn.TestHelpers.safe_rm_rf/1 that retries directory removal
with delays. On Linux CI, NIF file locks can cause File.rm_rf! to fail
if called before resources are garbage collected.

Updated all test files to use the safe cleanup helper.
- bin/release.sh: Full release script with version validation, tests,
  formatting checks, git tagging, and colored output
- bin/checksum.sh: Download precompiled NIFs and update checksums
- bin/test.sh: Run tests with NIF compilation
- bin/compile.sh: Compile with NIF compilation

Removed old scripts/release.sh in favor of bin/ directory structure.
@nyo16
nyo16 merged commit d631308 into master Nov 27, 2025
0 of 21 checks passed
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.

1 participant