Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions .github/workflows/build-cln.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
name: Build CLN
on:
workflow_call:
inputs:
cfg:
description: 'Configuration name (e.g., compile-gcc)'
required: true
type: string
compiler:
description: 'Compiler to use (gcc or clang)'
required: true
type: string
valgrind:
description: 'Enable valgrind (0 or 1)'
required: false
type: number
default: 1
asan:
description: 'Enable address sanitizer (0 or 1)'
required: false
type: number
default: 0
ubsan:
description: 'Enable undefined behavior sanitizer (0 or 1)'
required: false
type: number
default: 0
coptflags:
description: 'Additional compiler optimization flags'
required: false
type: string
default: ''
os:
description: 'Operating system (ubuntu-22.04 or macos-14)'
required: false
type: string
default: 'ubuntu-22.04'

env:
RUST_PROFILE: release
SLOW_MACHINE: 1

jobs:
build:
name: Build CLN ${{ inputs.cfg }}
runs-on: ${{ inputs.os }}
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install dependencies (Linux)
if: ${{ inputs.os == 'ubuntu-22.04' }}
run: |
bash -x .github/scripts/setup.sh

- name: Install dependencies (macOS)
if: ${{ startsWith(inputs.os, 'macos-') }}
env:
GRPC_PYTHON_BUILD_SYSTEM_OPENSSL: 1
GRPC_PYTHON_BUILD_SYSTEM_ZLIB: 1
run: |
export PATH="/usr/local/opt:/Users/runner/.local/bin:/opt/homebrew/bin/python3.10/bin:$PATH"
brew install gnu-sed autoconf automake libtool protobuf openssl lowdown libsodium
uv sync --all-groups

- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9

- name: Build
env:
COMPILER: ${{ inputs.compiler }}
ASAN: ${{ inputs.asan }}
UBSAN: ${{ inputs.ubsan }}
VALGRIND: ${{ inputs.valgrind }}
COMPAT: 1
CFG: ${{ inputs.cfg }}
RUSTC_WRAPPER: sccache
# macOS-specific environment variables
CPATH: ${{ startsWith(inputs.os, 'macos-') && '/opt/homebrew/include' || '' }}
LIBRARY_PATH: ${{ startsWith(inputs.os, 'macos-') && '/opt/homebrew/lib' || '' }}
GRPC_PYTHON_BUILD_SYSTEM_OPENSSL: ${{ startsWith(inputs.os, 'macos-') && '1' || '' }}
GRPC_PYTHON_BUILD_SYSTEM_ZLIB: ${{ startsWith(inputs.os, 'macos-') && '1' || '' }}
run: |
set -e

# Determine configure flags based on OS
if [[ "${{ inputs.os }}" == ubuntu-* ]]; then
CONFIGURE_FLAGS="--enable-debugbuild"
CC_WRAPPER="sccache $COMPILER"
else
# macOS: disable valgrind (not available) and compat
CONFIGURE_FLAGS="--disable-valgrind --disable-compat"
CC_WRAPPER="$COMPILER"
fi

./configure $CONFIGURE_FLAGS CC="$CC_WRAPPER" ${{ inputs.coptflags }}

uv run make -j $(nproc) testpack.tar.bz2

# Rename now so we don't clash
mv testpack.tar.bz2 cln-${CFG}.tar.bz2

- name: Check rust packages
env:
RUSTC_WRAPPER: sccache
run: cargo test --all

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: cln-${{ inputs.cfg }}.tar.bz2
path: cln-${{ inputs.cfg }}.tar.bz2
Loading
Loading