Skip to content

Commit dc1caa4

Browse files
authored
refactor: Revamp CI workflows (#5661)
This change refactors the CI workflows to leverage the new CI Docker images for Debian, Red Hat, and Ubuntu.
1 parent ceb0ce5 commit dc1caa4

34 files changed

+1397
-1032
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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.
4+
name: Build Conan dependencies
5+
6+
inputs:
7+
build_dir:
8+
description: 'The directory where to build.'
9+
required: true
10+
type: string
11+
build_type:
12+
description: 'The build type to use.'
13+
required: true
14+
type: choice
15+
options:
16+
- 'Debug'
17+
- 'Release'
18+
conan_remote_name:
19+
description: 'The name of the Conan remote to use.'
20+
required: true
21+
type: string
22+
conan_remote_url:
23+
description: 'The URL of the Conan endpoint to use.'
24+
required: true
25+
type: string
26+
conan_remote_username:
27+
description: 'The username for logging into the Conan remote. If not provided, the dependencies will not be uploaded.'
28+
required: false
29+
type: string
30+
default: ''
31+
conan_remote_password:
32+
description: 'The password for logging into the Conan remote. If not provided, the dependencies will not be uploaded.'
33+
required: false
34+
type: string
35+
default: ''
36+
force_build:
37+
description: 'Force building of all dependencies.'
38+
required: false
39+
type: boolean
40+
default: false
41+
force_upload:
42+
description: 'Force uploading of all dependencies.'
43+
required: false
44+
type: boolean
45+
default: false
46+
47+
runs:
48+
using: composite
49+
steps:
50+
- name: Install Conan dependencies
51+
shell: bash
52+
run: |
53+
echo 'Installing dependencies.'
54+
mkdir -p ${{ inputs.build_dir }}
55+
cd ${{ inputs.build_dir }}
56+
conan install \
57+
--output-folder . \
58+
--build ${{ inputs.force_build && '"*"' || 'missing' }} \
59+
--options:host '&:tests=True' \
60+
--options:host '&:xrpld=True' \
61+
--settings:all build_type=${{ inputs.build_type }} \
62+
--format=json ..
63+
- name: Upload Conan dependencies
64+
if: ${{ inputs.conan_remote_username && inputs.conan_remote_password }}
65+
shell: bash
66+
working-directory: ${{ inputs.build_dir }}
67+
run: |
68+
echo "Logging into Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}."
69+
conan remote login ${{ inputs.conan_remote_name }} "${{ inputs.conan_remote_username }}" --password "${{ inputs.conan_remote_password }}"
70+
echo 'Uploading dependencies.'
71+
conan upload '*' --confirm --check ${{ inputs.force_upload && '--force' || '' }} --remote=${{ inputs.conan_remote_name }}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# This action build and tests the binary. The Conan dependencies must have
2+
# already been installed (see the build-deps action).
3+
name: Build and Test
4+
5+
inputs:
6+
build_dir:
7+
description: 'The directory where to build.'
8+
required: true
9+
type: string
10+
build_type:
11+
description: 'The build type to use.'
12+
required: true
13+
type: choice
14+
options:
15+
- 'Debug'
16+
- 'Release'
17+
cmake_args:
18+
description: 'Additional arguments to pass to CMake.'
19+
required: false
20+
type: string
21+
default: ''
22+
cmake_target:
23+
description: 'The CMake target to build.'
24+
required: true
25+
type: string
26+
codecov_token:
27+
description: 'The Codecov token to use for uploading coverage reports.'
28+
required: false
29+
type: string
30+
default: ''
31+
os:
32+
description: 'The operating system to use for the build (linux, macos, or windows).'
33+
required: true
34+
type: choice
35+
options:
36+
- 'linux'
37+
- 'macos'
38+
- 'windows'
39+
40+
runs:
41+
using: composite
42+
steps:
43+
- name: Configure CMake
44+
shell: bash
45+
working-directory: ${{ inputs.build_dir }}
46+
run: |
47+
echo 'Configuring CMake.'
48+
cmake \
49+
-G '${{ inputs.os == 'windows' && 'Visual Studio 17 2022' || 'Ninja' }}' \
50+
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
51+
-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \
52+
${{ inputs.cmake_args }} \
53+
..
54+
- name: Build the binary
55+
shell: bash
56+
working-directory: ${{ inputs.build_dir }}
57+
run: |
58+
echo 'Building binary.'
59+
cmake \
60+
--build . \
61+
--config ${{ inputs.build_type }} \
62+
--parallel $(nproc) \
63+
--target ${{ inputs.cmake_target }}
64+
- name: Check linking
65+
if: ${{ inputs.os == 'linux' }}
66+
shell: bash
67+
working-directory: ${{ inputs.build_dir }}
68+
run: |
69+
echo 'Checking linking.'
70+
ldd ./rippled
71+
if [ "$(ldd ./rippled | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then
72+
echo 'The binary is statically linked.'
73+
else
74+
echo 'The binary is dynamically linked.'
75+
exit 1
76+
fi
77+
- name: Verify voidstar
78+
if: ${{ contains(inputs.cmake_args, '-Dvoidstar=ON') }}
79+
shell: bash
80+
working-directory: ${{ inputs.build_dir }}
81+
run: |
82+
echo 'Verifying presence of instrumentation.'
83+
./rippled --version | grep libvoidstar
84+
- name: Test the binary
85+
if: ${{ inputs.cmake_target != 'coverage' }}
86+
shell: bash
87+
working-directory: ${{ inputs.build_dir }}/${{ inputs.os == 'windows' && inputs.build_type || '' }}
88+
run: |
89+
echo 'Testing binary.'
90+
./rippled --unittest --unittest-jobs $(nproc)
91+
ctest -j $(nproc) --output-on-failure
92+
- name: Upload coverage report
93+
if: ${{ inputs.cmake_target == 'coverage' && inputs.codecov_token }}
94+
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
95+
with:
96+
disable_search: true
97+
disable_telem: true
98+
fail_ci_if_error: true
99+
files: ${{ inputs.build_dir }}/coverage.xml
100+
plugins: noop
101+
token: ${{ inputs.codecov_token }}
102+
verbose: true

.github/actions/build/action.yml

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

.github/actions/dependencies/action.yml

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

Builds/levelization/README.md renamed to .github/scripts/levelization/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ that `test` code should _never_ be included in `ripple` code.)
5050

5151
## Validation
5252

53-
The [levelization.sh](levelization.sh) script takes no parameters,
53+
The [levelization](generate.sh) script takes no parameters,
5454
reads no environment variables, and can be run from any directory,
5555
as long as it is in the expected location in the rippled repo.
5656
It can be run at any time from within a checked out repo, and will
@@ -72,15 +72,15 @@ It generates many files of [results](results):
7272
desired as described above. In a perfect repo, this file will be
7373
empty.
7474
This file is committed to the repo, and is used by the [levelization
75-
Github workflow](../../.github/workflows/levelization.yml) to validate
75+
Github workflow](../../workflows/check-levelization.yml) to validate
7676
that nothing changed.
7777
- [`ordering.txt`](results/ordering.txt): A list showing relationships
7878
between modules where there are no loops as they actually exist, as
7979
opposed to how they are desired as described above.
8080
This file is committed to the repo, and is used by the [levelization
81-
Github workflow](../../.github/workflows/levelization.yml) to validate
81+
Github workflow](../../workflows/check-levelization.yml) to validate
8282
that nothing changed.
83-
- [`levelization.yml`](../../.github/workflows/levelization.yml)
83+
- [`levelization.yml`](../../workflows/check-levelization.yml)
8484
Github Actions workflow to test that levelization loops haven't
8585
changed. Unfortunately, if changes are detected, it can't tell if
8686
they are improvements or not, so if you have resolved any issues or
@@ -111,4 +111,4 @@ get those details locally.
111111
1. Run `levelization.sh`
112112
2. Grep the modules in `paths.txt`.
113113
- For example, if a cycle is found `A ~= B`, simply `grep -w
114-
A Builds/levelization/results/paths.txt | grep -w B`
114+
A .github/scripts/levelization/results/paths.txt | grep -w B`

Builds/levelization/levelization.sh renamed to .github/scripts/levelization/generate.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Usage: levelization.sh
3+
# Usage: generate.sh
44
# This script takes no parameters, reads no environment variables,
55
# and can be run from any directory, as long as it is in the expected
66
# location in the repo.
@@ -19,7 +19,7 @@ export LANG=C
1919
rm -rfv results
2020
mkdir results
2121
includes="$( pwd )/results/rawincludes.txt"
22-
pushd ../..
22+
pushd ../../..
2323
echo Raw includes:
2424
grep -r '^[ ]*#include.*/.*\.h' include src | \
2525
grep -v boost | tee ${includes}
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)