Skip to content

Commit 6717d20

Browse files
authored
Merge branch 'develop' into a1q123456/structured-logs-support
2 parents ee877eb + 9bd1ce4 commit 6717d20

33 files changed

+1254
-421
lines changed
Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
# This action installs and optionally uploads Conan dependencies to a remote
2-
# repository. The dependencies will only be uploaded if the credentials are
3-
# provided.
41
name: Build Conan dependencies
2+
description: "Install Conan dependencies, optionally forcing a rebuild of all dependencies."
53

64
# Note that actions do not support 'type' and all inputs are strings, see
75
# https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax#inputs.
@@ -12,28 +10,10 @@ inputs:
1210
build_type:
1311
description: 'The build type to use ("Debug", "Release").'
1412
required: true
15-
conan_remote_name:
16-
description: "The name of the Conan remote to use."
17-
required: true
18-
conan_remote_url:
19-
description: "The URL of the Conan endpoint to use."
20-
required: true
21-
conan_remote_username:
22-
description: "The username for logging into the Conan remote. If not provided, the dependencies will not be uploaded."
23-
required: false
24-
default: ""
25-
conan_remote_password:
26-
description: "The password for logging into the Conan remote. If not provided, the dependencies will not be uploaded."
27-
required: false
28-
default: ""
2913
force_build:
3014
description: 'Force building of all dependencies ("true", "false").'
3115
required: false
3216
default: "false"
33-
force_upload:
34-
description: 'Force uploading of all dependencies ("true", "false").'
35-
required: false
36-
default: "false"
3717

3818
runs:
3919
using: composite
@@ -50,13 +30,4 @@ runs:
5030
--options:host '&:tests=True' \
5131
--options:host '&:xrpld=True' \
5232
--settings:all build_type=${{ inputs.build_type }} \
53-
--format=json ..
54-
- name: Upload Conan dependencies
55-
if: ${{ inputs.conan_remote_username != '' && inputs.conan_remote_password != '' }}
56-
shell: bash
57-
working-directory: ${{ inputs.build_dir }}
58-
run: |
59-
echo "Logging into Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}."
60-
conan remote login ${{ inputs.conan_remote_name }} "${{ inputs.conan_remote_username }}" --password "${{ inputs.conan_remote_password }}"
61-
echo 'Uploading dependencies.'
62-
conan upload '*' --confirm --check ${{ inputs.force_upload == 'true' && '--force' || '' }} --remote=${{ inputs.conan_remote_name }}
33+
..

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This action build and tests the binary. The Conan dependencies must have
22
# already been installed (see the build-deps action).
33
name: Build and Test
4+
description: "Build and test the binary."
45

56
# Note that actions do not support 'type' and all inputs are strings, see
67
# https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax#inputs.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Setup Conan
2+
description: "Set up Conan configuration, profile, and remote."
3+
4+
inputs:
5+
conan_remote_name:
6+
description: "The name of the Conan remote to use."
7+
required: false
8+
default: xrplf
9+
conan_remote_url:
10+
description: "The URL of the Conan endpoint to use."
11+
required: false
12+
default: https://conan.ripplex.io
13+
14+
runs:
15+
using: composite
16+
17+
steps:
18+
- name: Set up Conan configuration
19+
shell: bash
20+
run: |
21+
echo 'Installing configuration.'
22+
cat conan/global.conf ${{ runner.os == 'Linux' && '>>' || '>' }} $(conan config home)/global.conf
23+
24+
echo 'Conan configuration:'
25+
conan config show '*'
26+
27+
- name: Set up Conan profile
28+
shell: bash
29+
run: |
30+
echo 'Installing profile.'
31+
conan config install conan/profiles/default -tf $(conan config home)/profiles/
32+
33+
echo 'Conan profile:'
34+
conan profile show
35+
36+
- name: Set up Conan remote
37+
shell: bash
38+
run: |
39+
echo "Adding Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}."
40+
conan remote add --index 0 --force ${{ inputs.conan_remote_name }} ${{ inputs.conan_remote_url }}
41+
42+
echo 'Listing Conan remotes.'
43+
conan remote list

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

100644100755
Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@
22
import argparse
33
import itertools
44
import json
5-
import re
5+
from pathlib import Path
6+
from dataclasses import dataclass
7+
8+
THIS_DIR = Path(__file__).parent.resolve()
9+
10+
@dataclass
11+
class Config:
12+
architecture: list[dict]
13+
os: list[dict]
14+
build_type: list[str]
15+
cmake_args: list[str]
616

717
'''
818
Generate a strategy matrix for GitHub Actions CI.
@@ -18,9 +28,9 @@
1828
- Certain Debian Bookworm configurations will change the reference fee, enable
1929
codecov, and enable voidstar in PRs.
2030
'''
21-
def generate_strategy_matrix(all: bool, architecture: list[dict], os: list[dict], build_type: list[str], cmake_args: list[str]) -> dict:
31+
def generate_strategy_matrix(all: bool, config: Config) -> list:
2232
configurations = []
23-
for architecture, os, build_type, cmake_args in itertools.product(architecture, os, build_type, cmake_args):
33+
for architecture, os, build_type, cmake_args in itertools.product(config.architecture, config.os, config.build_type, config.cmake_args):
2434
# The default CMake target is 'all' for Linux and MacOS and 'install'
2535
# for Windows, but it can get overridden for certain configurations.
2636
cmake_target = 'install' if os["distro_name"] == 'windows' else 'all'
@@ -35,7 +45,7 @@ def generate_strategy_matrix(all: bool, architecture: list[dict], os: list[dict]
3545
# Only generate a subset of configurations in PRs.
3646
if not all:
3747
# Debian:
38-
# - Bookworm using GCC 13: Release and Unity on linux/arm64, set
48+
# - Bookworm using GCC 13: Release and Unity on linux/amd64, set
3949
# the reference fee to 500.
4050
# - Bookworm using GCC 15: Debug and no Unity on linux/amd64, enable
4151
# code coverage (which will be done below).
@@ -47,7 +57,7 @@ def generate_strategy_matrix(all: bool, architecture: list[dict], os: list[dict]
4757
if os['distro_name'] == 'debian':
4858
skip = True
4959
if os['distro_version'] == 'bookworm':
50-
if f'{os['compiler_name']}-{os['compiler_version']}' == 'gcc-13' and build_type == 'Release' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/arm64':
60+
if f'{os['compiler_name']}-{os['compiler_version']}' == 'gcc-13' and build_type == 'Release' and '-Dunity=ON' in cmake_args and architecture['platform'] == 'linux/amd64':
5161
cmake_args = f'-DUNIT_TEST_REFERENCE_FEE=500 {cmake_args}'
5262
skip = False
5363
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':
@@ -158,21 +168,30 @@ def generate_strategy_matrix(all: bool, architecture: list[dict], os: list[dict]
158168
'architecture': architecture,
159169
})
160170

161-
return {'include': configurations}
171+
return configurations
172+
173+
174+
def read_config(file: Path) -> Config:
175+
config = json.loads(file.read_text())
176+
if config['architecture'] is None or config['os'] is None or config['build_type'] is None or config['cmake_args'] is None:
177+
raise Exception('Invalid configuration file.')
178+
179+
return Config(**config)
162180

163181

164182
if __name__ == '__main__':
165183
parser = argparse.ArgumentParser()
166184
parser.add_argument('-a', '--all', help='Set to generate all configurations (generally used when merging a PR) or leave unset to generate a subset of configurations (generally used when committing to a PR).', action="store_true")
167-
parser.add_argument('-c', '--config', help='Path to the JSON file containing the strategy matrix configurations.', required=True, type=str)
185+
parser.add_argument('-c', '--config', help='Path to the JSON file containing the strategy matrix configurations.', required=False, type=Path)
168186
args = parser.parse_args()
169187

170-
# Load the JSON configuration file.
171-
config = None
172-
with open(args.config, 'r') as f:
173-
config = json.load(f)
174-
if config['architecture'] is None or config['os'] is None or config['build_type'] is None or config['cmake_args'] is None:
175-
raise Exception('Invalid configuration file.')
188+
matrix = []
189+
if args.config is None or args.config == '':
190+
matrix += generate_strategy_matrix(args.all, read_config(THIS_DIR / "linux.json"))
191+
matrix += generate_strategy_matrix(args.all, read_config(THIS_DIR / "macos.json"))
192+
matrix += generate_strategy_matrix(args.all, read_config(THIS_DIR / "windows.json"))
193+
else:
194+
matrix += generate_strategy_matrix(args.all, read_config(args.config))
176195

177196
# Generate the strategy matrix.
178-
print(f'matrix={json.dumps(generate_strategy_matrix(args.all, config['architecture'], config['os'], config['build_type'], config['cmake_args']))}')
197+
print(f'matrix={json.dumps({"include": matrix})}')

.github/workflows/build-test.yml

Lines changed: 7 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ on:
1313
required: false
1414
type: string
1515
default: ".build"
16-
conan_remote_name:
17-
description: "The name of the Conan remote to use."
18-
required: true
19-
type: string
20-
conan_remote_url:
21-
description: "The URL of the Conan endpoint to use."
22-
required: true
23-
type: string
2416
dependencies_force_build:
2517
description: "Force building of all dependencies."
2618
required: false
@@ -45,12 +37,6 @@ on:
4537
codecov_token:
4638
description: "The Codecov token to use for uploading coverage reports."
4739
required: false
48-
conan_remote_username:
49-
description: "The username for logging into the Conan remote. If not provided, the dependencies will not be uploaded."
50-
required: false
51-
conan_remote_password:
52-
description: "The password for logging into the Conan remote. If not provided, the dependencies will not be uploaded."
53-
required: false
5440

5541
concurrency:
5642
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.os }}
@@ -63,20 +49,10 @@ defaults:
6349
jobs:
6450
# Generate the strategy matrix to be used by the following job.
6551
generate-matrix:
66-
runs-on: ubuntu-latest
67-
steps:
68-
- name: Checkout repository
69-
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
70-
- name: Set up Python
71-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
72-
with:
73-
python-version: 3.13
74-
- name: Generate strategy matrix
75-
working-directory: .github/scripts/strategy-matrix
76-
id: generate
77-
run: python generate.py ${{ inputs.strategy_matrix == 'all' && '--all' || '' }} --config=${{ inputs.os }}.json >> "${GITHUB_OUTPUT}"
78-
outputs:
79-
matrix: ${{ steps.generate.outputs.matrix }}
52+
uses: ./.github/workflows/reusable-strategy-matrix.yml
53+
with:
54+
os: ${{ inputs.os }}
55+
strategy_matrix: ${{ inputs.strategy_matrix }}
8056

8157
# Build and test the binary.
8258
build-test:
@@ -148,40 +124,16 @@ jobs:
148124
echo 'Checking nproc version.'
149125
nproc --version
150126
151-
- name: Set up Conan configuration
152-
run: |
153-
echo 'Installing configuration.'
154-
cat conan/global.conf ${{ inputs.os == 'linux' && '>>' || '>' }} $(conan config home)/global.conf
155-
156-
echo 'Conan configuration:'
157-
conan config show '*'
158-
- name: Set up Conan profile
159-
run: |
160-
echo 'Installing profile.'
161-
conan config install conan/profiles/default -tf $(conan config home)/profiles/
162-
163-
echo 'Conan profile:'
164-
conan profile show
165-
- name: Set up Conan remote
166-
shell: bash
167-
run: |
168-
echo "Adding Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}."
169-
conan remote add --index 0 --force ${{ inputs.conan_remote_name }} ${{ inputs.conan_remote_url }}
170-
171-
echo 'Listing Conan remotes.'
172-
conan remote list
127+
- name: Setup Conan
128+
uses: ./.github/actions/setup-conan
173129

174130
- name: Build dependencies
175131
uses: ./.github/actions/build-deps
176132
with:
177133
build_dir: ${{ inputs.build_dir }}
178134
build_type: ${{ matrix.build_type }}
179-
conan_remote_name: ${{ inputs.conan_remote_name }}
180-
conan_remote_url: ${{ inputs.conan_remote_url }}
181-
conan_remote_username: ${{ secrets.conan_remote_username }}
182-
conan_remote_password: ${{ secrets.conan_remote_password }}
183135
force_build: ${{ inputs.dependencies_force_build }}
184-
force_upload: ${{ inputs.dependencies_force_upload }}
136+
185137
- name: Build and test binary
186138
uses: ./.github/actions/build-test
187139
with:

.github/workflows/check-format.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/notify-clio.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ on:
99
inputs:
1010
conan_remote_name:
1111
description: "The name of the Conan remote to use."
12-
required: true
12+
required: false
1313
type: string
14+
default: xrplf
1415
conan_remote_url:
1516
description: "The URL of the Conan endpoint to use."
16-
required: true
17+
required: false
1718
type: string
19+
default: https://conan.ripplex.io
1820
secrets:
1921
clio_notify_token:
2022
description: "The GitHub token to notify Clio about new versions."
@@ -54,12 +56,13 @@ jobs:
5456
id: conan_ref
5557
run: |
5658
echo "conan_ref=${{ steps.generate.outputs.version }}@${{ steps.generate.outputs.user }}/${{ steps.generate.outputs.channel }}" >> "${GITHUB_OUTPUT}"
57-
- name: Add Conan remote
58-
run: |
59-
echo "Adding Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}."
60-
conan remote add --index 0 --force ${{ inputs.conan_remote_name }} ${{ inputs.conan_remote_url }}
61-
echo 'Listing Conan remotes.'
62-
conan remote list
59+
60+
- name: Set up Conan
61+
uses: ./.github/actions/setup-conan
62+
with:
63+
conan_remote_name: ${{ inputs.conan_remote_name }}
64+
conan_remote_url: ${{ inputs.conan_remote_url }}
65+
6366
- name: Log into Conan remote
6467
run: conan remote login ${{ inputs.conan_remote_name }} "${{ secrets.conan_remote_username }}" --password "${{ secrets.conan_remote_password }}"
6568
- name: Upload package

0 commit comments

Comments
 (0)