datahaven/.github/workflows/task-build-operator.yml
Steve Degosserie b1f21e7a96
fix: Resolve CI workflow configuration issues (#143)
## Summary

This PR resolves all CI failures following the migration to the new
DataHaven Github & Docker Hub organizations, and correctly leverage
self-hosted GitHub runners (`DH-runners` group) by eliminating sudo
dependencies.

## Key Changes

### 🔧 **Eliminated sudo requirements across all workflows**
- **Setup Environment**: Installed mold linker and system dependencies
in userspace without sudo
- **Tool Installation**: Replaced apt/system package installations with
direct binary downloads:
  - Kurtosis: Direct binary download from GitHub releases (v1.10.3)
  - Taplo: Direct binary installation for Cargo.toml formatting
- cargo-nextest: Using `cargo install` instead of GitHub action
(v0.9.100)
- **Runner Cleanup**: Skipped cleanup-runner action entirely on
self-hosted runners (bare-metal manages disk space externally)

### 🏷️ **Workflow optimizations**
- **Group-based targeting**: All heavy workloads (Rust builds, E2E
tests) now run on `DH-runners` runners
- **Dependency management**: Used `install-deps: false` flag instead of
hardcoded runner detection

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-02 13:02:13 +02:00

80 lines
2.6 KiB
YAML

# Build Operator: CI for building the operator binary
name: DataHaven Operator Binary Build
on:
workflow_dispatch:
workflow_call:
outputs:
binary-hash:
description: "The hash of the operator binary"
value: ${{ jobs.build-node.outputs.binary-hash }}
jobs:
build-node:
outputs:
binary-hash: ${{ steps.hash-binary.outputs.datahaven-node-hash }}
name: Build operator binary
runs-on:
group: DH-runners
env:
RUSTC_WRAPPER: "sccache"
CARGO_INCREMENTAL: "0"
CARGO_TERM_COLOR: always
RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=mold"
SCCACHE_GHA_ENABLED: "true"
defaults:
run:
working-directory: ./operator
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 1
# Re-enable if you get GH issues with the runner being full
# - uses: ./.github/workflows/actions/cleanup-runner
- uses: ./.github/workflows/actions/setup-env
with:
cache-key: BUILD-RELEASE
install-deps: false # Self-hosted runners have deps pre-installed
- name: Build node binary
run: |
cargo build --release --locked --features fast-runtime
- name: Prepare binary
run: |
mkdir -p ./target/ci
mkdir -p ./target/x86_64-unknown-linux-gnu/release
cp ./target/release/datahaven-node ./target/ci/datahaven-node
cp ./target/release/datahaven-node ./target/x86_64-unknown-linux-gnu/release/datahaven-node
- name: Hash binary
id: hash-binary
run: |
TIMESTAMP=$(date +%s)
BINARY_PATH=./target/ci/datahaven-node
HASH=$(echo "$TIMESTAMP" | cat - $BINARY_PATH | sha256sum | awk '{ print $1 }')
echo "datahaven-node-hash=$HASH" >> $GITHUB_OUTPUT
echo "Hash of the datahaven-node is: $HASH (with timestamp: $TIMESTAMP)"
- name: Upload binary to workflow
uses: actions/upload-artifact@v4
with:
name: datahaven-node-${{ steps.hash-binary.outputs.datahaven-node-hash }}
path: operator/target/x86_64-unknown-linux-gnu/release/datahaven-node
retention-days: 1
- name: Upload WASM to workflow
uses: actions/upload-artifact@v4
with:
name: datahaven-wasm-${{ steps.hash-binary.outputs.datahaven-node-hash }}
path: operator/target/release/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.wasm
retention-days: 1
- name: Build Stats
run: |
sccache --show-stats
echo "Binary size: $(du -h ./target/ci/datahaven-node | cut -f1)"