Add prebuilt CMake packages for libnod to releases

This commit is contained in:
Luke Street
2026-03-09 14:14:09 -06:00
parent 8bc87fac9b
commit 88672ce278
6 changed files with 313 additions and 84 deletions
+59 -14
View File
@@ -9,9 +9,8 @@ on:
workflow_dispatch:
env:
BUILD_PROFILE: release-lto
CARGO_TARGET_DIR: target
CARGO_INCREMENTAL: 0
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
jobs:
check:
@@ -31,8 +30,8 @@ jobs:
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- name: Cache Rust workspace
uses: Swatinem/rust-cache@v2
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Cargo check
run: cargo check --all-targets
- name: Cargo clippy
@@ -62,8 +61,8 @@ jobs:
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust workspace
uses: Swatinem/rust-cache@v2
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Install cbindgen
run: cargo install cbindgen
- name: Generate header
@@ -74,6 +73,8 @@ jobs:
deny:
name: Deny
runs-on: ubuntu-latest
env:
RUSTC_WRAPPER: "" # sccache breaks cargo-deny
strategy:
matrix:
checks:
@@ -100,15 +101,18 @@ jobs:
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust workspace
uses: Swatinem/rust-cache@v2
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Cargo test
run: cargo test --release
build:
name: Build nodtool
env:
BUILD_PROFILE: release-lto
CARGO_BIN_NAME: nodtool
CARGO_INCREMENTAL: 0
CARGO_TARGET_DIR: target
strategy:
matrix:
include:
@@ -169,10 +173,8 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Rust workspace
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Cargo build
run: >
cargo ${{ matrix.build }} --profile ${{ env.BUILD_PROFILE }} --target ${{ matrix.target }}
@@ -186,11 +188,49 @@ jobs:
${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/${{ env.BUILD_PROFILE }}/${{ env.CARGO_BIN_NAME }}.exe
if-no-files-found: error
build-libs:
name: Build libraries
strategy:
matrix:
include:
- platform: ubuntu-latest
name: linux-x86_64
- platform: windows-latest
name: windows-x86_64
- platform: macos-latest
name: macos-arm64
fail-fast: false
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Setup MSVC environment
uses: ilammy/msvc-dev-cmd@v1
if: startsWith(matrix.platform, 'windows-')
- name: Configure
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build build --config Release
- name: Install
run: cmake --install build --prefix install --config Release
- name: Package
run: tar czf libnod-${{ matrix.name }}.tar.gz -C install .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: libnod-${{ matrix.name }}
path: libnod-${{ matrix.name }}.tar.gz
if-no-files-found: error
release:
name: Release
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [ build ]
needs: [ build, build-libs ]
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -218,6 +258,11 @@ jobs:
for dir in */; do
for file in "$dir"*; do
base=$(basename "$file")
# .tar.gz files (lib packages) are already named correctly
if [[ "$base" == *.tar.gz ]]; then
mv "$file" "../out/$base"
continue
fi
name="${base%.*}"
ext="${base##*.}"
if [ "$ext" = "$base" ]; then