datahaven/.github/workflows/task-build-static-operator.yaml
undercover-cactus a8d811fde8
feat: add feature to build binary with postgres bundled (#346)
## Summary

Re-add the static build feature option to bundle postgres dependency
into the binary. It simplify the installation because now to run the
node the operator doesn't need to have postgres dependencies installed
on its system.

## What changed ?

* Added a `static` feature that can be activated to add the extra
dependencies during the build.
* A task that run every time a dependency has been modified so we can
make sure the build with the feature is still working correctly. (we are
assuming simple change in the code won't have an impact on it because
postgres is being used in diesel which is not a direct dependecy to
datahaven).
2026-01-06 13:13:25 +00:00

45 lines
No EOL
1.1 KiB
YAML

name: DataHaven Operator Static Build
on:
pull_request:
paths:
# Only check the build if we are adding a dependency to save runner time
- 'operator/Cargo.toml'
- 'operator/Cargo.lock'
jobs:
build-node:
name: Build operator binary
runs-on:
group: DH-runners
env:
RUSTC_WRAPPER: "sccache"
CARGO_INCREMENTAL: "0"
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: "true"
defaults:
run:
working-directory: ./operator
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 1
- uses: ./.github/workflows/actions/setup-env
with:
cache-key: BUILD-RELEASE
install-deps: false
skip-libpq: true
- name: Set build flags
run: echo "RUSTFLAGS=-C linker=clang -C link-arg=-fuse-ld=mold" >> $GITHUB_ENV
- name: Build node binary
run: |
cargo build --release --locked --features fast-runtime,static
- name: Test binary
run: |
ldd ./target/release/datahaven-node
./target/release/datahaven-node --version