env is unavailable to pass to reusable workflows in 'with'

This commit is contained in:
Bart Thomee
2025-07-27 11:53:43 -04:00
parent 7acf9f517d
commit a3a5e57e18
6 changed files with 86 additions and 131 deletions

View File

@@ -5,22 +5,6 @@ inputs:
description: 'The contents of the global Conan configuration file.'
required: true
type: string
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
conan_remote_username:
description: 'The username for logging into the Conan remote.'
required: true
type: string
conan_remote_password:
description: 'The password for logging into the Conan remote.'
required: true
type: string
# Install the Conan profiles and log into the specified remote. We first remove
# the remote if it already exists, which can occur on self-hosted runners where
@@ -43,14 +27,14 @@ runs:
- name: Add Conan remote
shell: bash
run: |
if conan remote list | grep -q '${{ inputs.conan_remote_name }}'; then
conan remote remove ${{ inputs.conan_remote_name }}
echo "Removed Conan remote '${{ inputs.conan_remote_name }}'."
if conan remote list | grep -q '${{ vars.CONAN_REMOTE_NAME }}'; then
conan remote remove ${{ vars.CONAN_REMOTE_NAME }}
echo "Removed Conan remote '${{ vars.CONAN_REMOTE_NAME }}'."
fi
conan remote add --index 0 ${{ inputs.conan_remote_name }} ${{ inputs.conan_remote_url }}
echo "Added new conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}."
conan remote add --index 0 ${{ vars.CONAN_REMOTE_NAME }} ${{ vars.CONAN_REMOTE_URL }}
echo "Added new conan remote '${{ vars.CONAN_REMOTE_NAME }}' at ${{ vars.CONAN_REMOTE_URL }}."
- name: Log into Conan remote
shell: bash
run: |
conan remote login ${{ inputs.conan_remote_name }} ${{ inputs.conan_remote_username }} --password "${{ inputs.conan_remote_password }}"
conan remote login ${{ vars.CONAN_REMOTE_NAME }} ${{ vars.CONAN_USERNAME }} --password "${{ secrets.CONAN_PASSWORD }}"
conan remote list-users

View File

@@ -0,0 +1,47 @@
name: generate-matrix
inputs:
architecture:
description: 'A string representing a JSON array with 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 with 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 with strings holding the build type (e.g. "Debug", "Release") to use.'
required: true
type: string
cmake_args:
description: 'A string representing a JSON array with strings holding 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 so they can
# be used in a job as follows:
# strategy:
# fail-fast: false
# matrix:
# architecture: ${{ fromJson(needs.json-outputs.outputs.architecture) }}
# os: ${{ fromJson(needs.json-outputs.outputs.os) }}
# build_type: ${{ fromJson(needs.json-outputs.outputs.build_type) }}
# cmake_args: ${{ fromJson(needs.json-outputs.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 }}
# ...
runs:
using: composite
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 }}