Skip to content

Commit 436de0e

Browse files
Expand Linux test matrix: (XRPLF#4454)
This change makes progress on the plan in XRPLF#4371. It does not replicate the full [matrix] implemented in XRPLF#3851, but it does replicate the 1.ii section of the Linux matrix. It leverages "heavy" self-hosted runners, and demonstrates a repeatable pattern for future matrices. [matrix]: https://github.com/XRPLF/rippled/blob/d794a0f3f161bb30c74881172fc38f763d7d46e8/.github/README.md#continuous-integration
1 parent 8d482d3 commit 436de0e

4 files changed

Lines changed: 197 additions & 68 deletions

File tree

.github/actions/build/action.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: build
2+
inputs:
3+
generator:
4+
default: null
5+
configuration:
6+
required: true
7+
cmake-args:
8+
default: null
9+
# An implicit input is the environment variable `build_dir`.
10+
runs:
11+
using: composite
12+
steps:
13+
- name: export custom recipes
14+
shell: bash
15+
run: conan export external/snappy snappy/1.1.9@
16+
- name: install dependencies
17+
shell: bash
18+
run: |
19+
mkdir ${build_dir}
20+
cd ${build_dir}
21+
conan install \
22+
--output-folder . \
23+
--build missing \
24+
--settings build_type=${{ inputs.configuration }} \
25+
..
26+
- name: configure
27+
shell: bash
28+
run: |
29+
cd ${build_dir}
30+
cmake \
31+
${{ inputs.generator && format('-G {0}', inputs.generator) || '' }} \
32+
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
33+
-DCMAKE_BUILD_TYPE=${{ inputs.configuration }} \
34+
${{ inputs.cmake-args }} \
35+
..
36+
- name: build
37+
shell: bash
38+
run: |
39+
cmake \
40+
--build ${build_dir} \
41+
--config ${{ inputs.configuration }} \
42+
--parallel ${NUM_PROCESSORS:-$(nproc)}

.github/workflows/macos.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: macos
2+
on: [push, pull_request]
3+
4+
jobs:
5+
6+
test:
7+
strategy:
8+
matrix:
9+
platform:
10+
- macos-12
11+
generator:
12+
- Ninja
13+
configuration:
14+
- Release
15+
runs-on: ${{ matrix.platform }}
16+
env:
17+
# The `build` action requires these variables.
18+
build_dir: .build
19+
NUM_PROCESSORS: 2
20+
steps:
21+
- name: checkout
22+
uses: actions/checkout@v3
23+
- name: install Ninja
24+
if: matrix.generator == 'Ninja'
25+
run: brew install ninja
26+
- name: choose Python
27+
uses: actions/setup-python@v3
28+
with:
29+
python-version: 3.9
30+
- name: learn Python cache directory
31+
id: pip-cache
32+
run: |
33+
sudo pip install --upgrade pip
34+
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
35+
- name: restore Python cache directory
36+
uses: actions/cache@v2
37+
with:
38+
path: ${{ steps.pip-cache.outputs.dir }}
39+
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/nix.yml') }}
40+
- name: install Conan
41+
run: pip install wheel 'conan<2'
42+
- name: check environment
43+
run: |
44+
echo ${PATH} | tr ':' '\n'
45+
python --version
46+
conan --version
47+
cmake --version
48+
env
49+
- name: configure Conan
50+
run: |
51+
conan profile new default --detect
52+
conan profile update settings.compiler.cppstd=20 default
53+
- name: learn Conan cache directory
54+
id: conan-cache
55+
run: |
56+
echo "dir=$(conan config get storage.path)" >> $GITHUB_OUTPUT
57+
- name: restore Conan cache directory
58+
uses: actions/cache@v2
59+
with:
60+
path: ${{ steps.conan-cache.outputs.dir }}
61+
key: ${{ hashFiles('~/.conan/profiles/default', 'conanfile.py', 'external/rocksdb/*', '.github/workflows/nix.yml') }}
62+
- name: build
63+
uses: ./.github/actions/build
64+
with:
65+
generator: ${{ matrix.generator }}
66+
configuration: ${{ matrix.configuration }}
67+
- name: test
68+
run: |
69+
${build_dir}/rippled --unittest

.github/workflows/nix.yml

Lines changed: 83 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -3,94 +3,112 @@ on: [push, pull_request]
33

44
jobs:
55

6-
test:
6+
dependencies:
77
strategy:
88
fail-fast: false
99
matrix:
1010
platform:
11-
- ubuntu-latest
12-
- macos-12
13-
generator:
14-
- Ninja
11+
- linux
12+
compiler:
13+
- gcc
14+
- clang
1515
configuration:
16+
- Debug
1617
- Release
17-
runs-on: ${{ matrix.platform }}
18-
env:
19-
build_dir: .build
18+
include:
19+
- compiler: gcc
20+
profile:
21+
version: 11
22+
cc: /usr/bin/gcc
23+
cxx: /usr/bin/g++
24+
- compiler: clang
25+
profile:
26+
version: 14
27+
cc: /usr/bin/clang-14
28+
cxx: /usr/bin/clang++-14
29+
runs-on: [self-hosted, heavy]
30+
container: thejohnfreeman/rippled-build-ubuntu:12e19cd9034b
2031
steps:
21-
- name: checkout
22-
uses: actions/checkout@v3
23-
- name: install Ninja on Linux
24-
if: matrix.generator == 'Ninja' && runner.os == 'Linux'
25-
run: sudo apt install ninja-build
26-
- name: install Ninja on OSX
27-
if: matrix.generator == 'Ninja' && runner.os == 'macOS'
28-
run: brew install ninja
29-
- name: install nproc on OSX
30-
if: runner.os == 'macOS'
31-
run: brew install coreutils
32-
- name: choose Python
33-
uses: actions/setup-python@v3
34-
with:
35-
python-version: 3.9
36-
- name: learn Python cache directory
37-
id: pip-cache
38-
run: |
39-
sudo pip install --upgrade pip
40-
echo "::set-output name=dir::$(pip cache dir)"
41-
- name: restore Python cache directory
42-
uses: actions/cache@v2
43-
with:
44-
path: ${{ steps.pip-cache.outputs.dir }}
45-
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/nix.yml') }}
46-
- name: install Conan
47-
run: pip install wheel 'conan~=1.52'
4832
- name: check environment
4933
run: |
5034
echo ${PATH} | tr ':' '\n'
51-
python --version
5235
conan --version
5336
cmake --version
5437
env
5538
- name: configure Conan
5639
run: |
5740
conan profile new default --detect
5841
conan profile update settings.compiler.cppstd=20 default
59-
- name: configure Conan on Linux
60-
if: runner.os == 'Linux'
61-
run: |
42+
conan profile update settings.compiler=${{ matrix.compiler }} default
43+
conan profile update settings.compiler.version=${{ matrix.profile.version }} default
6244
conan profile update settings.compiler.libcxx=libstdc++11 default
63-
- name: learn Conan cache directory
64-
id: conan-cache
45+
conan profile update env.CC=${{ matrix.profile.cc }} default
46+
conan profile update env.CXX=${{ matrix.profile.cxx }} default
47+
conan profile update conf.tools.build:compiler_executables='{"c": "${{ matrix.profile.cc }}", "cpp": "${{ matrix.profile.cxx }}"}' default
48+
- name: checkout
49+
uses: actions/checkout@v3
50+
- name: build dependencies
6551
run: |
66-
echo "::set-output name=dir::$(conan config get storage.path)"
67-
- name: restore Conan cache directory
68-
uses: actions/cache@v2
52+
mkdir .build
53+
cd .build
54+
conan install \
55+
--output-folder . \
56+
--build missing \
57+
--settings build_type=${{ matrix.configuration }} \
58+
..
59+
- name: archive cache
60+
run: tar -czf conan.tar -C ~/.conan .
61+
- name: upload cache
62+
uses: actions/upload-artifact@v3
6963
with:
70-
path: ${{ steps.conan-cache.outputs.dir }}
71-
key: ${{ hashFiles('~/.conan/profiles/default', 'conanfile.py', 'external/rocksdb/*', '.github/workflows/nix.yml') }}
72-
- name: export Snappy
73-
run: conan export external/snappy snappy/1.1.9@
74-
- name: install dependencies
64+
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
65+
path: conan.tar
66+
67+
68+
test:
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
platform:
73+
- linux
74+
compiler:
75+
- gcc
76+
- clang
77+
configuration:
78+
- Debug
79+
- Release
80+
cmake-args:
81+
-
82+
- "-Dunity=ON"
83+
needs: dependencies
84+
runs-on: [self-hosted, heavy]
85+
container: thejohnfreeman/rippled-build-ubuntu:12e19cd9034b
86+
env:
87+
build_dir: .build
88+
steps:
89+
- name: download cache
90+
uses: actions/download-artifact@v3
91+
with:
92+
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
93+
- name: extract cache
7594
run: |
76-
mkdir ${build_dir}
77-
cd ${build_dir}
78-
conan install .. --build missing --settings build_type=${{ matrix.configuration }}
79-
- name: configure
95+
mkdir -p ~/.conan
96+
tar -xzf conan.tar -C ~/.conan
97+
- name: check environment
8098
run: |
81-
cd ${build_dir}
82-
cmake \
83-
-G ${{ matrix.generator }} \
84-
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
85-
-DCMAKE_BUILD_TYPE=${{ matrix.configuration }} \
86-
-Dassert=ON \
87-
-Dcoverage=OFF \
88-
-Dreporting=OFF \
89-
-Dunity=OFF \
90-
..
99+
echo ${PATH} | tr ':' '\n'
100+
conan --version
101+
cmake --version
102+
env
103+
ls ~/.conan
104+
- name: checkout
105+
uses: actions/checkout@v3
91106
- name: build
92-
run: |
93-
cmake --build ${build_dir} --target rippled --parallel $(nproc)
107+
uses: ./.github/actions/build
108+
with:
109+
generator: Ninja
110+
configuration: ${{ matrix.configuration }}
111+
cmake-args: ${{ matrix.cmake-args }}
94112
- name: test
95113
run: |
96114
${build_dir}/rippled --unittest --unittest-jobs $(nproc)

.github/workflows/windows.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ jobs:
3939
id: pip-cache
4040
run: |
4141
pip install --upgrade pip
42-
echo "::set-output name=dir::$(pip cache dir)"
42+
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
4343
- name: restore Python cache directory
4444
uses: actions/cache@v2
4545
with:
4646
path: ${{ steps.pip-cache.outputs.dir }}
4747
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/windows.yml') }}
4848
- name: install Conan
49-
run: pip install wheel 'conan~=1.52'
49+
run: pip install wheel 'conan<2'
5050
- name: check environment
5151
run: |
5252
$env:PATH -split ';'
@@ -63,7 +63,7 @@ jobs:
6363
- name: learn Conan cache directory
6464
id: conan-cache
6565
run: |
66-
echo "::set-output name=dir::$(conan config get storage.path)"
66+
echo "dir=$(conan config get storage.path)" >> $GITHUB_OUTPUT
6767
- name: restore Conan cache directory
6868
uses: actions/cache@v2
6969
with:

0 commit comments

Comments
 (0)