Skip to content

fix: add VFO switching bypass for get_func/set_func/vfo_op on ICOM se… #197

fix: add VFO switching bypass for get_func/set_func/vfo_op on ICOM se…

fix: add VFO switching bypass for get_func/set_func/vfo_op on ICOM se… #197

Workflow file for this run

name: Build and Publish
on:
push:
branches: [main, develop]
tags: ['v*']
pull_request:
branches: [main]
jobs:
build:
env:
HAMLIB_VERSION: '4.7.0'
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: linux-x64
- os: ubuntu-24.04-arm
target: linux-arm64
- os: macos-latest
target: darwin-arm64
- os: macos-15-intel
target: darwin-x64
- os: windows-latest
target: win32-x64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install Python setuptools (for node-gyp)
run: pip3 install setuptools --break-system-packages || pip3 install setuptools || true
- name: Install system dependencies (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake libtool pkg-config patchelf
sudo apt-get install -y libusb-1.0-0 libindi1 || true
- name: Install system dependencies (macOS)
if: startsWith(matrix.os, 'macos')
run: |
brew install autoconf automake libtool dylibbundler
pip3 install setuptools --break-system-packages || true
- name: Setup Windows Hamlib
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$ver = $env:HAMLIB_VERSION
$zipUrl = "https://github.com/Hamlib/Hamlib/releases/download/$ver/hamlib-w64-$ver.zip"
$zipPath = Join-Path $env:RUNNER_TEMP "hamlib-w64-$ver.zip"
Write-Host "Downloading Hamlib $ver..."
Invoke-WebRequest -Uri $zipUrl -OutFile $zipPath
$dest = Join-Path $env:GITHUB_WORKSPACE 'hamlib'
if (Test-Path $dest) { Remove-Item -Recurse -Force $dest }
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipPath, $dest)
$root = $dest
if (!(Test-Path (Join-Path $root 'bin'))) {
$child = Get-ChildItem -Path $dest -Directory | Select-Object -First 1
if ($null -ne $child) { $root = $child.FullName }
}
Write-Host "HAMLIB root: $root"
"HAMLIB_ROOT=$root" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup MSYS2 MinGW (Windows)
if: matrix.os == 'windows-latest'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
location: D:\msys2
install: mingw-w64-x86_64-gcc mingw-w64-x86_64-binutils
- name: Setup MSVC (Windows)
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Install Node.js dependencies
run: npm ci --ignore-scripts
- name: Build shim DLL (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
env:
MINGW_CC: D:\msys2\msys64\mingw64\bin\gcc.exe
run: |
$env:Path = "D:\msys2\msys64\mingw64\bin;$env:Path"
node scripts/build-shim.js --verbose
- name: Build (Windows)
if: matrix.os == 'windows-latest'
run: npm run build:all -- --skip-hamlib --skip-shim --minimal
- name: Build (Unix)
if: matrix.os != 'windows-latest'
run: npm run build:all -- --minimal
- name: Run tests
run: |
node test/test_loader.js
node test/test_ci_functional.js
- name: Check prebuild dependencies (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: |
echo "=== Prebuild contents ==="
ls -la prebuilds/${{ matrix.target }}/
echo ""
echo "=== node.napi.node dependencies ==="
ldd prebuilds/${{ matrix.target }}/node.napi.node
echo ""
echo "=== libhamlib dependencies ==="
for f in prebuilds/${{ matrix.target }}/libhamlib.so*; do
if [ -f "$f" ] && ! [ -L "$f" ]; then
echo "--- $(basename $f) ---"
ldd "$f"
fi
done
echo ""
echo "=== Checking for missing dependencies ==="
cd prebuilds/${{ matrix.target }}
LD_LIBRARY_PATH=. ldd node.napi.node 2>&1 | grep "not found" && echo "MISSING DEPS FOUND!" || echo "All deps resolved with bundled libs"
for f in libhamlib.so*; do
if [ -f "$f" ] && ! [ -L "$f" ]; then
LD_LIBRARY_PATH=. ldd "$f" 2>&1 | grep "not found" && echo "MISSING DEPS in $f!" || true
fi
done
- name: Check prebuild dependencies (macOS)
if: startsWith(matrix.os, 'macos')
run: |
echo "=== Prebuild contents ==="
ls -la prebuilds/${{ matrix.target }}/
echo ""
echo "=== node.napi.node dependencies ==="
otool -L prebuilds/${{ matrix.target }}/node.napi.node
echo ""
echo "=== dylib dependencies ==="
for f in prebuilds/${{ matrix.target }}/*.dylib; do
echo "--- $(basename $f) ---"
otool -L "$f"
done
echo ""
echo "=== Checking for non-system, non-bundled dependencies ==="
otool -L prebuilds/${{ matrix.target }}/node.napi.node | grep -v "@loader_path\|/usr/lib\|/System\|:" | grep -v "^$" && echo "UNBUNDLED DEPS FOUND!" || echo "All deps are system or bundled"
- name: Check prebuild dependencies (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Write-Host "=== Prebuild contents ==="
Get-ChildItem prebuilds/${{ matrix.target }}/ | Format-Table Name, Length
Write-Host ""
Write-Host "=== node.napi.node dependencies ==="
dumpbin /dependents prebuilds/${{ matrix.target }}/node.napi.node
Write-Host ""
Write-Host "=== hamlib_shim.dll dependencies ==="
dumpbin /dependents prebuilds/${{ matrix.target }}/hamlib_shim.dll
Write-Host ""
Write-Host "=== libhamlib-4.dll dependencies ==="
dumpbin /dependents prebuilds/${{ matrix.target }}/libhamlib-4.dll
- name: Upload prebuilds
uses: actions/upload-artifact@v4
with:
name: prebuilt-${{ matrix.target }}
path: prebuilds/
retention-days: 7
publish:
name: Publish
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v4
with:
path: all-artifacts
- name: Organize prebuilds
run: |
mkdir -p prebuilds
for dir in all-artifacts/prebuilt-*/; do
[ -d "$dir" ] && cp -r "$dir"/* prebuilds/
done
- name: Validate prebuilds
run: |
for p in linux-x64 linux-arm64 darwin-arm64 darwin-x64 win32-x64; do
test -f "prebuilds/$p/node.napi.node" || { echo "Missing: $p"; exit 1; }
done
echo "All 5 platform prebuilds verified."
find prebuilds -name "*.node" -exec ls -la {} \;
- run: npm ci --ignore-scripts
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
VERSION=${GITHUB_REF#refs/tags/}
for dir in prebuilds/*/; do
platform=$(basename "$dir")
tar -czf "node-hamlib-${VERSION}-${platform}.tar.gz" -C prebuilds "$platform"
done
gh release create "$VERSION" --title "Node-HamLib $VERSION" --generate-notes \
node-hamlib-${VERSION}-*.tar.gz