From 195ac8ac46e4eccfb24881eadec35f5ad34d92ee Mon Sep 17 00:00:00 2001 From: Bart Thomee <11445373+bthomee@users.noreply.github.com> Date: Sun, 27 Jul 2025 14:38:52 -0400 Subject: [PATCH] Convert reusable workflows back to actions to avoid shortcomings with concurrency --- .../action.yml | 2 +- .../actions/install-dependencies/action.yml | 77 +++++++++++++++ .github/workflows/build-debian.yml | 63 ++++++------- .github/workflows/build-rhel.yml | 63 ++++++------- .github/workflows/install-dependencies.yml | 94 ------------------- 5 files changed, 140 insertions(+), 159 deletions(-) rename .github/actions/{conan-configure => configure-conan}/action.yml (98%) create mode 100644 .github/actions/install-dependencies/action.yml delete mode 100644 .github/workflows/install-dependencies.yml diff --git a/.github/actions/conan-configure/action.yml b/.github/actions/configure-conan/action.yml similarity index 98% rename from .github/actions/conan-configure/action.yml rename to .github/actions/configure-conan/action.yml index b95597ba23..5d7f3dcfd6 100644 --- a/.github/actions/conan-configure/action.yml +++ b/.github/actions/configure-conan/action.yml @@ -1,4 +1,4 @@ -name: conan-configure +name: Configure Conan inputs: conan_global_conf: diff --git a/.github/actions/install-dependencies/action.yml b/.github/actions/install-dependencies/action.yml new file mode 100644 index 0000000000..a734a2a228 --- /dev/null +++ b/.github/actions/install-dependencies/action.yml @@ -0,0 +1,77 @@ +name: Install-dependencies + +inputs: + build_dir: + description: 'The directory where the build will take place.' + required: true + type: string + build_type: + description: 'The build type to use.' + required: true + type: string + conan_global_conf: + description: 'The contents of the global Conan configuration.' + 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 + conan_remote_password: + description: 'The password for logging into the Conan remote.' + required: true + +# 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 +# the workspace is not cleaned up between runs. +runs: + using: composite + 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." + ${CC} --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: ${{ inputs.conan_remote_username }} + conan_remote_password: ${{ inputs.conan_remote_password }} + - name: Install Conan dependencies + shell: bash + run: | + mkdir -p ${{ inputs.build_dir }} + cd ${{ inputs.build_dir }} + conan install \ + --output-folder . \ + --build missing \ + --options:host "&:tests=True" \ + --options:host "&:xrpld=True" \ + --settings:all build_type=${{ inputs.build_type }} \ + .. + - name: Upload Conan dependencies + shell: bash + run: conan upload '*' --confirm --check --remote ${{ inputs.conan_remote_name }} diff --git a/.github/workflows/build-debian.yml b/.github/workflows/build-debian.yml index 01c7ce7433..c304b5a649 100644 --- a/.github/workflows/build-debian.yml +++ b/.github/workflows/build-debian.yml @@ -164,48 +164,47 @@ jobs: install-dependencies: needs: - generate-outputs - uses: ./.github/workflows/install-dependencies.yml + runs-on: ${{ matrix.architecture.runner }} + container: ghcr.io/xrplf/ci/${{ matrix.os.distro }}-${{ matrix.os.release }}:${{ matrix.os.compiler_name }}-${{ matrix.os.compiler_version }} strategy: fail-fast: false matrix: architecture: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_architecture) }} os: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_os) }} build_type: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_build_type) }} + uses: ./.github/actions/install-dependencies with: build_dir: ${{ inputs.build_dir }} build_type: ${{ matrix.build_type }} conan_global_conf: ${{ needs.generate-outputs.outputs.conan_global_conf }} - conan_remote_name: ${ inputs.conan_remote_name } - conan_remote_url: ${ inputs.conan_remote_url } - container: ghcr.io/xrplf/ci/${{ matrix.os.distro }}-${{ matrix.os.release }}:${{ matrix.os.compiler_name }}-${{ matrix.os.compiler_version }} - runner: ${{ matrix.architecture.runner }} - secrets: + conan_remote_name: ${{ inputs.conan_remote_name }} + conan_remote_url: ${{ inputs.conan_remote_url }} conan_remote_username: ${{ inputs.conan_remote_username }} conan_remote_password: ${{ inputs.conan_remote_password }} - # Build and test the binary using various configurations. - build-and-test: - needs: - - generate-outputs - - install-dependencies - uses: ./.github/workflows/build-nix.yml - strategy: - fail-fast: false - matrix: - architecture: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_architecture) }} - os: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_os) }} - build_type: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_build_type) }} - cmake_args: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_cmake_args) }} - with: - build_dir: ${{ inputs.build_dir }} - build_type: ${{ matrix.build_type }} - cmake_args: ${{ matrix.cmake_args }} - cmake_generator: "Ninja" - conan_global_conf: ${{ needs.generate-outputs.outputs.conan_global_conf }} - conan_remote_name: ${ inputs.conan_remote_name } - conan_remote_url: ${ inputs.conan_remote_url } - container: ghcr.io/xrplf/ci/${{ matrix.os.distro }}-${{ matrix.os.release }}:${{ matrix.os.compiler_name }}-${{ matrix.os.compiler_version }} - runner: ${{ matrix.architecture.runner }} - secrets: - conan_remote_username: ${{ inputs.conan_remote_username }} - conan_remote_password: ${{ inputs.conan_remote_password }} +# # Build and test the binary using various configurations. +# build-and-test: +# needs: +# - generate-outputs +# - install-dependencies +# uses: ./.github/workflows/build-nix.yml +# strategy: +# fail-fast: false +# matrix: +# architecture: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_architecture) }} +# os: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_os) }} +# build_type: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_build_type) }} +# cmake_args: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_cmake_args) }} +# with: +# build_dir: ${{ inputs.build_dir }} +# build_type: ${{ matrix.build_type }} +# cmake_args: ${{ matrix.cmake_args }} +# cmake_generator: "Ninja" +# conan_global_conf: ${{ needs.generate-outputs.outputs.conan_global_conf }} +# conan_remote_name: ${ inputs.conan_remote_name } +# conan_remote_url: ${ inputs.conan_remote_url } +# container: ghcr.io/xrplf/ci/${{ matrix.os.distro }}-${{ matrix.os.release }}:${{ matrix.os.compiler_name }}-${{ matrix.os.compiler_version }} +# runner: ${{ matrix.architecture.runner }} +# secrets: +# conan_remote_username: ${{ inputs.conan_remote_username }} +# conan_remote_password: ${{ inputs.conan_remote_password }} diff --git a/.github/workflows/build-rhel.yml b/.github/workflows/build-rhel.yml index 7934e34771..65b9d8d55b 100644 --- a/.github/workflows/build-rhel.yml +++ b/.github/workflows/build-rhel.yml @@ -141,48 +141,47 @@ jobs: install-dependencies: needs: - generate-outputs - uses: ./.github/workflows/install-dependencies.yml + runs-on: ${{ matrix.architecture.runner }} + container: ghcr.io/xrplf/ci/${{ matrix.os.distro }}-${{ matrix.os.release }}:${{ matrix.os.compiler_name }}-${{ matrix.os.compiler_version }} strategy: fail-fast: false matrix: architecture: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_architecture) }} os: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_os) }} build_type: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_build_type) }} + uses: ./.github/actions/install-dependencies with: build_dir: ${{ inputs.build_dir }} build_type: ${{ matrix.build_type }} conan_global_conf: ${{ needs.generate-outputs.outputs.conan_global_conf }} - conan_remote_name: ${ inputs.conan_remote_name } - conan_remote_url: ${ inputs.conan_remote_url } - container: ghcr.io/xrplf/ci/${{ matrix.os.distro }}-${{ matrix.os.release }}:${{ matrix.os.compiler_name }}-${{ matrix.os.compiler_version }} - runner: ${{ matrix.architecture.runner }} - secrets: + conan_remote_name: ${{ inputs.conan_remote_name }} + conan_remote_url: ${{ inputs.conan_remote_url }} conan_remote_username: ${{ inputs.conan_remote_username }} conan_remote_password: ${{ inputs.conan_remote_password }} - # Build and test the binary using various configurations. - build-and-test: - needs: - - generate-outputs - - install-dependencies - uses: ./.github/workflows/build-nix.yml - strategy: - fail-fast: false - matrix: - architecture: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_architecture) }} - os: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_os) }} - build_type: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_build_type) }} - cmake_args: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_cmake_args) }} - with: - build_dir: ${{ inputs.build_dir }} - build_type: ${{ matrix.build_type }} - cmake_args: ${{ matrix.cmake_args }} - cmake_generator: "Ninja" - conan_global_conf: ${{ needs.generate-outputs.outputs.conan_global_conf }} - conan_remote_name: ${ inputs.conan_remote_name } - conan_remote_url: ${ inputs.conan_remote_url } - container: ghcr.io/xrplf/ci/${{ matrix.os.distro }}-${{ matrix.os.release }}:${{ matrix.os.compiler_name }}-${{ matrix.os.compiler_version }} - runner: ${{ matrix.architecture.runner }} - secrets: - conan_remote_username: ${{ inputs.conan_remote_username }} - conan_remote_password: ${{ inputs.conan_remote_password }} +# # Build and test the binary using various configurations. +# build-and-test: +# needs: +# - generate-outputs +# - install-dependencies +# uses: ./.github/workflows/build-nix.yml +# strategy: +# fail-fast: false +# matrix: +# architecture: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_architecture) }} +# os: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_os) }} +# build_type: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_build_type) }} +# cmake_args: ${{ fromJson(needs.generate-outputs.outputs.strategy_matrix_cmake_args) }} +# with: +# build_dir: ${{ inputs.build_dir }} +# build_type: ${{ matrix.build_type }} +# cmake_args: ${{ matrix.cmake_args }} +# cmake_generator: "Ninja" +# conan_global_conf: ${{ needs.generate-outputs.outputs.conan_global_conf }} +# conan_remote_name: ${ inputs.conan_remote_name } +# conan_remote_url: ${ inputs.conan_remote_url } +# container: ghcr.io/xrplf/ci/${{ matrix.os.distro }}-${{ matrix.os.release }}:${{ matrix.os.compiler_name }}-${{ matrix.os.compiler_version }} +# runner: ${{ matrix.architecture.runner }} +# secrets: +# conan_remote_username: ${{ inputs.conan_remote_username }} +# conan_remote_password: ${{ inputs.conan_remote_password }} diff --git a/.github/workflows/install-dependencies.yml b/.github/workflows/install-dependencies.yml deleted file mode 100644 index e0f42fe810..0000000000 --- a/.github/workflows/install-dependencies.yml +++ /dev/null @@ -1,94 +0,0 @@ -# This workflow installs and caches the Conan dependencies for the specified -# configuration. The ones that are not in the remote cache will be built from -# source and added to the cache. -name: Install dependencies - -on: - workflow_call: - inputs: - build_dir: - description: 'The directory where the build will take place.' - required: true - type: string - build_type: - description: 'The build type to use.' - required: true - type: string - conan_global_conf: - description: 'The contents of the global Conan configuration.' - 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 - container: - description: 'The container image to use for the job.' - required: true - type: string - runner: - description: 'A string representing the runner 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 }}-install-dependencies - cancel-in-progress: true - -defaults: - run: - shell: bash - -jobs: - install-dependencies: - runs-on: ${{ inputs.runner }} - container: ${{ inputs.container }} - steps: - - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - name: Check configuration - run: | - echo "Checking path" - echo ${PATH} | tr ':' '\n' - - echo "Checking environment variables." - env | sort - - name: Check versions - run: | - echo "Checking CMake version." - cmake --version - - echo "Checking compiler version." - ${CC} --version - - name: Configure Conan - uses: ./.github/actions/conan-configure - 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: ${{ inputs.conan_remote_username }} - conan_remote_password: ${{ inputs.conan_remote_password }} - - name: Install Conan dependencies - run: | - mkdir -p ${{ inputs.build_dir }} - cd ${{ inputs.build_dir }} - conan install \ - --output-folder . \ - --build missing \ - --options:host "&:tests=True" \ - --options:host "&:xrpld=True" \ - --settings:all build_type=${{ inputs.build_type }} \ - .. - - name: Upload Conan dependencies - run: conan upload '*' --confirm --check --remote ${{ inputs.conan_remote_name }}