Skip to content

Commit afc0565

Browse files
authored
fix: Adjust the CI workflows (#5700)
1 parent b04d239 commit afc0565

File tree

8 files changed

+84
-110
lines changed

8 files changed

+84
-110
lines changed

.github/actions/build-deps/action.yml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,37 @@
33
# provided.
44
name: Build Conan dependencies
55

6+
# Note that actions do not support 'type' and all inputs are strings, see
7+
# https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax#inputs.
68
inputs:
79
build_dir:
810
description: 'The directory where to build.'
911
required: true
10-
type: string
1112
build_type:
12-
description: 'The build type to use.'
13+
description: 'The build type to use ("Debug", "Release").'
1314
required: true
14-
type: choice
15-
options:
16-
- 'Debug'
17-
- 'Release'
1815
conan_remote_name:
1916
description: 'The name of the Conan remote to use.'
2017
required: true
21-
type: string
2218
conan_remote_url:
2319
description: 'The URL of the Conan endpoint to use.'
2420
required: true
25-
type: string
2621
conan_remote_username:
2722
description: 'The username for logging into the Conan remote. If not provided, the dependencies will not be uploaded.'
2823
required: false
29-
type: string
3024
default: ''
3125
conan_remote_password:
3226
description: 'The password for logging into the Conan remote. If not provided, the dependencies will not be uploaded.'
3327
required: false
34-
type: string
3528
default: ''
3629
force_build:
37-
description: 'Force building of all dependencies.'
30+
description: 'Force building of all dependencies ("true", "false").'
3831
required: false
39-
type: boolean
40-
default: false
32+
default: 'false'
4133
force_upload:
42-
description: 'Force uploading of all dependencies.'
34+
description: 'Force uploading of all dependencies ("true", "false").'
4335
required: false
44-
type: boolean
45-
default: false
36+
default: 'false'
4637

4738
runs:
4839
using: composite
@@ -55,17 +46,17 @@ runs:
5546
cd ${{ inputs.build_dir }}
5647
conan install \
5748
--output-folder . \
58-
--build ${{ inputs.force_build && '"*"' || 'missing' }} \
49+
--build ${{ inputs.force_build == 'true' && '"*"' || 'missing' }} \
5950
--options:host '&:tests=True' \
6051
--options:host '&:xrpld=True' \
6152
--settings:all build_type=${{ inputs.build_type }} \
6253
--format=json ..
6354
- name: Upload Conan dependencies
64-
if: ${{ inputs.conan_remote_username && inputs.conan_remote_password }}
55+
if: ${{ inputs.conan_remote_username != '' && inputs.conan_remote_password != '' }}
6556
shell: bash
6657
working-directory: ${{ inputs.build_dir }}
6758
run: |
6859
echo "Logging into Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}."
6960
conan remote login ${{ inputs.conan_remote_name }} "${{ inputs.conan_remote_username }}" --password "${{ inputs.conan_remote_password }}"
7061
echo 'Uploading dependencies.'
71-
conan upload '*' --confirm --check ${{ inputs.force_upload && '--force' || '' }} --remote=${{ inputs.conan_remote_name }}
62+
conan upload '*' --confirm --check ${{ inputs.force_upload == 'true' && '--force' || '' }} --remote=${{ inputs.conan_remote_name }}

.github/actions/build-test/action.yml

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,33 @@
22
# already been installed (see the build-deps action).
33
name: Build and Test
44

5+
# Note that actions do not support 'type' and all inputs are strings, see
6+
# https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax#inputs.
57
inputs:
68
build_dir:
79
description: 'The directory where to build.'
810
required: true
9-
type: string
11+
build_only:
12+
description: 'Whether to only build or to build and test the code ("true", "false").'
13+
required: false
14+
default: 'false'
1015
build_type:
11-
description: 'The build type to use.'
16+
description: 'The build type to use ("Debug", "Release").'
1217
required: true
13-
type: choice
14-
options:
15-
- 'Debug'
16-
- 'Release'
1718
cmake_args:
1819
description: 'Additional arguments to pass to CMake.'
1920
required: false
20-
type: string
2121
default: ''
2222
cmake_target:
2323
description: 'The CMake target to build.'
2424
required: true
25-
type: string
2625
codecov_token:
2726
description: 'The Codecov token to use for uploading coverage reports.'
2827
required: false
29-
type: string
3028
default: ''
3129
os:
32-
description: 'The operating system to use for the build (linux, macos, or windows).'
30+
description: 'The operating system to use for the build ("linux", "macos", "windows").'
3331
required: true
34-
type: choice
35-
options:
36-
- 'linux'
37-
- 'macos'
38-
- 'windows'
3932

4033
runs:
4134
using: composite
@@ -82,7 +75,7 @@ runs:
8275
echo 'Verifying presence of instrumentation.'
8376
./rippled --version | grep libvoidstar
8477
- name: Test the binary
85-
if: ${{ inputs.cmake_target != 'coverage' }}
78+
if: ${{ inputs.build_only == 'true' }}
8679
shell: bash
8780
working-directory: ${{ inputs.build_dir }}/${{ inputs.os == 'windows' && inputs.build_type || '' }}
8881
run: |

.github/scripts/strategy-matrix/generate.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
On each PR commit we will build a selection of Debian, RHEL, Ubuntu, MacOS, and
1111
Windows configurations, while upon merge into the develop, release, or master
12-
branches, we will build all configurations.
12+
branches, we will build all configurations, and test most of them.
1313
1414
We will further set additional CMake arguments as follows:
1515
- All builds will have the `tests`, `werr`, and `xrpld` options.
@@ -25,6 +25,13 @@ def generate_strategy_matrix(all: bool, architecture: list[dict], os: list[dict]
2525
# for Windows, but it can get overridden for certain configurations.
2626
cmake_target = 'install' if os["distro_name"] == 'windows' else 'all'
2727

28+
# We build and test all configurations by default, except for Windows in
29+
# Debug, because it is too slow, as well as when code coverage is
30+
# enabled as that mode already runs the tests.
31+
build_only = False
32+
if os['distro_name'] == 'windows' and build_type == 'Debug':
33+
build_only = True
34+
2835
# Only generate a subset of configurations in PRs.
2936
if not all:
3037
# Debian:
@@ -46,6 +53,7 @@ def generate_strategy_matrix(all: bool, architecture: list[dict], os: list[dict]
4653
if f'{os['compiler_name']}-{os['compiler_version']}' == 'gcc-15' and build_type == 'Debug' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/amd64':
4754
cmake_args = f'{cmake_args} -Dcoverage=ON -Dcoverage_format=xml -DCODE_COVERAGE_VERBOSE=ON -DCMAKE_C_FLAGS=-O0 -DCMAKE_CXX_FLAGS=-O0'
4855
cmake_target = 'coverage'
56+
build_only = True
4957
skip = False
5058
if f'{os['compiler_name']}-{os['compiler_version']}' == 'clang-16' and build_type == 'Debug' and '-Dunity=OFF' in cmake_args and architecture['platform'] == 'linux/arm64':
5159
cmake_args = f'{cmake_args} -Dvoidstar=ON'
@@ -110,6 +118,11 @@ def generate_strategy_matrix(all: bool, architecture: list[dict], os: list[dict]
110118
if build_type == 'Release':
111119
cmake_args = f'{cmake_args} -Dassert=ON'
112120

121+
# We skip all RHEL on arm64 due to a build failure that needs further
122+
# investigation.
123+
if os['distro_name'] == 'rhel' and architecture['platform'] == 'linux/arm64':
124+
continue
125+
113126
# Generate a unique name for the configuration, e.g. macos-arm64-debug
114127
# or debian-bookworm-gcc-12-amd64-release-unity.
115128
config_name = os['distro_name']
@@ -128,6 +141,7 @@ def generate_strategy_matrix(all: bool, architecture: list[dict], os: list[dict]
128141
'architecture': architecture,
129142
'os': os,
130143
'build_type': build_type,
144+
'build_only': 'true' if build_only else 'false',
131145
'cmake_args': cmake_args,
132146
'cmake_target': cmake_target,
133147
'config_name': config_name,

.github/workflows/build-test.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# This workflow builds and tests the binary for various configurations.
22
name: Build and test
33

4-
# This workflow can only be triggered by other workflows.
4+
# This workflow can only be triggered by other workflows. Note that the
5+
# workflow_call event does not support the 'choice' input type, see
6+
# https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#onworkflow_callinputsinput_idtype,
7+
# so we use 'string' instead.
58
on:
69
workflow_call:
710
inputs:
@@ -29,14 +32,15 @@ on:
2932
type: boolean
3033
default: false
3134
os:
32-
description: 'The operating system to use for the build (linux, macos, or windows).'
35+
description: 'The operating system to use for the build ("linux", "macos", "windows").'
3336
required: true
3437
type: string
35-
strategy_matrix_all:
36-
description: 'Generate a strategy matrix containing all configurations.'
38+
strategy_matrix:
39+
# TODO: Support additional strategies, e.g. "ubuntu" for generating all Ubuntu configurations.
40+
description: 'The strategy matrix to use for generating the configurations ("minimal", "all").'
3741
required: false
38-
type: boolean
39-
default: false
42+
type: string
43+
default: 'minimal'
4044
secrets:
4145
codecov_token:
4246
description: 'The Codecov token to use for uploading coverage reports.'
@@ -70,7 +74,7 @@ jobs:
7074
- name: Generate strategy matrix
7175
working-directory: .github/scripts/strategy-matrix
7276
id: generate
73-
run: python generate.py ${{ inputs.strategy_matrix_all && '--all' || '' }} --config=${{ inputs.os }}.json >> "${GITHUB_OUTPUT}"
77+
run: python generate.py ${{ inputs.strategy_matrix == 'all' && '--all' || '' }} --config=${{ inputs.os }}.json >> "${GITHUB_OUTPUT}"
7478
outputs:
7579
matrix: ${{ steps.generate.outputs.matrix }}
7680

@@ -101,9 +105,11 @@ jobs:
101105
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
102106
with:
103107
python-version: 3.13
104-
- name: Install Conan (Windows)
108+
- name: Install build tools (Windows)
105109
if: ${{ inputs.os == 'windows' }}
106-
run: pip install wheel conan
110+
run: |
111+
echo 'Installing build tools.'
112+
pip install wheel conan
107113
- name: Check configuration (Windows)
108114
if: ${{ inputs.os == 'windows' }}
109115
run: |
@@ -115,6 +121,11 @@ jobs:
115121
116122
echo 'Checking Conan version.'
117123
conan --version
124+
- name: Install build tools (MacOS)
125+
if: ${{ inputs.os == 'macos' }}
126+
run: |
127+
echo 'Installing build tools.'
128+
brew install cmake conan ninja coreutils
118129
- name: Check configuration (Linux and MacOS)
119130
if: ${{ inputs.os == 'linux' || inputs.os == 'macos' }}
120131
run: |
@@ -135,6 +146,9 @@ jobs:
135146
136147
echo 'Checking Ninja version.'
137148
ninja --version
149+
150+
echo 'Checking nproc version.'
151+
nproc --version
138152
- name: Set up Conan home directory (MacOS)
139153
if: ${{ inputs.os == 'macos' }}
140154
run: |
@@ -184,6 +198,7 @@ jobs:
184198
uses: ./.github/actions/build-test
185199
with:
186200
build_dir: ${{ inputs.build_dir }}
201+
build_only: ${{ matrix.build_only }}
187202
build_type: ${{ matrix.build_type }}
188203
cmake_args: ${{ matrix.cmake_args }}
189204
cmake_target: ${{ matrix.cmake_target }}

.github/workflows/notify-clio.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ jobs:
4444
- name: Generate outputs
4545
id: generate
4646
run: |
47-
echo 'Generating channel.'
48-
echo channel="clio/pr_${{ github.event.pull_request.number }}" >> "${GITHUB_OUTPUT}"
47+
echo 'Generating user and channel.'
48+
echo "user=clio" >> "${GITHUB_OUTPUT}"
49+
echo "channel=pr_${{ github.event.pull_request.number }}" >> "${GITHUB_OUTPUT}"
4950
echo 'Extracting version.'
50-
echo version="$(cat src/libxrpl/protocol/BuildInfo.cpp | grep "versionString =" | awk -F '"' '{print $2}')" >> "${GITHUB_OUTPUT}"
51+
echo "version=$(cat src/libxrpl/protocol/BuildInfo.cpp | grep "versionString =" | awk -F '"' '{print $2}')" >> "${GITHUB_OUTPUT}"
5152
- name: Add Conan remote
5253
run: |
5354
echo "Adding Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}."
@@ -58,10 +59,8 @@ jobs:
5859
run: conan remote login ${{ inputs.conan_remote_name }} "${{ secrets.conan_remote_username }}" --password "${{ secrets.conan_remote_password }}"
5960
- name: Upload package
6061
run: |
61-
echo 'Exporting package to channel ${{ steps.generate.outputs.channel }}.'
62-
conan export --channel=${{ steps.generate.outputs.channel }} .
63-
echo 'Uploading package version ${{ steps.generate.outputs.version }} on channel ${{ steps.generate.outputs.channel }}.'
64-
conan upload --confirm --check --remote=${{ inputs.conan_remote_name }} xrpl/${{ steps.generate.outputs.version }}@${{ steps.generate.outputs.channel }}
62+
conan export --user=${{ steps.generate.outputs.user }} --channel=${{ steps.generate.outputs.channel }} .
63+
conan upload --confirm --check --remote=${{ inputs.conan_remote_name }} xrpl/${{ steps.generate.outputs.version }}@${{ steps.generate.outputs.user }}/${{ steps.generate.outputs.channel }}
6564
outputs:
6665
channel: ${{ steps.generate.outputs.channel }}
6766
version: ${{ steps.generate.outputs.version }}
@@ -76,5 +75,5 @@ jobs:
7675
run: |
7776
gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \
7877
/repos/xrplf/clio/dispatches -f "event_type=check_libxrpl" \
79-
-F "client_payload[version]=${{ needs.upload.outputs.version }}@${{ needs.upload.outputs.channel }}" \
78+
-F "client_payload[version]=${{ needs.upload.outputs.version }}@${{ needs.upload.outputs.user }}/${{ needs.upload.outputs.channel }}" \
8079
-F "client_payload[pr]=${{ github.event.pull_request.number }}"

.github/workflows/on-pr.yml

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
- name: No-op
7272
run: echo ''
7373

74-
check-clang-format:
74+
check-format:
7575
needs: should-run
7676
uses: ./.github/workflows/check-format.yml
7777

@@ -91,38 +91,23 @@ jobs:
9191
conan_remote_name: ${{ env.CONAN_REMOTE_NAME }}
9292
conan_remote_url: ${{ env.CONAN_REMOTE_URL }}
9393

94-
build-linux:
94+
build-test:
9595
needs: generate-outputs
9696
uses: ./.github/workflows/build-test.yml
97+
strategy:
98+
matrix:
99+
os: [linux, macos, windows]
97100
with:
98101
conan_remote_name: ${{ needs.generate-outputs.outputs.conan_remote_name }}
99102
conan_remote_url: ${{ needs.generate-outputs.outputs.conan_remote_url }}
100-
os: 'linux'
103+
os: ${{ matrix.os }}
101104
secrets:
102105
codecov_token: ${{ secrets.CODECOV_TOKEN }}
103106

104-
build-macos:
105-
needs: generate-outputs
106-
uses: ./.github/workflows/build-test.yml
107-
with:
108-
conan_remote_name: ${{ needs.generate-outputs.outputs.conan_remote_name }}
109-
conan_remote_url: ${{ needs.generate-outputs.outputs.conan_remote_url }}
110-
os: 'macos'
111-
112-
build-windows:
113-
needs: generate-outputs
114-
uses: ./.github/workflows/build-test.yml
115-
with:
116-
conan_remote_name: ${{ needs.generate-outputs.outputs.conan_remote_name }}
117-
conan_remote_url: ${{ needs.generate-outputs.outputs.conan_remote_url }}
118-
os: 'windows'
119-
120107
notify-clio:
121108
needs:
122109
- generate-outputs
123-
- build-linux
124-
- build-macos
125-
- build-windows
110+
- build-test
126111
uses: ./.github/workflows/notify-clio.yml
127112
with:
128113
conan_remote_name: ${{ needs.generate-outputs.outputs.conan_remote_name }}

0 commit comments

Comments
 (0)