Add cross-platform build system and CI/CD release pipeline
- Add setup.sh (Unix) and setup.bat (Windows) build scripts that detect
platform, check dependencies, and build all components (JS, WASM, miner)
- Add GitHub Actions CI workflow (test on push/PR)
- Add GitHub Actions release workflow that builds static miner binaries
for Linux x86_64/aarch64, macOS Intel/Apple Silicon, and Windows
- Switch miner from OpenSSL to rustls for zero runtime dependencies
- Fix wallet-sync batch fetching (remove broken .bin binary endpoint,
use sequential JSON-RPC get_block calls)
- Add portable storage binary format serializer/deserializer for future
batch RPC support
- Add postBinary() to RPC client for binary endpoint communication
- Update package.json: bun-only runtime, remove node/npm references
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
|
||||
- run: bun install
|
||||
|
||||
- run: bun test/run.js
|
||||
|
||||
lint-miner:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Check miner compiles
|
||||
working-directory: crates/salvium-miner
|
||||
run: cargo check
|
||||
@@ -0,0 +1,176 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["v*"]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
# ── WASM artifacts (platform-independent) ────────────────────────────
|
||||
wasm:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: wasm32-unknown-unknown
|
||||
|
||||
- name: Install wasm-pack
|
||||
run: cargo install wasm-pack
|
||||
|
||||
- name: Install JS dependencies
|
||||
run: bun install
|
||||
|
||||
- name: Build WASM crypto
|
||||
working-directory: crates/salvium-crypto
|
||||
run: |
|
||||
RUSTFLAGS="-Ctarget-feature=+simd128" \
|
||||
wasm-pack build --target web --out-dir ../../src/crypto/wasm
|
||||
|
||||
- name: Build RandomX WASM
|
||||
run: bun run build:wasm
|
||||
|
||||
- name: Upload WASM artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: wasm-artifacts
|
||||
path: |
|
||||
src/crypto/wasm/salvium_crypto_bg.wasm
|
||||
src/crypto/wasm/salvium_crypto.js
|
||||
src/crypto/wasm/salvium_crypto.d.ts
|
||||
build/randomx.wasm
|
||||
|
||||
# ── Native miner binaries ────────────────────────────────────────────
|
||||
miner:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: x86_64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
name: salvium-miner-linux-x86_64
|
||||
cross: true
|
||||
|
||||
- target: aarch64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
name: salvium-miner-linux-aarch64
|
||||
cross: true
|
||||
|
||||
- target: x86_64-apple-darwin
|
||||
os: macos-13
|
||||
name: salvium-miner-macos-x86_64
|
||||
|
||||
- target: aarch64-apple-darwin
|
||||
os: macos-latest
|
||||
name: salvium-miner-macos-aarch64
|
||||
|
||||
- target: x86_64-pc-windows-msvc
|
||||
os: windows-latest
|
||||
name: salvium-miner-windows-x86_64.exe
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.target }}
|
||||
|
||||
# Linux: install cross for musl/cross-compilation
|
||||
- name: Install cross (Linux)
|
||||
if: matrix.cross
|
||||
run: cargo install cross --git https://github.com/cross-rs/cross
|
||||
|
||||
# macOS: install cmake
|
||||
- name: Install cmake (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: brew install cmake
|
||||
|
||||
# Windows: install cmake
|
||||
- name: Install cmake (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: choco install cmake --installargs '"ADD_CMAKE_TO_PATH=System"' -y
|
||||
|
||||
# Build with cross (Linux musl targets)
|
||||
- name: Build with cross (Linux)
|
||||
if: matrix.cross
|
||||
working-directory: crates/salvium-miner
|
||||
run: cross build --release --target ${{ matrix.target }}
|
||||
|
||||
# Build natively (macOS / Windows)
|
||||
- name: Build native (macOS/Windows)
|
||||
if: ${{ !matrix.cross }}
|
||||
working-directory: crates/salvium-miner
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "$RUNNER_OS" = "Windows" ]; then
|
||||
export RUSTFLAGS="-C target-feature=+crt-static"
|
||||
fi
|
||||
cargo build --release --target ${{ matrix.target }}
|
||||
|
||||
# Rename binary to target name
|
||||
- name: Rename binary (Unix)
|
||||
if: runner.os != 'Windows'
|
||||
run: |
|
||||
cp crates/salvium-miner/target/${{ matrix.target }}/release/salvium-miner \
|
||||
${{ matrix.name }}
|
||||
|
||||
- name: Rename binary (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
copy crates\salvium-miner\target\${{ matrix.target }}\release\salvium-miner.exe ^
|
||||
${{ matrix.name }}
|
||||
shell: cmd
|
||||
|
||||
- name: Upload binary
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.name }}
|
||||
path: ${{ matrix.name }}
|
||||
|
||||
# ── Create GitHub Release ────────────────────────────────────────────
|
||||
release:
|
||||
needs: [wasm, miner]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: Prepare release files
|
||||
run: |
|
||||
mkdir -p release
|
||||
|
||||
# Miner binaries
|
||||
for dir in artifacts/salvium-miner-*; do
|
||||
name=$(basename "$dir")
|
||||
cp "$dir/$name" "release/$name"
|
||||
chmod +x "release/$name" 2>/dev/null || true
|
||||
done
|
||||
|
||||
# WASM files
|
||||
cp artifacts/wasm-artifacts/src/crypto/wasm/salvium_crypto_bg.wasm release/
|
||||
cp artifacts/wasm-artifacts/build/randomx.wasm release/
|
||||
|
||||
# Generate checksums
|
||||
cd release
|
||||
sha256sum * > checksums.sha256
|
||||
cat checksums.sha256
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
generate_release_notes: true
|
||||
files: release/*
|
||||
Reference in New Issue
Block a user