Skip to content

Commit a5ea86f

Browse files
authored
Add Conan Building For Development (#432)
1 parent 615f565 commit a5ea86f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2865
-7702
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 'Configure ccache'
2+
description: 'Sets up ccache with consistent configuration'
3+
4+
inputs:
5+
max_size:
6+
description: 'Maximum cache size'
7+
required: false
8+
default: '2G'
9+
hash_dir:
10+
description: 'Whether to include directory paths in hash'
11+
required: false
12+
default: 'true'
13+
compiler_check:
14+
description: 'How to check compiler for changes'
15+
required: false
16+
default: 'content'
17+
18+
runs:
19+
using: 'composite'
20+
steps:
21+
- name: Configure ccache
22+
shell: bash
23+
run: |
24+
mkdir -p ~/.ccache
25+
export CONF_PATH="${CCACHE_CONFIGPATH:-${CCACHE_DIR:-$HOME/.ccache}/ccache.conf}"
26+
mkdir -p $(dirname "$CONF_PATH")
27+
echo "max_size = ${{ inputs.max_size }}" > "$CONF_PATH"
28+
echo "hash_dir = ${{ inputs.hash_dir }}" >> "$CONF_PATH"
29+
echo "compiler_check = ${{ inputs.compiler_check }}" >> "$CONF_PATH"
30+
ccache -p # Print config for verification
31+
ccache -z # Zero statistics before the build
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: build
2+
description: 'Builds the project with ccache integration'
3+
4+
inputs:
5+
generator:
6+
description: 'CMake generator to use'
7+
required: true
8+
configuration:
9+
description: 'Build configuration (Debug, Release, etc.)'
10+
required: true
11+
build_dir:
12+
description: 'Directory to build in'
13+
required: false
14+
default: '.build'
15+
cc:
16+
description: 'C compiler to use'
17+
required: false
18+
default: ''
19+
cxx:
20+
description: 'C++ compiler to use'
21+
required: false
22+
default: ''
23+
compiler-id:
24+
description: 'Unique identifier for compiler/version combination used for cache keys'
25+
required: false
26+
default: ''
27+
cache_version:
28+
description: 'Cache version for invalidation'
29+
required: false
30+
default: '1'
31+
ccache_enabled:
32+
description: 'Whether to use ccache'
33+
required: false
34+
default: 'true'
35+
main_branch:
36+
description: 'Main branch name for restore keys'
37+
required: false
38+
default: 'dev'
39+
40+
runs:
41+
using: 'composite'
42+
steps:
43+
- name: Generate safe branch name
44+
if: inputs.ccache_enabled == 'true'
45+
id: safe-branch
46+
shell: bash
47+
run: |
48+
SAFE_BRANCH=$(echo "${{ github.ref_name }}" | tr -c 'a-zA-Z0-9_.-' '-')
49+
echo "name=${SAFE_BRANCH}" >> $GITHUB_OUTPUT
50+
51+
- name: Restore ccache directory
52+
if: inputs.ccache_enabled == 'true'
53+
id: ccache-restore
54+
uses: actions/cache/restore@v4
55+
with:
56+
path: ~/.ccache
57+
key: ${{ runner.os }}-ccache-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-${{ inputs.configuration }}-${{ steps.safe-branch.outputs.name }}
58+
restore-keys: |
59+
${{ runner.os }}-ccache-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-${{ inputs.configuration }}-${{ inputs.main_branch }}
60+
${{ runner.os }}-ccache-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-${{ inputs.configuration }}-
61+
${{ runner.os }}-ccache-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-
62+
${{ runner.os }}-ccache-v${{ inputs.cache_version }}-
63+
64+
- name: Configure project
65+
shell: bash
66+
run: |
67+
mkdir -p ${{ inputs.build_dir }}
68+
cd ${{ inputs.build_dir }}
69+
70+
# Set compiler environment variables if provided
71+
if [ -n "${{ inputs.cc }}" ]; then
72+
export CC="${{ inputs.cc }}"
73+
fi
74+
75+
if [ -n "${{ inputs.cxx }}" ]; then
76+
export CXX="${{ inputs.cxx }}"
77+
fi
78+
79+
# Configure ccache launcher args
80+
CCACHE_ARGS=""
81+
if [ "${{ inputs.ccache_enabled }}" = "true" ]; then
82+
CCACHE_ARGS="-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
83+
fi
84+
85+
# Run CMake configure
86+
cmake .. \
87+
-G "${{ inputs.generator }}" \
88+
$CCACHE_ARGS \
89+
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
90+
-DCMAKE_BUILD_TYPE=${{ inputs.configuration }}
91+
92+
- name: Build project
93+
shell: bash
94+
run: |
95+
cd ${{ inputs.build_dir }}
96+
cmake --build . --config ${{ inputs.configuration }} --parallel $(nproc)
97+
98+
- name: Show ccache statistics
99+
if: inputs.ccache_enabled == 'true'
100+
shell: bash
101+
run: ccache -s
102+
103+
- name: Save ccache directory
104+
if: inputs.ccache_enabled == 'true'
105+
uses: actions/cache/save@v4
106+
with:
107+
path: ~/.ccache
108+
key: ${{ steps.ccache-restore.outputs.cache-primary-key }}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: dependencies
2+
description: 'Installs build dependencies with caching'
3+
4+
inputs:
5+
configuration:
6+
description: 'Build configuration (Debug, Release, etc.)'
7+
required: true
8+
build_dir:
9+
description: 'Directory to build dependencies in'
10+
required: false
11+
default: '.build'
12+
compiler-id:
13+
description: 'Unique identifier for compiler/version combination used for cache keys'
14+
required: false
15+
default: ''
16+
cache_version:
17+
description: 'Cache version for invalidation'
18+
required: false
19+
default: '1'
20+
cache_enabled:
21+
description: 'Whether to use caching'
22+
required: false
23+
default: 'true'
24+
main_branch:
25+
description: 'Main branch name for restore keys'
26+
required: false
27+
default: 'dev'
28+
29+
outputs:
30+
cache-hit:
31+
description: 'Whether there was a cache hit'
32+
value: ${{ steps.cache-restore-conan.outputs.cache-hit }}
33+
34+
runs:
35+
using: 'composite'
36+
steps:
37+
- name: Generate safe branch name
38+
if: inputs.cache_enabled == 'true'
39+
id: safe-branch
40+
shell: bash
41+
run: |
42+
SAFE_BRANCH=$(echo "${{ github.ref_name }}" | tr -c 'a-zA-Z0-9_.-' '-')
43+
echo "name=${SAFE_BRANCH}" >> $GITHUB_OUTPUT
44+
45+
- name: Restore Conan cache
46+
if: inputs.cache_enabled == 'true'
47+
id: cache-restore-conan
48+
uses: actions/cache/restore@v4
49+
with:
50+
path: |
51+
~/.conan
52+
~/.conan2
53+
key: ${{ runner.os }}-conan-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-${{ hashFiles('**/conanfile.txt', '**/conanfile.py') }}-${{ inputs.configuration }}
54+
restore-keys: |
55+
${{ runner.os }}-conan-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-${{ hashFiles('**/conanfile.txt', '**/conanfile.py') }}-
56+
${{ runner.os }}-conan-v${{ inputs.cache_version }}-${{ inputs.compiler-id }}-
57+
${{ runner.os }}-conan-v${{ inputs.cache_version }}-
58+
59+
- name: Export custom recipes
60+
shell: bash
61+
run: |
62+
conan export external/snappy snappy/1.1.9@
63+
conan export external/soci soci/4.0.3@
64+
65+
- name: Install dependencies
66+
shell: bash
67+
run: |
68+
# Create build directory
69+
mkdir -p ${{ inputs.build_dir }}
70+
cd ${{ inputs.build_dir }}
71+
72+
# Install dependencies using conan
73+
conan install \
74+
--output-folder . \
75+
--build missing \
76+
--settings build_type=${{ inputs.configuration }} \
77+
..
78+
79+
- name: Save Conan cache
80+
if: inputs.cache_enabled == 'true' && steps.cache-restore-conan.outputs.cache-hit != 'true'
81+
uses: actions/cache/save@v4
82+
with:
83+
path: |
84+
~/.conan
85+
~/.conan2
86+
key: ${{ steps.cache-restore-conan.outputs.cache-primary-key }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: checkpatterns
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
checkpatterns:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
12+
- name: Check for suspicious patterns
13+
run: |
14+
if [ -f "suspicious_patterns.sh" ]; then
15+
bash suspicious_patterns.sh
16+
else
17+
echo "Warning: suspicious_patterns.sh not found, skipping check"
18+
# Still exit with success for compatibility with dependent jobs
19+
exit 0
20+
fi

.github/workflows/doxygen.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: MacOS - GA Runner
2+
3+
on:
4+
push:
5+
branches: ["dev", "candidate", "release"]
6+
pull_request:
7+
branches: ["dev", "candidate", "release"]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
test:
15+
strategy:
16+
matrix:
17+
generator:
18+
- Ninja
19+
configuration:
20+
- Debug
21+
runs-on: macos-15
22+
env:
23+
build_dir: .build
24+
# Bump this number to invalidate all caches globally.
25+
CACHE_VERSION: 1
26+
MAIN_BRANCH_NAME: dev
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Install Conan
32+
run: |
33+
brew install conan@1
34+
# Add Conan 1 to the PATH for this job
35+
echo "$(brew --prefix conan@1)/bin" >> $GITHUB_PATH
36+
37+
- name: Install Coreutils
38+
run: |
39+
brew install coreutils
40+
echo "Num proc: $(nproc)"
41+
42+
- name: Install Ninja
43+
if: matrix.generator == 'Ninja'
44+
run: brew install ninja
45+
46+
- name: Install Python
47+
run: |
48+
if which python3 > /dev/null 2>&1; then
49+
echo "Python 3 executable exists"
50+
python3 --version
51+
else
52+
brew install python@3.12
53+
fi
54+
# Create 'python' symlink if it doesn't exist (for tools expecting 'python')
55+
if ! which python > /dev/null 2>&1; then
56+
sudo ln -sf $(which python3) /usr/local/bin/python
57+
fi
58+
59+
- name: Install CMake
60+
run: |
61+
if which cmake > /dev/null 2>&1; then
62+
echo "cmake executable exists"
63+
cmake --version
64+
else
65+
brew install cmake
66+
fi
67+
68+
- name: Install ccache
69+
run: brew install ccache
70+
71+
- name: Configure ccache
72+
uses: ./.github/actions/xahau-configure-ccache
73+
with:
74+
max_size: 2G
75+
hash_dir: true
76+
compiler_check: content
77+
78+
- name: Check environment
79+
run: |
80+
echo "PATH:"
81+
echo "${PATH}" | tr ':' '\n'
82+
which python && python --version || echo "Python not found"
83+
which conan && conan --version || echo "Conan not found"
84+
which cmake && cmake --version || echo "CMake not found"
85+
clang --version
86+
ccache --version
87+
echo "---- Full Environment ----"
88+
env
89+
90+
- name: Configure Conan
91+
run: |
92+
conan profile new default --detect || true # Ignore error if profile exists
93+
conan profile update settings.compiler.cppstd=20 default
94+
95+
- name: Install dependencies
96+
uses: ./.github/actions/xahau-ga-dependencies
97+
with:
98+
configuration: ${{ matrix.configuration }}
99+
build_dir: ${{ env.build_dir }}
100+
compiler-id: clang
101+
cache_version: ${{ env.CACHE_VERSION }}
102+
main_branch: ${{ env.MAIN_BRANCH_NAME }}
103+
104+
- name: Build
105+
uses: ./.github/actions/xahau-ga-build
106+
with:
107+
generator: ${{ matrix.generator }}
108+
configuration: ${{ matrix.configuration }}
109+
build_dir: ${{ env.build_dir }}
110+
compiler-id: clang
111+
cache_version: ${{ env.CACHE_VERSION }}
112+
main_branch: ${{ env.MAIN_BRANCH_NAME }}
113+
114+
- name: Test
115+
run: |
116+
${{ env.build_dir }}/rippled --unittest --unittest-jobs $(nproc)

0 commit comments

Comments
 (0)