Skip to content

Commit

Permalink
Merge branch 'ci/conan2' into vault_conan2
Browse files Browse the repository at this point in the history
  • Loading branch information
Bronek committed Feb 7, 2025
2 parents 87d8881 + 53b620a commit 8f254fd
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 260 deletions.
33 changes: 13 additions & 20 deletions .github/actions/dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,38 @@ inputs:
runs:
using: composite
steps:
- name: unlock Conan
- name: Conan profile
shell: bash
run: conan remove --locks
- name: export custom recipes
shell: bash
run: |
conan config set general.revisions_enabled=1
conan export external/snappy snappy/1.1.10@
conan export external/rocksdb rocksdb/6.29.5@
conan export external/soci soci/4.0.3@
conan export external/nudb nudb/2.0.8@
run : |
echo '```' >> "${GITHUB_STEP_SUMMARY}"
conan profile show --profile default | tee -a "${GITHUB_STEP_SUMMARY}"
echo '```' >> "${GITHUB_STEP_SUMMARY}"
- name: add Ripple Conan remote
shell: bash
run: |
conan remote list
conan remote remove ripple || true
# Do not quote the URL. An empty string will be accepted (with
# a non-fatal warning), but a missing argument will not.
conan remote add ripple ${{ env.CONAN_URL }} --insert 0
conan remote add --index 0 ripple ${{ env.CONAN_URL }}
- name: try to authenticate to Ripple Conan remote
id: remote
shell: bash
run: |
# `conan user` implicitly uses the environment variables
# `conan remote auth` implicitly uses the environment variables
# CONAN_LOGIN_USERNAME_<REMOTE> and CONAN_PASSWORD_<REMOTE>.
# https://docs.conan.io/1/reference/commands/misc/user.html#using-environment-variables
# https://docs.conan.io/1/reference/env_vars.html#conan-login-username-conan-login-username-remote-name
# https://docs.conan.io/1/reference/env_vars.html#conan-password-conan-password-remote-name
echo outcome=$(conan user --remote ripple --password >&2 \
# https://docs.conan.io/2/reference/commands/remote.html
conan remote auth ripple
echo outcome=$(conan remote login ripple 1>&2 \
&& echo success || echo failure) | tee ${GITHUB_OUTPUT}
- name: list missing binaries
id: binaries
shell: bash
# Print the list of dependencies that would need to be built locally.
# A non-empty list means we have "failed" to cache binaries remotely.
run: |
echo missing=$(conan info . --build missing --settings build_type=${{ inputs.configuration }} --json 2>/dev/null | grep '^\[') | tee ${GITHUB_OUTPUT}
echo missing=$(conan graph build-order --build missing --settings build_type=${{ inputs.configuration }} --reduce --order-by configuration --format json 2>error | jq .order) | tee ${GITHUB_OUTPUT}
cat error
- name: install dependencies
shell: bash
run: |
Expand All @@ -51,11 +46,9 @@ runs:
conan install \
--output-folder . \
--build missing \
--options tests=True \
--options xrpld=True \
--settings build_type=${{ inputs.configuration }} \
..
- name: upload dependencies to remote
if: (steps.binaries.outputs.missing != '[]') && (steps.remote.outputs.outcome == 'success')
shell: bash
run: conan upload --remote ripple '*' --all --parallel --confirm
run: conan upload --remote ripple --confirm '*'
25 changes: 25 additions & 0 deletions .github/actions/environment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: environment
runs:
using: composite
steps:
- name: install Conan
if: runner.os == 'Linux' || runner.os == 'Windows'
shell: bash
run: |
pip install --upgrade conan
- name: install Conan and Ninja
if: runner.os == 'macOS'
shell: bash
run: |
brew install conan
brew install ninja
echo '/opt/homebrew/opt/conan/bin' >> ${GITHUB_PATH}
- name: check environment
shell: bash
run: |
env | sort
echo ${PATH} | tr ':' '\n'
type conan
conan --version
type cmake
cmake --version
30 changes: 30 additions & 0 deletions .github/conan/profiles/default
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
include(detected)

{% import "matrix" as matrix %}

[settings]
compiler.cppstd=20

{% if platform.system() == "Linux" %}
compiler={{ matrix.compiler }}
compiler.version={{ matrix.version }}
compiler.libcxx=libstdc++11
{% endif %}

{% if platform.system() == "Window" %}
compiler.runtime={{ matrix.runtime }}
{% endif %}

[conf]
tools.build:cxxflags+=["-DBOOST_BEAST_USE_STD_STRING_VIEW"]
tools.build:cxxflags+=["-DBOOST_ASIO_HAS_STD_INVOKE_RESULT"]
tools.build:cxxflags+=["-DBOOST_ASIO_DISABLE_CONCEPTS"]

{% if platform.system() == "Linux" %}
tools.build:compiler_executables={"c": "{{ matrix.cc }}", "cpp": "{{ matrix.cxx }}"}
{% endif %}

[options]
boost/*:extra_b2_flags="define=BOOST_ASIO_HAS_STD_INVOKE_RESULT"
xrpl/*:xrpld=True
xrpl/*:tests=True
44 changes: 6 additions & 38 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,48 +32,16 @@ jobs:
build_dir: .build
NUM_PROCESSORS: 12
steps:
# We must checkout first to make local actions available.
- name: checkout
uses: actions/checkout@v4
- name: install Conan
run: |
brew install conan@1
echo '/opt/homebrew/opt/conan@1/bin' >> $GITHUB_PATH
- name: install Ninja
if: matrix.generator == 'Ninja'
run: brew install ninja
- name: install python
run: |
if which python > /dev/null 2>&1; then
echo "Python executable exists"
else
brew install python@3.13
ln -s /opt/homebrew/bin/python3 /opt/homebrew/bin/python
fi
- name: install cmake
run: |
if which cmake > /dev/null 2>&1; then
echo "cmake executable exists"
else
brew install cmake
fi
- name: install nproc
run: |
brew install coreutils
- name: check environment
run: |
env | sort
echo ${PATH} | tr ':' '\n'
python --version
conan --version
cmake --version
nproc --version
echo -n "nproc returns: "
nproc
- name: environment
uses: ./.github/actions/environment
- name: configure Conan
run : |
conan profile new default --detect || true
conan profile update settings.compiler.cppstd=20 default
conan profile update 'conf.tools.build:cxxflags+=["-DBOOST_ASIO_DISABLE_CONCEPTS"]' default
conan config install .github/conan/
conan profile detect --name detected || true
touch $(conan config home)/profiles/matrix
- name: build dependencies
uses: ./.github/actions/dependencies
env:
Expand Down
81 changes: 30 additions & 51 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,32 +63,24 @@ jobs:
env:
build_dir: .build
steps:
- name: upgrade conan
run: |
pip install --upgrade "conan<2"
# We must checkout first to make local actions available.
- name: checkout
uses: actions/checkout@v4
- name: check environment
run: |
echo ${PATH} | tr ':' '\n'
lsb_release -a || true
${{ matrix.profile.cc }} --version
conan --version
cmake --version
env | sort
- name: environment
uses: ./.github/actions/environment
- name: configure Conan
run: |
conan profile new default --detect
conan profile update settings.compiler.cppstd=20 default
conan profile update settings.compiler=${{ matrix.compiler }} default
conan profile update settings.compiler.version=${{ matrix.profile.version }} default
conan profile update settings.compiler.libcxx=libstdc++11 default
conan profile update env.CC=${{ matrix.profile.cc }} default
conan profile update env.CXX=${{ matrix.profile.cxx }} default
conan profile update conf.tools.build:compiler_executables='{"c": "${{ matrix.profile.cc }}", "cpp": "${{ matrix.profile.cxx }}"}' default
conan config install .github/conan/
conan profile detect --name detected
cat >$(conan config home)/profiles/matrix <<EOF
{% set compiler = "${{ matrix.compiler }}" %}
{% set version = "${{ matrix.profile.version }}" %}
{% set cc = "${{ matrix.profile.cc }}" %}
{% set cxx = "${{ matrix.profile.cxx }}" %}
EOF
- name: archive profile
# Create this archive before dependencies are added to the local cache.
run: tar -czf conan.tar -C ~/.conan .
run: tar -czf conan.tar -C ~/.conan2 .
- name: build dependencies
uses: ./.github/actions/dependencies
env:
Expand Down Expand Up @@ -134,16 +126,12 @@ jobs:
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
- name: extract cache
run: |
mkdir -p ~/.conan
tar -xzf conan.tar -C ~/.conan
- name: check environment
run: |
env | sort
echo ${PATH} | tr ':' '\n'
conan --version
cmake --version
mkdir -p ~/.conan2
tar -xzf conan.tar -C ~/.conan2
- name: checkout
uses: actions/checkout@v4
- name: environment
uses: ./.github/actions/environment
- name: dependencies
uses: ./.github/actions/dependencies
env:
Expand Down Expand Up @@ -185,20 +173,14 @@ jobs:
name: ${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.configuration }}
- name: extract cache
run: |
mkdir -p ~/.conan
tar -xzf conan.tar -C ~/.conan
- name: install gcovr
run: pip install "gcovr>=7,<8"
- name: check environment
run: |
echo ${PATH} | tr ':' '\n'
conan --version
cmake --version
gcovr --version
env | sort
ls ~/.conan
mkdir -p ~/.conan2
tar -xzf conan.tar -C ~/.conan2
- name: checkout
uses: actions/checkout@v4
- name: environment
uses: ./.github/actions/environment
- name: install gcovr
run: pip install "gcovr>=7,<8"
- name: dependencies
uses: ./.github/actions/dependencies
env:
Expand Down Expand Up @@ -258,16 +240,12 @@ jobs:
name: linux-gcc-${{ env.configuration }}
- name: extract cache
run: |
mkdir -p ~/.conan
tar -xzf conan.tar -C ~/.conan
- name: check environment
run: |
env | sort
echo ${PATH} | tr ':' '\n'
conan --version
cmake --version
mkdir -p ~/.conan2
tar -xzf conan.tar -C ~/.conan2
- name: checkout
uses: actions/checkout@v4
- name: environment
uses: ./.github/actions/environment
- name: dependencies
uses: ./.github/actions/dependencies
env:
Expand All @@ -276,18 +254,19 @@ jobs:
configuration: ${{ env.configuration }}
- name: export
run: |
version=$(conan inspect --raw version .)
apt install --yes jq
version=$(conan inspect --format json . | jq --raw-output .version)
reference="xrpl/${version}@local/test"
conan remove -f ${reference} || true
conan export . local/test
conan export --user local --channel test .
echo "reference=${reference}" >> "${GITHUB_ENV}"
- name: build
run: |
cd examples/example
mkdir ${build_dir}
cd ${build_dir}
conan install .. --output-folder . \
--require-override ${reference} --build missing
--requires ${reference} --build missing
cmake .. \
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=./build/${configuration}/generators/conan_toolchain.cmake \
-DCMAKE_BUILD_TYPE=${configuration}
Expand Down
26 changes: 10 additions & 16 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ jobs:
env:
build_dir: .build
steps:
- name: checkout
uses: actions/checkout@v4
- name: choose Python
uses: actions/setup-python@v5
with:
Expand All @@ -56,23 +54,19 @@ jobs:
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/windows.yml') }}
- name: install Conan
run: pip install wheel 'conan<2'
- name: check environment
run: |
dir env:
$env:PATH -split ';'
python --version
conan --version
cmake --version
# We must checkout first to make local actions available.
- name: checkout
uses: actions/checkout@v4
- name: environment
uses: ./.github/actions/environment
- name: configure Conan
shell: bash
run: |
conan profile new default --detect
conan profile update settings.compiler.cppstd=20 default
conan profile update \
settings.compiler.runtime=MT${{ matrix.configuration.runtime }} \
default
conan config install .github/conan/
conan profile detect --name detected
cat >$(conan config home)/profiles/matrix <<EOF
{% set runtime = "MT${{ matrix.configuration == 'Debug' && 'd' || '' }}" %}
EOF
- name: build dependencies
uses: ./.github/actions/dependencies
env:
Expand Down
Loading

0 comments on commit 8f254fd

Please sign in to comment.