mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
161 lines
5.5 KiB
YAML
161 lines
5.5 KiB
YAML
# This workflow builds and tests the binary on various MacOS configurations.
|
|
name: MacOS
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
build_dir:
|
|
description: 'The directory where to build.'
|
|
required: false
|
|
type: string
|
|
default: '.build'
|
|
conan_remote_name:
|
|
description: 'The name of the Conan remote to use.'
|
|
required: true
|
|
type: string
|
|
conan_remote_url:
|
|
description: 'The URL of the Conan remote to use.'
|
|
required: true
|
|
type: string
|
|
secrets:
|
|
conan_remote_username:
|
|
description: 'The username for logging into the Conan remote.'
|
|
required: true
|
|
conan_remote_password:
|
|
description: 'The password for logging into the Conan remote.'
|
|
required: true
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}-macos
|
|
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.
|
|
STRATEGY_MATRIX_ARCHITECTURE: >-
|
|
[
|
|
{
|
|
"runner": ["self-hosted", "macOS", "ARM64", "mac-runner-m1"]
|
|
}
|
|
]
|
|
STRATEGY_MATRIX_BUILD_TYPE: >-
|
|
[
|
|
"Debug",
|
|
"Release"
|
|
]
|
|
STRATEGY_MATRIX_CMAKE_ARGS: >-
|
|
[
|
|
"-DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DUnity=OFF",
|
|
"-DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DUnity=ON"
|
|
]
|
|
# STRATEGY_MATRIX_ARCHITECTURE: >-
|
|
# [
|
|
# {
|
|
# "runner": ["self-hosted", "macOS", "ARM64", "mac-runner-m1"]
|
|
# }
|
|
# ]
|
|
# STRATEGY_MATRIX_BUILD_TYPE: >-
|
|
# [
|
|
# "Release"
|
|
# ]
|
|
# STRATEGY_MATRIX_CMAKE_ARGS: >-
|
|
# [
|
|
# "-DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DUnity=ON"
|
|
# ]
|
|
|
|
jobs:
|
|
# Generate the strategy matrix and expose environment variables to be used by
|
|
# following jobs. Exposing env vars this way is needed as they cannot be
|
|
# directly passed as inputs to reusable workflows (although they can be passed
|
|
# as inputs to actions).
|
|
generate-outputs:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Generate outputs
|
|
id: generate
|
|
run: |
|
|
echo "strategy_matrix_architecture=$(jq -c <<< '${{ env.STRATEGY_MATRIX_ARCHITECTURE }}')" >> "$GITHUB_OUTPUT"
|
|
echo "strategy_matrix_build_type=$(jq -c <<< '${{ env.STRATEGY_MATRIX_BUILD_TYPE }}')" >> "$GITHUB_OUTPUT"
|
|
echo "strategy_matrix_cmake_args=$(jq -c <<< '${{ env.STRATEGY_MATRIX_CMAKE_ARGS }}')" >> "$GITHUB_OUTPUT"
|
|
outputs:
|
|
conan_global_conf: ${{ env.CONAN_GLOBAL_CONF }}
|
|
strategy_matrix_architecture: ${{ steps.generate.outputs.strategy_matrix_architecture }}
|
|
strategy_matrix_build_type: ${{ steps.generate.outputs.strategy_matrix_build_type }}
|
|
strategy_matrix_cmake_args: ${{ steps.generate.outputs.strategy_matrix_cmake_args }}
|
|
|
|
# Install and cache the dependencies, and then build and test the binary using
|
|
# various configurations.
|
|
build-test:
|
|
needs:
|
|
- generate-outputs
|
|
runs-on: ${{ matrix.architecture.runner }}
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: 4
|
|
matrix:
|
|
architecture: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_architecture) }}
|
|
build_type: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_build_type) }}
|
|
cmake_args: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_cmake_args) }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
- name: Check configuration
|
|
shell: bash
|
|
run: |
|
|
echo "Checking path"
|
|
echo ${PATH} | tr ':' '\n'
|
|
|
|
echo "Checking environment variables."
|
|
env | sort
|
|
- name: Check versions
|
|
shell: bash
|
|
run: |
|
|
echo "Checking CMake version."
|
|
cmake --version
|
|
|
|
echo "Checking compiler version."
|
|
clang --version
|
|
|
|
echo "Checking Conan version."
|
|
conan --version
|
|
|
|
echo "Checking Ninja version."
|
|
ninja --version
|
|
- name: Configure Conan
|
|
uses: ./.github/actions/configure-conan
|
|
with:
|
|
conan_global_conf: ${{ inputs.conan_global_conf }}
|
|
conan_remote_name: ${{ inputs.conan_remote_name }}
|
|
conan_remote_url: ${{ inputs.conan_remote_url }}
|
|
conan_remote_username: ${{ secrets.conan_remote_username }}
|
|
conan_remote_password: ${{ secrets.conan_remote_password }}
|
|
- name: Install dependencies
|
|
uses: ./.github/actions/install-dependencies
|
|
with:
|
|
build_dir: ${{ inputs.build_dir }}
|
|
build_type: ${{ matrix.build_type }}
|
|
conan_remote_name: ${{ inputs.conan_remote_name }}
|
|
- name: Build and test the binary
|
|
uses: ./.github/actions/build-test
|
|
with:
|
|
build_dir: ${{ inputs.build_dir }}
|
|
build_type: ${{ matrix.build_type }}
|
|
cmake_args: ${{ matrix.cmake_args }}
|
|
cmake_generator: 'Ninja'
|
|
cmake_target: 'all'
|
|
os: 'MacOS'
|