Skip to content

Bump packages to beta #1

Bump packages to beta

Bump packages to beta #1

name: Release Artifacts
# Build-only artifact workflow for the pre-open-source phase.
# It uploads GitHub Actions run artifacts and never publishes to package registries.
on:
workflow_dispatch:
push:
tags:
- 'v*'
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
package-metadata:
name: Package metadata
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Verify package names and versions
run: python scripts/check_package_metadata.py
rust:
name: Rust crates and native core
runs-on: ubuntu-latest
needs: package-metadata
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Package Rust crates
run: |
cargo package --allow-dirty --no-verify \
-p agent_control_specification_core \
-p agent_control_specification \
-p agent_control_specification_rig \
-p agent_control_specification_annotators \
-p agent_control_specification_otel
- name: Build release native core
run: cargo build --release -p agent_control_specification_core
- name: Stage Rust artifacts
run: |
mkdir -p artifacts/rust/crates artifacts/rust/native
cp target/package/*.crate artifacts/rust/crates/
find target/release -maxdepth 1 -type f \( \
-name 'libagent_control_specification_core.*' -o \
-name 'agent_control_specification_core.*' \
\) -exec cp {} artifacts/rust/native/ \;
find artifacts/rust -type f -maxdepth 3 -print | sort
- name: Upload Rust artifacts
uses: actions/upload-artifact@v4
with:
name: rust-release-artifacts
path: artifacts/rust/**
if-no-files-found: error
python:
name: Python wheels and sdist
runs-on: ubuntu-latest
needs: package-metadata
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install maturin
run: python -m pip install 'maturin>=1.0,<2.0'
- name: Build Python distributions
working-directory: sdk/python
run: maturin build --release --sdist --out dist
- name: Upload Python artifacts
uses: actions/upload-artifact@v4
with:
name: python-release-artifacts
path: sdk/python/dist/*
if-no-files-found: error
node:
name: Node main tarball
runs-on: ubuntu-latest
needs: package-metadata
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: sdk/node/package-lock.json
- name: Install Node dependencies
working-directory: sdk/node
run: npm ci
- name: Build native addon and TypeScript output
working-directory: sdk/node
run: npm run build
- name: Pack Node tarball
working-directory: sdk/node
run: |
mkdir -p dist
npm pack --pack-destination dist
- name: Upload Node artifact
uses: actions/upload-artifact@v4
with:
name: node-main-release-artifact
path: sdk/node/dist/*.tgz
if-no-files-found: error
node-native:
name: Node native package (${{ matrix.package }})
runs-on: ${{ matrix.os }}
needs: package-metadata
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
rust-target: x86_64-unknown-linux-gnu
package: agent-control-specification-linux-x64-gnu
binary: agent-control-specification.linux-x64-gnu.node
zig: false
- os: ubuntu-latest
rust-target: x86_64-unknown-linux-musl
package: agent-control-specification-linux-x64-musl
binary: agent-control-specification.linux-x64-musl.node
zig: true
- os: ubuntu-24.04-arm
rust-target: aarch64-unknown-linux-gnu
package: agent-control-specification-linux-arm64-gnu
binary: agent-control-specification.linux-arm64-gnu.node
zig: false
- os: ubuntu-24.04-arm
rust-target: aarch64-unknown-linux-musl
package: agent-control-specification-linux-arm64-musl
binary: agent-control-specification.linux-arm64-musl.node
zig: true
- os: macos-13
rust-target: x86_64-apple-darwin
package: agent-control-specification-darwin-x64
binary: agent-control-specification.darwin-x64.node
zig: false
- os: macos-14
rust-target: aarch64-apple-darwin
package: agent-control-specification-darwin-arm64
binary: agent-control-specification.darwin-arm64.node
zig: false
- os: windows-latest
rust-target: x86_64-pc-windows-msvc
package: agent-control-specification-win32-x64-msvc
binary: agent-control-specification.win32-x64-msvc.node
zig: false
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust-target }}
- name: Set up Zig
if: matrix.zig
uses: goto-bus-stop/setup-zig@v2
- name: Install cargo-zigbuild
if: matrix.zig
run: cargo install cargo-zigbuild --locked
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: sdk/node/package-lock.json
- name: Install Node dependencies
working-directory: sdk/node
run: npm ci
- name: Build and stage native package
working-directory: sdk/node
run: |
extra_flags=()
if [ "${{ matrix.zig }}" = "true" ]; then
extra_flags+=(--zig)
fi
npx napi build --platform --release --target "${{ matrix.rust-target }}" --js native.js --dts native.d.ts "${extra_flags[@]}"
test -s "${{ matrix.binary }}"
cp "${{ matrix.binary }}" "npm/${{ matrix.package }}/${{ matrix.binary }}"
test -s "npm/${{ matrix.package }}/${{ matrix.binary }}"
rm -f native.js native.d.ts "${{ matrix.binary }}"
mkdir -p artifacts/node-native
npm pack "./npm/${{ matrix.package }}" --pack-destination artifacts/node-native
- name: Upload Node native artifact
uses: actions/upload-artifact@v4
with:
name: node-native-${{ matrix.package }}
path: sdk/node/artifacts/node-native/*.tgz
if-no-files-found: error
node-opa:
name: Node OPA packages
runs-on: ubuntu-latest
needs: package-metadata
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: sdk/node/package-lock.json
- name: Install Node dependencies
working-directory: sdk/node
run: npm ci
- name: Vendor OPA binaries
working-directory: sdk/node
run: npm run vendor:opa
- name: Pack OPA packages
working-directory: sdk/node
run: |
mkdir -p artifacts/node-opa
for package_dir in ./npm/agent-control-specification-opa-*; do
npm pack "$package_dir" --pack-destination artifacts/node-opa
done
test "$(find artifacts/node-opa -name '*.tgz' | wc -l)" -eq 5
- name: Upload Node OPA artifacts
uses: actions/upload-artifact@v4
with:
name: node-opa-release-artifacts
path: sdk/node/artifacts/node-opa/*.tgz
if-no-files-found: error
dotnet-native:
name: .NET native asset (${{ matrix.rid }})
runs-on: ${{ matrix.os }}
needs: package-metadata
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
rid: linux-x64
rust-target: x86_64-unknown-linux-gnu
native-lib: libagent_control_specification_core.so
- os: ubuntu-24.04-arm
rid: linux-arm64
rust-target: aarch64-unknown-linux-gnu
native-lib: libagent_control_specification_core.so
- os: macos-13
rid: osx-x64
rust-target: x86_64-apple-darwin
native-lib: libagent_control_specification_core.dylib
- os: macos-14
rid: osx-arm64
rust-target: aarch64-apple-darwin
native-lib: libagent_control_specification_core.dylib
- os: windows-latest
rid: win-x64
rust-target: x86_64-pc-windows-msvc
native-lib: agent_control_specification_core.dll
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust-target }}
- name: Build native core
run: |
cargo build --release \
-p agent_control_specification_core \
--features default-dispatchers,aacs,openai_moderation,perspective,llama_guard,lakera_guard,auto \
--target "${{ matrix.rust-target }}"
mkdir -p "artifacts/dotnet-native/runtimes/${{ matrix.rid }}/native"
cp "target/${{ matrix.rust-target }}/release/${{ matrix.native-lib }}" \
"artifacts/dotnet-native/runtimes/${{ matrix.rid }}/native/${{ matrix.native-lib }}"
test -s "artifacts/dotnet-native/runtimes/${{ matrix.rid }}/native/${{ matrix.native-lib }}"
- name: Upload .NET native asset
uses: actions/upload-artifact@v4
with:
name: dotnet-native-${{ matrix.rid }}
path: artifacts/dotnet-native/**
if-no-files-found: error
dotnet:
name: .NET NuGet package
runs-on: ubuntu-latest
needs:
- package-metadata
- dotnet-native
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Download .NET native assets
uses: actions/download-artifact@v4
with:
pattern: dotnet-native-*
path: sdk/dotnet/src/AgentControlSpecification
merge-multiple: true
- name: Verify .NET native assets
run: |
test -s sdk/dotnet/src/AgentControlSpecification/runtimes/linux-x64/native/libagent_control_specification_core.so
test -s sdk/dotnet/src/AgentControlSpecification/runtimes/linux-arm64/native/libagent_control_specification_core.so
test -s sdk/dotnet/src/AgentControlSpecification/runtimes/osx-x64/native/libagent_control_specification_core.dylib
test -s sdk/dotnet/src/AgentControlSpecification/runtimes/osx-arm64/native/libagent_control_specification_core.dylib
test -s sdk/dotnet/src/AgentControlSpecification/runtimes/win-x64/native/agent_control_specification_core.dll
- name: Pack .NET SDK
run: dotnet pack sdk/dotnet/src/AgentControlSpecification/AgentControlSpecification.csproj --configuration Release --output artifacts/dotnet -p:AgentControlSpecificationSkipNativeBuild=true
- name: Upload .NET artifact
uses: actions/upload-artifact@v4
with:
name: dotnet-release-artifacts
path: artifacts/dotnet/*.nupkg
if-no-files-found: error