Skip to content

nono-release

nono-release #45

Workflow file for this run

name: Bump nono dependency
on:
repository_dispatch:
types: [nono-release]
workflow_dispatch:
inputs:
nono_version:
description: 'nono version to bump to (e.g., v0.33.0)'
required: true
type: string
permissions:
contents: read
concurrency:
group: bump-nono-${{ github.event.client_payload.nono_version || github.event.inputs.nono_version }}
cancel-in-progress: false
jobs:
rebuild-libs:
name: Rebuild nono-ffi for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
permissions:
contents: read
env:
NONO_VERSION: ${{ github.event.client_payload.nono_version || github.event.inputs.nono_version }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
platform: linux_amd64
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04
platform: linux_arm64
cross: true
- target: x86_64-apple-darwin
os: macos-latest
platform: darwin_amd64
- target: aarch64-apple-darwin
os: macos-14
platform: darwin_arm64
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- name: Validate nono version
run: |
if ! echo "$NONO_VERSION" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "Invalid nono version: $NONO_VERSION" >&2
exit 1
fi
- name: Clone nono at release tag
run: |
git clone --depth 1 --branch "$NONO_VERSION" \
https://github.com/nolabs-ai/nono.git /tmp/nono
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
with:
targets: ${{ matrix.target }}
- name: Cache Cargo
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
~/.cargo/bin/cross
key: cargo-${{ runner.os }}-${{ matrix.target }}-${{ env.NONO_VERSION }}
restore-keys: |
cargo-${{ runner.os }}-${{ matrix.target }}-
cargo-${{ runner.os }}-
- name: Install system dependencies (Linux)
if: runner.os == 'Linux' && !matrix.cross
run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev pkg-config
- name: Install cross (Linux ARM64)
if: matrix.cross
run: command -v cross || cargo install cross
- name: Build libnono_ffi.a
run: |
cd /tmp/nono
if [ "${{ matrix.cross }}" = "true" ]; then
cross build --release --target ${{ matrix.target }} -p nono-ffi
else
cargo build --release --target ${{ matrix.target }} -p nono-ffi
fi
- name: Stage library artifact
env:
PLATFORM: ${{ matrix.platform }}
TARGET: ${{ matrix.target }}
run: |
mkdir -p "artifact/$PLATFORM"
cp "/tmp/nono/target/$TARGET/release/libnono_ffi.a" "artifact/$PLATFORM/libnono_ffi.a"
cp /tmp/nono/bindings/c/include/nono.h "artifact/$PLATFORM/nono.h"
- name: Upload library artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: libnono-${{ matrix.platform }}
path: artifact/${{ matrix.platform }}/*
create-pr:
name: Create bump PR
needs: rebuild-libs
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
env:
NONO_VERSION: ${{ github.event.client_payload.nono_version || github.event.inputs.nono_version }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
persist-credentials: false
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: '1.24'
cache: true
- name: Strip v prefix
id: version
run: |
if ! echo "$NONO_VERSION" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "Invalid nono version: $NONO_VERSION" >&2
exit 1
fi
VERSION="${NONO_VERSION#v}"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "branch=bump-nono-${VERSION}" >> "$GITHUB_OUTPUT"
- name: Check if PR already exists
id: check
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
EXISTING=$(gh pr list --search "bump nono to ${{ steps.version.outputs.version }}" --state open --json number --jq '.[0].number')
if [ -n "$EXISTING" ]; then
echo "PR #$EXISTING already exists, skipping"
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Download all library artifacts
if: steps.check.outputs.skip != 'true'
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: artifacts
- name: Validate library artifacts
if: steps.check.outputs.skip != 'true'
run: |
for platform in darwin_amd64 darwin_arm64 linux_amd64 linux_arm64; do
test -s "artifacts/libnono-${platform}/libnono_ffi.a"
test -s "artifacts/libnono-${platform}/nono.h"
done
for platform in darwin_amd64 linux_amd64 linux_arm64; do
cmp -s "artifacts/libnono-darwin_arm64/nono.h" \
"artifacts/libnono-${platform}/nono.h"
done
- name: Update bundled libraries
if: steps.check.outputs.skip != 'true'
run: |
git init /tmp/nono-tag
git -C /tmp/nono-tag remote add origin https://github.com/nolabs-ai/nono.git
git -C /tmp/nono-tag fetch --depth=1 origin \
"refs/tags/${NONO_VERSION}:refs/tags/${NONO_VERSION}"
NONO_SHA=$(git -C /tmp/nono-tag rev-list -n 1 "$NONO_VERSION")
if ! echo "$NONO_SHA" | grep -Eq '^[0-9a-f]{40}$'; then
echo "Error: Could not resolve SHA for tag ${NONO_VERSION}"
exit 1
fi
for entry in \
"darwin_amd64 x86_64-apple-darwin" \
"darwin_arm64 aarch64-apple-darwin" \
"linux_amd64 x86_64-unknown-linux-gnu" \
"linux_arm64 aarch64-unknown-linux-gnu"; do
set -- $entry
platform="$1"
target="$2"
cp "artifacts/libnono-${platform}/libnono_ffi.a" "internal/clib/${platform}/libnono_ffi.a"
{
echo "# nono upstream commit used to build libnono_ffi.a for $target"
echo "# Update this file whenever the bundled library is rebuilt."
echo "$NONO_SHA"
} > "internal/clib/${platform}/VERSION"
done
# Update shared header
cp artifacts/libnono-darwin_arm64/nono.h internal/clib/nono.h
go run internal/clib/manifest.go -write
- name: Validate updated Go package
if: steps.check.outputs.skip != 'true'
env:
NONO_REQUIRE_APPLY: "1"
run: |
sudo apt-get update
sudo apt-get install -y libdbus-1-dev pkg-config
go test -v -count=1 ./...
- name: Create Pull Request
if: steps.check.outputs.skip != 'true'
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.version.outputs.branch }}
commit-message: "chore(deps): bump nono to ${{ steps.version.outputs.version }}"
title: "chore(deps): bump nono to ${{ steps.version.outputs.version }}"
body: |
Automated PR to rebuild bundled `libnono_ffi.a` static libraries from nono `${{ env.NONO_VERSION }}`.
Triggered by [nono ${{ env.NONO_VERSION }}](https://github.com/nolabs-ai/nono/releases/tag/${{ env.NONO_VERSION }}).
### Updated libraries
- `internal/clib/darwin_amd64/libnono_ffi.a`
- `internal/clib/darwin_arm64/libnono_ffi.a`
- `internal/clib/linux_amd64/libnono_ffi.a`
- `internal/clib/linux_arm64/libnono_ffi.a`
- `internal/clib/nono.h`
## Checklist
- [ ] CI passes
- [ ] `go test ./...` passes with new libraries
labels: dependencies,automated