Skip to content

Release v0.81.0

Release v0.81.0 #52

Workflow file for this run

# Release workflow: build all binaries + containers, run tests, publish release.
#
# Triggered by pushing a version tag:
# git tag v0.68.0
# git push origin v0.68.0
#
# Produces for each platform (linux-x86_64, linux-arm64, macos-arm64):
# - morloc-manager (Rust binary)
# - libmorloc.so (Rust runtime library; .dylib on macOS)
# - morloc-nexus (Rust binary)
#
# All three are attached to the GitHub Release.
name: Release
on:
push:
tags: ['v*']
env:
REGISTRY: ghcr.io
IMAGE_BASE: ghcr.io/morloc-project/morloc
jobs:
# ---- Build Rust binaries (libmorloc + morloc-nexus + morloc-manager) per platform ----
rust-binary:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux-x86_64
method: docker
- os: ubuntu-24.04-arm
platform: linux-arm64
method: docker
- os: macos-latest
platform: macos-arm64
method: native
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
# ---- Linux: Docker container build ----
# libmorloc.so + morloc-nexus: glibc (Ubuntu 20.04)
# morloc-manager: static (Alpine/musl)
- name: Build Rust binaries (Linux)
if: matrix.method == 'docker'
run: |
docker build -t morloc-rust-build \
-f container/static-build/Dockerfile .
mkdir -p out
docker run --rm -v "$(pwd)/out:/out" morloc-rust-build
# Verify morloc-manager is static
file out/morloc-manager | grep -qE "static(ally|-pie) linked"
- name: Rename artifacts (Linux)
if: matrix.method == 'docker'
run: |
mv out/libmorloc.so out/libmorloc-${{ matrix.platform }}.so
mv out/morloc-nexus out/morloc-nexus-${{ matrix.platform }}
mv out/morloc-manager out/morloc-manager-${{ matrix.platform }}
# ---- macOS: native cargo build ----
- name: Setup Rust (macOS)
if: matrix.method == 'native'
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo (macOS)
if: matrix.method == 'native'
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
data/rust/target
key: cargo-macos-${{ hashFiles('data/rust/Cargo.lock') }}
restore-keys: cargo-macos-
- name: Build Rust binaries (macOS)
if: matrix.method == 'native'
run: |
cd data/rust
# Build libmorloc (cdylib produces .dylib on macOS)
cargo build --release -p morloc-runtime
# Install .dylib so nexus can link against it
mkdir -p $HOME/.local/share/morloc/lib
cp target/release/libmorloc_runtime.dylib $HOME/.local/share/morloc/lib/libmorloc.dylib
# Build nexus
cargo build --release -p morloc-nexus
# Build manager
cargo build --release -p morloc-manager
# Collect artifacts
mkdir -p ../../out
cp target/release/libmorloc_runtime.dylib ../../out/libmorloc-${{ matrix.platform }}.dylib
cp target/release/morloc-nexus ../../out/morloc-nexus-${{ matrix.platform }}
cp target/release/morloc-manager ../../out/morloc-manager-${{ matrix.platform }}
strip ../../out/morloc-nexus-${{ matrix.platform }} || true
strip ../../out/morloc-manager-${{ matrix.platform }} || true
- name: Upload Rust artifacts
uses: actions/upload-artifact@v4
with:
name: rust-binaries-${{ matrix.platform }}
path: out/*
# ---- Run tests using the Rust binaries ----
test:
needs: rust-binary
runs-on: ubuntu-latest
timeout-minutes: 60
env:
DEBIAN_FRONTEND: noninteractive
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
with:
ghc-version: '9.6.7'
enable-stack: true
stack-version: 'latest'
- uses: actions/cache@v4
with:
path: |
~/.stack/snapshots
~/.stack/setup-exe-cache
.stack-work
key: stack-deps-release-${{ hashFiles('stack.yaml.lock', 'package.yaml') }}
restore-keys: stack-deps-release-
- name: Increase shared memory
run: sudo mount -o remount,size=4G /dev/shm
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
r-base-core python3 python3-dev python3-pip \
python3-numpy g++ gcc make libgsl-dev
python3 -m pip install --break-system-packages --upgrade setuptools pyarrow
- name: Cache R packages
uses: actions/cache@v4
id: r-cache
with:
path: ~/R/library
key: r-lib-${{ runner.os }}-${{ runner.arch }}
- name: Install R packages
if: steps.r-cache.outputs.cache-hit != 'true'
run: |
mkdir -p ~/R/library
LIBARROW_MINIMAL=true ARROW_S3=OFF ARROW_GCS=OFF \
Rscript -e 'install.packages("arrow", lib="~/R/library", repos = "https://cloud.r-project.org")'
- name: Download Rust binaries
uses: actions/download-artifact@v4
with:
name: rust-binaries-linux-x86_64
path: rust-bin
- name: Prepare Rust binaries
run: |
mkdir -p prebuilt
mv rust-bin/libmorloc-linux-x86_64.so prebuilt/libmorloc.so
mv rust-bin/morloc-nexus-linux-x86_64 prebuilt/morloc-nexus
mv rust-bin/morloc-manager-linux-x86_64 prebuilt/morloc-manager
chmod +x prebuilt/libmorloc.so prebuilt/morloc-nexus prebuilt/morloc-manager
- name: Add morloc to PATH
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "$HOME/.local/share/morloc/bin" >> $GITHUB_PATH
echo "R_LIBS_USER=$HOME/R/library" >> $GITHUB_ENV
- name: Build morloc
run: stack install --system-ghc --no-install-ghc --no-run-tests
- name: Initialize morloc (using pre-built Rust binaries)
run: |
MORLOC_RUST_BIN=$(pwd)/prebuilt morloc init -f
morloc install stdlib
- name: Run tests
run: stack test --system-ghc --no-install-ghc morloc:morloc-test
timeout-minutes: 10
# ---- Build and push container images ----
containers:
needs: test
runs-on: ubuntu-latest
timeout-minutes: 120
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: Extract version from tag
id: ver
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build tiny (from local source)
run: |
docker build \
-t ${{ env.IMAGE_BASE }}/morloc-tiny:${{ steps.ver.outputs.version }} \
-t ${{ env.IMAGE_BASE }}/morloc-tiny:edge \
-f container/tiny/Dockerfile .
- name: Build full (uses local tiny)
run: |
docker build \
--build-arg MORLOC_VERSION=${{ steps.ver.outputs.version }} \
-t ${{ env.IMAGE_BASE }}/morloc-full:${{ steps.ver.outputs.version }} \
-t ${{ env.IMAGE_BASE }}/morloc-full:edge \
container/full/
- name: Push all images
run: |
for img in morloc-tiny morloc-full; do
docker push ${{ env.IMAGE_BASE }}/${img}:${{ steps.ver.outputs.version }}
docker push ${{ env.IMAGE_BASE }}/${img}:edge
done
# ---- Create GitHub Release ----
release:
if: always() && needs.containers.result == 'success'
needs: [containers, rust-binary]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: 'rust-binaries-*'
merge-multiple: true
- name: List artifacts
run: ls -lh
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
morloc-manager-*
libmorloc-*
morloc-nexus-*
generate_release_notes: true