Files
rippled/.github/workflows/build-debian.yml
2025-07-27 12:08:13 -04:00

191 lines
5.9 KiB
YAML

# This workflow builds and tests the binary on various Debian configurations.
name: Debian
on:
workflow_call:
inputs:
build_dir:
description: 'The directory where the build will take place.'
required: false
type: string
default: '.build'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-debian
cancel-in-progress: true
defaults:
run:
shell: bash
env:
# Global configuration for Conan. This is used to set the number of parallel
# downloads, uploads, and build jobs. The verbosity is set to verbose to
# provide more information during the build process.
CONAN_GLOBAL_CONF: |
core.download:parallel={{ os.cpu_count() }}
core.upload:parallel={{ os.cpu_count() }}
tools.build:jobs={{ (os.cpu_count() * 4/5) | int }}
tools.build:verbosity=verbose
tools.compilation:verbosity=verbose
# GitHub does not allow us to specify a reusable matrix strategy, so to avoid
# duplication, we define it here using environment variables and create the
# matrix in the first job. The matrix defined below should be kept in sync
# with https://github.com/XRPLF/ci/blob/main/.github/workflows/debian.yml.
# STRATEGY_MATRIX_ARCHITECTURE: >-
# [
# {
# "platform": "linux/amd64",
# "runner": "ubuntu-24.04"
# },
# {
# "platform": "linux/arm64",
# "runner": "ubuntu-24.04-arm"
# }
# ]
# STRATEGY_MATRIX_OS: >-
# [
# {
# "distro": "debian",
# "release": "bookworm",
# "compiler_name": "gcc",
# "compiler_version": "12"
# },
# {
# "distro": "debian",
# "release": "bookworm",
# "compiler_name": "gcc",
# "compiler_version": "13"
# },
# {
# "distro": "debian",
# "release": "bookworm",
# "compiler_name": "gcc",
# "compiler_version": "14"
# },
# {
# "distro": "debian",
# "release": "bookworm",
# "compiler_name": "clang",
# "compiler_version": "16"
# },
# {
# "distro": "debian",
# "release": "bookworm",
# "compiler_name": "clang",
# "compiler_version": "17"
# },
# {
# "distro": "debian",
# "release": "bookworm",
# "compiler_name": "clang",
# "compiler_version": "18"
# },
# {
# "distro": "debian",
# "release": "bookworm",
# "compiler_name": "clang",
# "compiler_version": "19"
# }
# ]
# STRATEGY_MATRIX_BUILD_TYPE: >-
# [
# "Debug",
# "Release"
# ]
# STRATEGY_MATRIX_CMAKE_ARGS: >-
# [
# "-DUnity=OFF",
# "-DUnity=ON"
# ]
STRATEGY_MATRIX_ARCHITECTURE: >-
[
{
"platform": "linux/amd64",
"runner": "ubuntu-24.04"
}
]
STRATEGY_MATRIX_OS: >-
[
{
"distro": "debian",
"release": "bookworm",
"compiler_name": "gcc",
"compiler_version": "12"
}
]
STRATEGY_MATRIX_BUILD_TYPE: >-
[
"Debug"
]
STRATEGY_MATRIX_CMAKE_ARGS: >-
[
"-DUnity=ON"
]
jobs:
# Expose environment variables used by other jobs. This is a workaround, as
# environment variables cannot be passed as inputs to reusable workflows. They
# can, however, be passed as inputs to actions.
expose-env:
runs-on: ubuntu-latest
steps:
- name: Expose environment variables
run: echo ""
outputs:
conan_global_conf: ${{ env.CONAN_GLOBAL_CONF }}
# Generate the strategy matrix.
generate-matrix:
runs-on: ubuntu-latest
steps:
- name: Generate strategy matrix
uses: ./.github/actions/generate-matrix
with:
architecture: ${{ env.STRATEGY_MATRIX_ARCHITECTURE }}
os: ${{ env.STRATEGY_MATRIX_OS }}
build_type: ${{ env.STRATEGY_MATRIX_BUILD_TYPE }}
cmake_args: ${{ env.STRATEGY_MATRIX_UNITY }}
# Install and cache the dependencies using various configurations.
install-dependencies:
needs:
- expose-env
- generate-matrix
uses: ./.github/workflows/install-dependencies.yml
strategy:
fail-fast: false
matrix:
architecture: ${{ fromJson(needs.generate-matrix.outputs.architecture) }}
os: ${{ fromJson(needs.generate-matrix.outputs.os) }}
build_type: ${{ fromJson(needs.generate-matrix.outputs.build_type) }}
with:
build_dir: ${{ inputs.build_dir }}
build_type: ${{ strategy.matrix.build_type }}
conan_global_conf: ${{ needs.expose-env.outputs.conan_global_conf }}
container: ghcr.io/xrplf/ci/${{ strategy.matrix.os.distro }}-${{ strategy.matrix.os.release }}:${{ strategy.matrix.os.compiler_name }}-${{ strategy.matrix.os.compiler_version }}
runner: ${{ strategy.matrix.architecture.runner }}
# Build and test the binary using various configurations.
build-and-test:
needs:
- expose-env
- generate-matrix
- install-dependencies
uses: ./.github/workflows/build-nix.yml
strategy:
fail-fast: false
matrix:
architecture: ${{ fromJson(needs.generate-matrix.outputs.architecture) }}
os: ${{ fromJson(needs.generate-matrix.outputs.os) }}
build_type: ${{ fromJson(needs.generate-matrix.outputs.build_type) }}
cmake_args: ${{ fromJson(needs.generate-matrix.outputs.cmake_args) }}
with:
build_dir: ${{ inputs.build_dir }}
build_type: ${{ strategy.matrix.build_type }}
cmake_args: ${{ strategy.matrix.cmake_args }}
cmake_generator: "Ninja"
conan_global_conf: ${{ needs.expose-env.outputs.conan_global_conf }}
container: ghcr.io/xrplf/ci/${{ strategy.matrix.os.distro }}-${{ strategy.matrix.os.release }}:${{ strategy.matrix.os.compiler_name }}-${{ strategy.matrix.os.compiler_version }}
runner: ${{ strategy.matrix.architecture.runner }}