Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 94 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,35 @@ jobs:
include:
- os: macos-14
target: aarch64-apple-darwin
platform: eventum-darwin-arm64

- os: macos-latest
target: x86_64-apple-darwin
platform: eventum-darwin-x64

- os: windows-latest
target: x86_64-pc-windows-msvc
platform: eventum-win32-x64

- os: windows-latest
target: aarch64-pc-windows-msvc
platform: eventum-win32-arm64

- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
platform: eventum-linux-x64-gnu

- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
platform: eventum-linux-arm64-gnu

- os: ubuntu-latest
target: x86_64-unknown-linux-musl
platform: eventum-linux-x64-musl

- os: ubuntu-latest
target: aarch64-unknown-linux-musl
platform: eventum-linux-arm64-musl

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -85,45 +97,94 @@ jobs:

- name: Build native addon
run: npx napi build --release --target ${{ matrix.target }}

- name: Upload artifacts

- name: Create platform package
shell: bash
run: |
# Extract version from tag (v0.1.0-alpha.2 -> 0.1.0-alpha.2)
VERSION="${GITHUB_REF#refs/tags/v}"
PKG_NAME="${{ matrix.platform }}"
mkdir -p "platform-packages/$PKG_NAME"
cp *.node "platform-packages/$PKG_NAME/"

case "${{ matrix.target }}" in
*"darwin"*) OS="darwin" ;;
*"windows"*) OS="win32" ;;
*"linux"*) OS="linux" ;;
esac

case "${{ matrix.target }}" in
x86_64*) CPU="x64" ;;
aarch64*) CPU="arm64" ;;
esac

cat > "platform-packages/$PKG_NAME/package.json" << EOF
{
"name": "$PKG_NAME",
"version": "$VERSION",
"os": ["$OS"],
"cpu": ["$CPU"],
"main": "$(basename *.node)",
"files": ["*.node"],
"license": "MIT",
"description": "Eventum native binding for ${{ matrix.target }}",
"repository": {
"type": "git",
"url": "git+https://github.com/dmytroPolhul/eventum.git"
}
}
EOF

echo "Created platform package: $PKG_NAME"
ls -la "platform-packages/$PKG_NAME/"

- name: Upload platform package artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.target }}
path: "*.node"
name: ${{ matrix.platform }}
path: platform-packages/${{ matrix.platform }}
if-no-files-found: error
retention-days: 7

publish:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: "https://registry.npmjs.org"
cache: npm

- run: npm ci

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: bindings-*
merge-multiple: false

- name: List artifacts (debug)
run: |
echo "Artifacts directory:"
ls -R artifacts || echo "No artifacts directory found"

- name: Move bindings to npm package
run: npx napi artifacts -d artifacts

- name: Publish to npm with provenance
run: npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: "https://registry.npmjs.org"
cache: npm

- name: Download all platform packages
uses: actions/download-artifact@v4
with:
path: platform-packages

- name: List downloaded packages (debug)
run: |
echo "Platform packages:"
ls -R platform-packages/

- name: Publish platform packages
run: |
for dir in platform-packages/*/; do
if [ -f "$dir/package.json" ]; then
echo "Publishing $(basename $dir)"
cd "$dir"
npm publish --access public --provenance || echo "Failed to publish $(basename $dir)"
cd - > /dev/null
fi
done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish main package
run: |
echo "Publishing main eventum package"
npm ci
npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
File renamed without changes.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ node_modules/

/target
index.node
eventum.node
.idea/
*.log

Expand Down
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,11 @@ yarn-debug.log*
yarn-error.log*
.npm/
.yarn/

npm/
*.node
darwin-*/
linux-*/
win32-*/
x86_64-*/
aarch64-*/
33 changes: 32 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.0-alpha.2] - 2026-02-09

### Added
- Multi-platform binary distribution - No longer requires Rust toolchain for installation
- Separate platform-specific packages for 8 platforms
- Automatic platform detection and binary loading
- Users only download binaries for their platform
- Platform package support:
- `eventum-darwin-x64` (macOS Intel)
- `eventum-darwin-arm64` (macOS Apple Silicon)
- `eventum-win32-x64` (Windows x64)
- `eventum-win32-arm64` (Windows ARM)
- `eventum-linux-x64-gnu` (Linux x64 with glibc - Ubuntu, Debian, etc.)
- `eventum-linux-arm64-gnu` (Linux ARM with glibc)
- `eventum-linux-x64-musl` (Linux x64 with musl - Alpine, etc.)
- `eventum-linux-arm64-musl` (Linux ARM with musl)
- Platform detection tests to verify correct binary selection
- Improved musl vs glibc detection on Linux systems

### Changed
- Binary loading now tries platform-specific package first, falls back to local build for development
- Removed bundled binaries from main package (now distributed via platform packages)
- Updated release workflow to build and publish platform-specific packages

### Fixed
- Platform detection for Alpine Linux (musl) vs standard Linux (glibc)

### Performance
- Faster npm install times due to smaller package sizes


## [0.1.0-alpha.1] - 2026-02-07

Expand Down Expand Up @@ -69,6 +99,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Security policy and code of conduct
- GitHub issue templates for bug reports and feature requests

[Unreleased]: https://github.com/dmytroPolhul/eventum/compare/v0.1.0-alpha.1...HEAD
[Unreleased]: https://github.com/dmytroPolhul/eventum/compare/v0.1.0-alpha.2...HEAD
[0.1.0-alpha.2]: https://github.com/dmytroPolhul/eventum/compare/v0.1.0-alpha.1...v0.1.0-alpha.2
[0.1.0-alpha.1]: https://github.com/dmytroPolhul/eventum/compare/v0.1.0-alpha.0...v0.1.0-alpha.1
[0.1.0-alpha.0]: https://github.com/dmytroPolhul/eventum/releases/tag/v0.1.0-alpha.0
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "eventum"
version = "0.1.0-alpha.1"
version = "0.1.0-alpha.2"
edition = "2021"

build = "build.rs"
Expand Down
12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

> ⚠️ Eventum is currently in **alpha**.
> APIs may change, and platform support is still evolving.
> Prebuilt binaries are currently limited.
> If you encounter build issues, please open an issue.


Expand Down Expand Up @@ -42,14 +41,6 @@ npm install eventum
yarn add eventum
```

### Build Requirements

The native module is built automatically during installation. Ensure you have:
- **Node.js** 18.0.0 or higher
- **Rust toolchain** (will be installed via `npm install` if missing)

> Under the hood: compiled Rust binary with no runtime dependencies.

---

## Quick Start
Expand Down Expand Up @@ -311,7 +302,7 @@ MIT
## Roadmap

- [ ] Async file writing support (currently uses synchronous I/O)
- [ ] Prebuilt binaries for common platforms (npm, arm64, x64)
- [x] Prebuilt binaries for common platforms (npm, arm64, x64)
- [ ] External transport targets (HTTP, sockets, Kafka, etc.)
- [ ] WebAssembly support
- [ ] File compression on rotation
Expand All @@ -321,7 +312,6 @@ MIT
## Known Limitations (Alpha)

- **File I/O is synchronous**: File writes may block the event loop on slow disks. Use batching to mitigate.
- **No prebuilt binaries**: Native module builds locally during installation (requires Rust toolchain).
- **Log loss on crash**: Buffered logs are lost if process crashes without calling `shutdown()`.
- **Single config warning**: Logger only warns once if used before `setConfig()`, then silently discards logs.

Expand Down
51 changes: 36 additions & 15 deletions index.cjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,42 @@
const path = require("node:path");
const { platform, arch } = require('os')
const { join } = require('path')
const { readFileSync } = require('fs')

const nativePath = path.join(__dirname, "index.node");
function isMusl() {
if (process.report?.getReport) {
const report = process.report.getReport()
return !report.header?.glibcVersionRuntime
}

try {
const ldd = readFileSync('/usr/bin/ldd', 'utf8')
return ldd.includes('musl')
} catch {
return false
}
}

let native;
try {
native = require(nativePath);
} catch (err) {
const buildCommand = process.platform === "win32" ? "npm.cmd run build" : "npm run build";
const message = err && err.message ? err.message : String(err);
function getPlatformPackage() {
const plat = platform()
const cpu = arch()

if (plat === 'linux') {
const libc = isMusl() ? 'musl' : 'gnu'
return `eventum-${plat}-${cpu}-${libc}`
}

return `eventum-${plat}-${cpu}`
}

throw new Error(
[
`Failed to load native module at: ${nativePath}`,
`Build it first using: \`${buildCommand}\``,
`Original error: ${message}`,
].join("\n")
);
let native
try {
native = require(getPlatformPackage())
} catch (e) {
try {
native = require(join(__dirname, 'eventum.node'))
} catch (err) {
throw new Error(`Failed to load native binding: ${err.message}`)
}
}

/**
Expand Down
Loading