mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
71 lines
3.0 KiB
YAML
71 lines
3.0 KiB
YAML
# This workflow is used to generate a strategy matrix for Linux, Windows, and
|
|
# MacOS build and test jobs.
|
|
name: generate-matrix
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
runner:
|
|
description: 'An optional string representing the GitHub runner to use.'
|
|
required: true
|
|
type: string
|
|
architecture:
|
|
description: 'A string representing a JSON array holding objects containing the "platform" (e.g. "linux/arm64") and "runner" (e.g. "ubuntu-24.04-arm") to use.'
|
|
required: true
|
|
type: string
|
|
os:
|
|
description: 'A string representing a JSON array holding objects containing the "distro" (e.g. "debian"), "release" (e.g. "bookworm"), "compiler_name" (e.g. "gcc") and "compiler_version" (e.g. "13") to use.'
|
|
required: true
|
|
type: string
|
|
build_type:
|
|
description: 'A string representing a JSON array holding strings with the build type (e.g. "Debug", "Release") to use.'
|
|
required: true
|
|
type: string
|
|
cmake_args:
|
|
description: 'A string representing a JSON array holding strings with the CMake arguments (e.g. "-DUnity=ON", "-DUnity=OFF") to use. Multiple arguments can be specified by separating them with a space (e.g. "-DUnity=ON -DVoidstar=ON").'
|
|
required: true
|
|
type: string
|
|
|
|
# Generate the JSON outputs by using JQ to compact the JSON string.
|
|
# * This workflow can be called as follows:
|
|
# ```yaml
|
|
# generate-matrix:
|
|
# uses: ./.github/workflows/generate-matrix.yml
|
|
# with:
|
|
# architecture: ${{ env.STRATEGY_MATRIX_ARCHITECTURE }}
|
|
# os: ${{ env.STRATEGY_MATRIX_OS }}
|
|
# build_type: ${{ env.STRATEGY_MATRIX_BUILD_TYPE }}
|
|
# cmake_args: ${{ env.STRATEGY_MATRIX_UNITY }}
|
|
# ```
|
|
# * This workflow can be used as follows:
|
|
# ```yaml
|
|
# use-matrix:
|
|
# needs: generate-matrix
|
|
# 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) }}
|
|
# runs-on: ${{ matrix.architecture.runner }}
|
|
# container: ghcr.io/xrplf/ci/${{ matrix.os.distro }}-${{ matrix.os.release }}:${{ matrix.os.compiler_name }}-${{ matrix.os.compiler_version }}
|
|
# ...
|
|
# ```
|
|
jobs:
|
|
generate-matrix:
|
|
runs-on: ${{ inputs.runner }}
|
|
steps:
|
|
- name: Generate outputs
|
|
id: generate
|
|
run: |
|
|
echo "architecture=$(jq -c <<< '${{ inputs.architecture }}')" >> "$GITHUB_OUTPUT"
|
|
echo "os=$(jq -c <<< '${{ inputs.os }}')" >> "$GITHUB_OUTPUT"
|
|
echo "build_type=$(jq -c <<< '${{ inputs.build_type }}')" >> "$GITHUB_OUTPUT"
|
|
echo "cmake_args=$(jq -c <<< '${{ inputs.cmake_args }}')" >> "$GITHUB_OUTPUT"
|
|
outputs:
|
|
architecture: ${{ steps.generate.outputs.architecture }}
|
|
os: ${{ steps.generate.outputs.os }}
|
|
build_type: ${{ steps.generate.outputs.build_type }}
|
|
cmake_args: ${{ steps.generate.outputs.cmake_args }}
|