Revert "feat: statically build binary (#292)" (#330)

This reverts commit f84b6debb7.
This commit is contained in:
Steve Degosserie 2025-12-02 15:42:43 +01:00 committed by GitHub
parent e38843455b
commit 51ffcae5f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 11 additions and 118 deletions

View file

@ -6,9 +6,6 @@ inputs:
target:
description: The CPU target for the binary
required: true
build:
description: If we should statically build it or not
required: false
runs:
using: "composite"
@ -27,7 +24,6 @@ runs:
--tag prod --no-cache \
--build-arg="COMMIT=${{ github.event.inputs.sha }}" \
--build-arg="RUSTFLAGS=-C target-cpu=${{ inputs.target }}" \
--build-arg="BUILD=${{ inputs.build }}" \
--file ./docker/datahaven-production.Dockerfile \
.
@ -50,29 +46,12 @@ runs:
docker rmi prod
- name: Save DataHaven node binary
if: inputs.build != 'static'
shell: bash
run: |
mkdir -p build
cp datahaven-node build/datahaven-node-${{ inputs.target }}
- name: Save DataHaven node binary
if: inputs.build == 'static'
shell: bash
run: |
mkdir -p build
cp datahaven-node build/datahaven-node-${{ inputs.target }}-static
- name: Upload binary
if: inputs.build != 'static'
uses: actions/upload-artifact@v4
with:
name: datahaven-binaries-${{inputs.target}}
path: build/datahaven-node-${{inputs.target }}
- name: Upload binary
if: inputs.build == 'static'
uses: actions/upload-artifact@v4
with:
name: datahaven-binaries-${{inputs.target}}-static
path: build/datahaven-node-${{inputs.target }}-static

View file

@ -12,11 +12,6 @@ inputs:
required: false
default: "true"
skip-libpq:
description: "Indicate to skip postgres lib install or not"
required: false
default: "false"
runs:
using: "composite"
steps:
@ -73,16 +68,9 @@ runs:
shell: bash
run: sudo apt-get update && sudo apt-get install -y libpq-dev libclang-dev
# Install protoc only when install-deps is true
- name: Install Protoc
if: inputs.install-deps == 'true'
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ github.token }}
# Auto-install missing dependencies when install-deps is false (for self-hosted runners) can be skipped when statically build the node
# Auto-install missing dependencies when install-deps is false (for self-hosted runners)
- name: Setup system dependencies (self-hosted)
if: inputs.install-deps == 'false' && inputs.skip-libpq == 'false'
if: inputs.install-deps == 'false'
shell: bash
run: |
echo "Checking and installing system dependencies locally if needed..."
@ -184,7 +172,13 @@ runs:
echo "All required system dependencies ready!"
# Install protoc only when install-deps is true
- name: Install Protoc
if: inputs.install-deps == 'true'
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ github.token }}
# Auto-install protoc when install-deps is false (for self-hosted runners)
- name: Setup Protoc (self-hosted)
if: inputs.install-deps == 'false'

View file

@ -1,46 +0,0 @@
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=${{ env.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

View file

@ -38,12 +38,6 @@ jobs:
strategy:
matrix:
cpu: ["x86-64", "skylake", "znver3"]
build: ["default"]
exclude:
- cpu: skylake
build: static
- cpu: znver3
build: static
steps:
- name: Checkout
uses: actions/checkout@v5
@ -53,7 +47,6 @@ jobs:
uses: ./.github/workflow-templates/build-prod-binary
with:
target: ${{ matrix.cpu }}
build: ${{ matrix.build }}
####### Prepare and publish the release draft #######

View file

@ -7,7 +7,6 @@ FROM docker.io/library/ubuntu:22.04 AS builder
# Branch or tag to build DataHaven from
ARG COMMIT="main"
ARG RUSTFLAGS=""
ARG BUILD=""
ENV RUSTFLAGS=$RUSTFLAGS
ENV DEBIAN_FRONTEND=noninteractive
ENV PROTOC_VER=21.12
@ -38,11 +37,7 @@ WORKDIR /datahaven
RUN rustc --print target-cpus
RUN echo "*** Building DataHaven ***"
RUN if [ "$BUILD" = "static" ]; then \
cargo build --profile=production --all --features static
else \
cargo build --profile=production --all
fi
RUN cargo build --profile=production --all
FROM debian:stable-slim
LABEL maintainer="steve@moonsonglabs.com"

View file

@ -3,4 +3,4 @@ lto = "thin"
opt-level = 2
[registries.crates-io]
protocol = "sparse"
protocol = "sparse"

12
operator/Cargo.lock generated
View file

@ -3101,7 +3101,6 @@ dependencies = [
"pallet-transaction-payment-rpc",
"pallet-transaction-payment-rpc-runtime-api",
"parity-scale-codec",
"pq-sys",
"sc-basic-authorship",
"sc-cli",
"sc-client-api",
@ -11949,16 +11948,6 @@ dependencies = [
"zerocopy",
]
[[package]]
name = "pq-src"
version = "0.3.10+libpq-18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56ef39ce621f4993d6084fdcd4cbf1e01c84bdba53109cfad095d2cf441b85b9"
dependencies = [
"cc",
"openssl-sys",
]
[[package]]
name = "pq-sys"
version = "0.7.4"
@ -11967,7 +11956,6 @@ checksum = "089d5dc8f44104b719912ad4478fd558b59a431ce19ef9101f637be8c656b90a"
dependencies = [
"libc",
"pkg-config",
"pq-src",
"vcpkg",
]

View file

@ -305,10 +305,6 @@ shp-types = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v
## Precompiles
pallet-evm-precompile-file-system = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.2.0", default-features = false }
# Static linking
#### Needed to build static binaries ####
pq-sys = { version = "0.7.4" }
# The list of dependencies below (which can be both direct and indirect dependencies) are crates
# that are suspected to be CPU-intensive, and that are unlikely to require debugging (as some of
# their debug info might be missing) or to require to be frequently recompiled. We compile these

View file

@ -132,10 +132,6 @@ serde = { workspace = true, default-features = true }
cumulus-client-service = { workspace = true }
toml = { workspace = true }
# Static linking
#### Needed to build static binaries ####
pq-sys = { workspace = true, optional = true }
[build-dependencies]
substrate-build-script-utils = { workspace = true, default-features = true }
@ -148,7 +144,6 @@ std = [
"datahaven-testnet-runtime/std",
"shp-opaque/std"
]
static = ["pq-sys", "pq-sys/bundled"]
# Dependencies that are only required if runtime benchmarking should be build.
runtime-benchmarks = [

View file

@ -51,7 +51,6 @@ AUTHORS=(
)
NAMES=(
"ring" # v0.16.20 has null license metadata but contains Apache-2.0 AND ISC LICENSE file
"pq-src" # License is the same as postgres
"shp-tx-implicits-runtime-api"
)
licenses_filter=$(printf ' .license != "%s" and' "${LICENSES[@]}")