Skip to content

fix(api): Readded non zero split fix #11

fix(api): Readded non zero split fix

fix(api): Readded non zero split fix #11

Workflow file for this run

name: Build Thorium Release
on:
push:
branches:
- main
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
jobs:
build-mdbook-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cargo install mdbook
run: cargo install mdbook
- name: Build mdbook docs
run: mdbook build api/docs
# Save static docs site for container build
- name: Upload docs as artifacts (API hosted)
uses: actions/upload-artifact@v4
with:
name: thorium-mdbook-bundle
path: api/docs/book/
# Save docs site for hosting in Github pages (gh-pages branch)
- name: Upload docs as artifacts (Github pages)
uses: actions/upload-pages-artifact@v3
if:
with:
path: api/docs/book/
build-ui-bundle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build UI Bundle
run: |
cd ui
npm install
set -e
npm run validate-style
npm run build
- name: Upload UI Bundle Artifact
uses: actions/upload-artifact@v4
with:
name: thorium-ui-bundle
path: ui/dist/
build-glibc-binaries:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-C target-feature=+aes,+sse2"
steps:
- uses: actions/checkout@v4
- name: Build binaries
run: |
rustup default nightly-2025-08-01
rustup install nightly-2025-08-01
lscpu
# build binaries
cargo build --release --features vendored-openssl
# build the developer docs
cargo doc --no-deps
# make a glibc dir
mkdir glibc
# copy artifacts to the a glibc dir
mv target/release/thorium glibc/.
mv target/release/thoradm glibc/.
mv target/release/thorctl glibc/.
mv target/release/thorium-agent glibc/.
mv target/release/thorium-scaler glibc/.
mv target/release/thorium-reactor glibc/.
mv target/release/thorium-event-handler glibc/.
mv target/release/thorium-search-streamer glibc/.
mv target/release/thorium-operator glibc/.
mv target/doc dev_docs
- name: Upload glibc binaries as artifacts
uses: actions/upload-artifact@v4
with:
name: thorium-glibc-binaries
path: glibc/
- name: Upload dev docs as artifacts
uses: actions/upload-artifact@v4
with:
name: thorium-dev-docs-bundle
path: dev_docs/
build-cross-binaries:
name: Build Thorium Cross - ${{ matrix.platform.os-name }}
strategy:
matrix:
platform:
- os-name: Linux-x86_64
runs-on: ubuntu-24.04
target: x86_64-unknown-linux-musl
flags: "-C target-feature=+aes,+sse2"
#- os-name: Linux-aarch64
# runs-on: ubuntu-24.04
# target: aarch64-unknown-linux-musl
- os-name: macOS-x86_64
runs-on: macOS-latest
target: x86_64-apple-darwin
flags: "-C target-feature=+aes,+sse2"
- os-name: macOS-aarch64
runs-on: macOS-latest
target: aarch64-apple-darwin
flags: ""
runs-on: ${{ matrix.platform.runs-on }}
steps:
- uses: actions/checkout@v4
- name: Install bindgen-cli
run: |
grep -q "Ubuntu" /etc/os-release && sudo apt update && sudo apt install gcc build-essential libssl-dev pkg-config libclang-dev clang-15 musl-tools cmake libvirt-dev jq memstat sysstat -y
rustup target add ${{ matrix.platform.target }}
cargo install --target=${{ matrix.platform.target }} --force --locked bindgen-cli
- name: Build binary
uses: houseabsolute/actions-rust-cross@v1
env:
RUSTFLAGS: "${{ matrix.platform.flags }}"
with:
command: build
target: ${{ matrix.platform.target }}
toolchain: nightly-2025-08-01
args: "--features vendored-openssl --release"
strip: true
- name: Upload ${{ matrix.platform.target }} binary artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform.target }}-binaries
path: target/${{ matrix.platform.target }}/release
build-windows-cross-binaries:
name: Build Thorium Cross - Windows ${{ matrix.build-target.name }}
strategy:
matrix:
build-target:
- path: "./agent"
name: agent
- path: "./thorctl"
name: thorctl
- path: "./reactor"
name: reactor
# This needs to run on Ubuntu or agent builds fail
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-C target-feature=+aes,+sse2"
steps:
- uses: actions/checkout@v4
- name: Install bindgen-cli
run: |
sudo apt update && sudo apt install gcc gcc-mingw-w64-x86-64 build-essential libssl-dev pkg-config libclang-dev clang-15 musl-tools cmake libvirt-dev jq memstat sysstat -y
rustup target add x86_64-pc-windows-gnu
cargo install --target=x86_64-pc-windows-gnu --force --locked bindgen-cli
- name: Build Windows Cross ${{ matrix.build-target.name }} Binary
uses: houseabsolute/actions-rust-cross@v1
with:
command: build
target: x86_64-pc-windows-gnu
toolchain: nightly
args: "--features vendored-openssl --release"
strip: true
working-directory: ${{ matrix.build-target.path }}
- name: Upload ${{ matrix.build-target.name }} x86_64-pc-windows-gnu binary artifact
uses: actions/upload-artifact@v4
with:
name: x86_64-pc-windows-gnu-${{ matrix.build-target.name }}
path: target/x86_64-pc-windows-gnu/release
build-core-container:
if: |
(github.ref_type == 'branch' && github.ref == 'refs/heads/main') ||
github.ref_type == 'tag'
needs:
- build-mdbook-docs
- build-ui-bundle
- build-glibc-binaries
- build-cross-binaries
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download UI Bundle Artifacts
uses: actions/download-artifact@v4
with:
name: thorium-ui-bundle
path: ui/dist
- name: Download mdBook Bundle Artifacts
uses: actions/download-artifact@v4
with:
name: thorium-mdbook-bundle
path: user_docs
- name: Download Developer Docs Artifacts
uses: actions/download-artifact@v4
with:
name: thorium-dev-docs-bundle
path: dev_docs
- name: Download Thorium glibc Binary Artifacts
uses: actions/download-artifact@v4
with:
name: thorium-glibc-binaries
path: glibc
- name: Download Thorium musl Binary Artifacts
uses: actions/download-artifact@v4
with:
name: x86_64-unknown-linux-musl-binaries
path: musl
#- name: Download Thorium Linux aarch64 Binary artifacts
# uses: actions/download-artifact@v4
# with:
# name: aarch64-unknown-linux-musl-binaries
# path: aarch
- name: Download Thorium Windows Agent Artifact
uses: actions/download-artifact@v4
with:
name: x86_64-pc-windows-gnu-agent
path: windows/agent
- name: Download Thorium Windows Thorctl Artifact
uses: actions/download-artifact@v4
with:
name: x86_64-pc-windows-gnu-thorctl
path: windows/thorctl
- name: Download Thorium Windows Reactor Artifact
uses: actions/download-artifact@v4
with:
name: x86_64-pc-windows-gnu-reactor
path: windows/reactor
- name: Download Thorium macos x86_64 Binary Artifacts
uses: actions/download-artifact@v4
with:
name: x86_64-apple-darwin-binaries
path: macos/x86_64
- name: Download Thorium macos aarch64 Binary Artifacts
uses: actions/download-artifact@v4
with:
name: aarch64-apple-darwin-binaries
path: macos/aarch64
- name: Login to Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Stage Artifacts For Container Build
run: |
mkdir -p glibc
mkdir -p target/release
mkdir -p target/doc
mkdir -p api/docs/book
mkdir -p target/x86_64-unknown-linux-musl/release
mkdir -p target/x86_64-pc-windows-gnu/release
mkdir -p target/x86_64-apple-darwin/release
mkdir -p target/aarch64-apple-darwin/release
mkdir -p target/aarch64-unknown-linux-musl/release
mv user_docs api/docs/book
mv dev_docs/* target/doc/.
mv glibc/* target/release/.
mv musl/* target/x86_64-unknown-linux-musl/release/.
# mv aarch64/* target/aarch64-unknown-linux-musl/release/.
mv windows/agent/thorium-agent.exe target/x86_64-pc-windows-gnu/release/
mv windows/thorctl/thorctl.exe target/x86_64-pc-windows-gnu/release/
mv windows/reactor/thorium-reactor.exe target/x86_64-pc-windows-gnu/release/
mv macos/x86_64/* target/x86_64-apple-darwin/release/.
mv macos/aarch64/* target/aarch64-apple-darwin/release/.
- name: Build Thorium Container Image
run: |
IMAGE_PATH=ghcr.io/${{ github.repository }}/infrastructure/thorium
LOWER_IMAGE_PATH=$(echo $IMAGE_PATH | tr '[A-Z]' '[a-z]')
# Build base docker image
if [[ "${{ github.ref_type }}" == "tag" ]]; then
TAG="${{ github.ref_name }}"
elif [[ "${{ github.ref_type }}" == "branch" && "${{ github.ref }}" == "refs/heads/main" ]]; then
TAG=main
fi
IMAGE=$LOWER_IMAGE_PATH:$TAG
docker build --file ./Dockerfile --tag $IMAGE --label "runnumber=${GITHUB_RUN_ID}" .
docker push $IMAGE
# now check if tag is latest so can build correct latest tag
LATEST_TAG=$(git tag | sort --version-sort | grep -E "[0-9]+\.[0-9]+\.[0-9]+$" | tail -n1)
if [[ "${{ github.ref_type }}" == "tag" && "${{ github.ref_name }}" == $LATEST_TAG ]]; then
echo "Pushing latest release image"
docker tag $IMAGE $LOWER_IMAGE_PATH:latest
docker push $LOWER_IMAGE_PATH:latest
fi
# Deploy the updated mdbook docs to github pages
# We only deploy docs if the container images build successfully
deploy-updated-pages:
if: ${{ github.ref_type == 'branch' && github.ref == 'refs/heads/main'}}
needs:
- build-mdbook-docs
- build-core-container
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4