mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-23 12:35:50 +00:00
Added flow for the sanitizers build
Signed-off-by: Pratik Mankawde <pmankawde@ripple.com>
This commit is contained in:
7
.github/actions/build-deps/action.yml
vendored
7
.github/actions/build-deps/action.yml
vendored
@@ -21,6 +21,11 @@ inputs:
|
|||||||
description: "The logging verbosity."
|
description: "The logging verbosity."
|
||||||
required: false
|
required: false
|
||||||
default: "verbose"
|
default: "verbose"
|
||||||
|
sanitizers:
|
||||||
|
description: "The sanitizers to enable ('None', 'Address', 'Thread')."
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
default: "None"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
@@ -33,11 +38,13 @@ runs:
|
|||||||
BUILD_OPTION: ${{ inputs.force_build == 'true' && '*' || 'missing' }}
|
BUILD_OPTION: ${{ inputs.force_build == 'true' && '*' || 'missing' }}
|
||||||
BUILD_TYPE: ${{ inputs.build_type }}
|
BUILD_TYPE: ${{ inputs.build_type }}
|
||||||
LOG_VERBOSITY: ${{ inputs.log_verbosity }}
|
LOG_VERBOSITY: ${{ inputs.log_verbosity }}
|
||||||
|
CMAKE_SANITIZERS: ${{ inputs.sanitizers }}
|
||||||
run: |
|
run: |
|
||||||
echo 'Installing dependencies.'
|
echo 'Installing dependencies.'
|
||||||
mkdir -p "${BUILD_DIR}"
|
mkdir -p "${BUILD_DIR}"
|
||||||
cd "${BUILD_DIR}"
|
cd "${BUILD_DIR}"
|
||||||
conan install \
|
conan install \
|
||||||
|
--profile ci \
|
||||||
--output-folder . \
|
--output-folder . \
|
||||||
--build="${BUILD_OPTION}" \
|
--build="${BUILD_OPTION}" \
|
||||||
--options:host='&:tests=True' \
|
--options:host='&:tests=True' \
|
||||||
|
|||||||
2
.github/actions/setup-conan/action.yml
vendored
2
.github/actions/setup-conan/action.yml
vendored
@@ -28,7 +28,7 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo 'Installing profile.'
|
echo 'Installing profile.'
|
||||||
conan config install conan/profiles/default -tf $(conan config home)/profiles/
|
conan config install conan/profiles/ -tf $(conan config home)/profiles/
|
||||||
|
|
||||||
echo 'Conan profile:'
|
echo 'Conan profile:'
|
||||||
conan profile show
|
conan profile show
|
||||||
|
|||||||
8
.github/scripts/strategy-matrix/generate.py
vendored
8
.github/scripts/strategy-matrix/generate.py
vendored
@@ -30,7 +30,7 @@ We will further set additional CMake arguments as follows:
|
|||||||
'''
|
'''
|
||||||
def generate_strategy_matrix(all: bool, config: Config) -> list:
|
def generate_strategy_matrix(all: bool, config: Config) -> list:
|
||||||
configurations = []
|
configurations = []
|
||||||
for architecture, os, build_type, cmake_args in itertools.product(config.architecture, config.os, config.build_type, config.cmake_args):
|
for architecture, os, build_type, cmake_args, sanitizers in itertools.product(config.architecture, config.os, config.build_type, config.cmake_args, config.sanitizers):
|
||||||
# The default CMake target is 'all' for Linux and MacOS and 'install'
|
# The default CMake target is 'all' for Linux and MacOS and 'install'
|
||||||
# for Windows, but it can get overridden for certain configurations.
|
# for Windows, but it can get overridden for certain configurations.
|
||||||
cmake_target = 'install' if os["distro_name"] == 'windows' else 'all'
|
cmake_target = 'install' if os["distro_name"] == 'windows' else 'all'
|
||||||
@@ -125,6 +125,11 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
if build_type == 'Release':
|
if build_type == 'Release':
|
||||||
cmake_args = f'{cmake_args} -Dassert=ON'
|
cmake_args = f'{cmake_args} -Dassert=ON'
|
||||||
|
|
||||||
|
if sanitizers == 'Address':
|
||||||
|
cmake_args = f'{cmake_args} -fsanitize=address,undefined,float-divide-by-zero,unsigned-integer-overflow'
|
||||||
|
elif sanitizers == 'Thread':
|
||||||
|
cmake_args = f'{cmake_args} -fsanitize=thread,undefined,float-divide-by-zero,unsigned-integer-overflow'
|
||||||
|
|
||||||
# We skip all RHEL on arm64 due to a build failure that needs further
|
# We skip all RHEL on arm64 due to a build failure that needs further
|
||||||
# investigation.
|
# investigation.
|
||||||
if os['distro_name'] == 'rhel' and architecture['platform'] == 'linux/arm64':
|
if os['distro_name'] == 'rhel' and architecture['platform'] == 'linux/arm64':
|
||||||
@@ -166,6 +171,7 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
|
|||||||
'build_type': build_type,
|
'build_type': build_type,
|
||||||
'os': os,
|
'os': os,
|
||||||
'architecture': architecture,
|
'architecture': architecture,
|
||||||
|
'sanitizers': sanitizers
|
||||||
})
|
})
|
||||||
|
|
||||||
return configurations
|
return configurations
|
||||||
|
|||||||
3
.github/scripts/strategy-matrix/linux.json
vendored
3
.github/scripts/strategy-matrix/linux.json
vendored
@@ -180,5 +180,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"build_type": ["Debug", "Release"],
|
"build_type": ["Debug", "Release"],
|
||||||
"cmake_args": ["-Dunity=OFF", "-Dunity=ON"]
|
"cmake_args": ["-Dunity=OFF", "-Dunity=ON"],
|
||||||
|
"sanitizers": ["None", "Address", "Thread"]
|
||||||
}
|
}
|
||||||
|
|||||||
3
.github/scripts/strategy-matrix/macos.json
vendored
3
.github/scripts/strategy-matrix/macos.json
vendored
@@ -18,5 +18,6 @@
|
|||||||
"cmake_args": [
|
"cmake_args": [
|
||||||
"-Dunity=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5",
|
"-Dunity=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5",
|
||||||
"-Dunity=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5"
|
"-Dunity=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5"
|
||||||
]
|
],
|
||||||
|
"sanitizers": ["None", "Address", "Thread"]
|
||||||
}
|
}
|
||||||
|
|||||||
3
.github/scripts/strategy-matrix/windows.json
vendored
3
.github/scripts/strategy-matrix/windows.json
vendored
@@ -15,5 +15,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"build_type": ["Debug", "Release"],
|
"build_type": ["Debug", "Release"],
|
||||||
"cmake_args": ["-Dunity=OFF", "-Dunity=ON"]
|
"cmake_args": ["-Dunity=OFF", "-Dunity=ON"],
|
||||||
|
"sanitizers": ["None", "Address", "Thread"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ on:
|
|||||||
description: "The CMake target to build."
|
description: "The CMake target to build."
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
|
sanitizers:
|
||||||
|
description: "The sanitizers to enable ('None', 'Address', 'Thread')."
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
default: "None"
|
||||||
|
|
||||||
runs_on:
|
runs_on:
|
||||||
description: Runner to run the job on as a JSON string
|
description: Runner to run the job on as a JSON string
|
||||||
@@ -61,6 +66,7 @@ jobs:
|
|||||||
runs_on: ${{ inputs.runs_on }}
|
runs_on: ${{ inputs.runs_on }}
|
||||||
image: ${{ inputs.image }}
|
image: ${{ inputs.image }}
|
||||||
config_name: ${{ inputs.config_name }}
|
config_name: ${{ inputs.config_name }}
|
||||||
|
sanitizers: ${{ inputs.sanitizers }}
|
||||||
nproc_subtract: ${{ inputs.nproc_subtract }}
|
nproc_subtract: ${{ inputs.nproc_subtract }}
|
||||||
secrets:
|
secrets:
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|||||||
6
.github/workflows/reusable-build-test.yml
vendored
6
.github/workflows/reusable-build-test.yml
vendored
@@ -23,6 +23,11 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: "minimal"
|
default: "minimal"
|
||||||
|
sanitizers:
|
||||||
|
description: "The sanitizers to enable ('None', 'Address', 'Thread')."
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
default: "None"
|
||||||
secrets:
|
secrets:
|
||||||
CODECOV_TOKEN:
|
CODECOV_TOKEN:
|
||||||
description: "The Codecov token to use for uploading coverage reports."
|
description: "The Codecov token to use for uploading coverage reports."
|
||||||
@@ -54,5 +59,6 @@ jobs:
|
|||||||
runs_on: ${{ toJSON(matrix.architecture.runner) }}
|
runs_on: ${{ toJSON(matrix.architecture.runner) }}
|
||||||
image: ${{ contains(matrix.architecture.platform, 'linux') && format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}-sha-{4}', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version, matrix.os.image_sha) || '' }}
|
image: ${{ contains(matrix.architecture.platform, 'linux') && format('ghcr.io/xrplf/ci/{0}-{1}:{2}-{3}-sha-{4}', matrix.os.distro_name, matrix.os.distro_version, matrix.os.compiler_name, matrix.os.compiler_version, matrix.os.image_sha) || '' }}
|
||||||
config_name: ${{ matrix.config_name }}
|
config_name: ${{ matrix.config_name }}
|
||||||
|
sanitizers: ${{ inputs.sanitizers }}
|
||||||
secrets:
|
secrets:
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|||||||
6
.github/workflows/reusable-build.yml
vendored
6
.github/workflows/reusable-build.yml
vendored
@@ -19,6 +19,11 @@ on:
|
|||||||
description: "The CMake target to build."
|
description: "The CMake target to build."
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
sanitizers:
|
||||||
|
description: "The sanitizers to enable ('None', 'Address', 'Thread')."
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
default: "None"
|
||||||
|
|
||||||
runs_on:
|
runs_on:
|
||||||
description: Runner to run the job on as a JSON string
|
description: Runner to run the job on as a JSON string
|
||||||
@@ -85,6 +90,7 @@ jobs:
|
|||||||
build_dir: ${{ inputs.build_dir }}
|
build_dir: ${{ inputs.build_dir }}
|
||||||
build_nproc: ${{ steps.nproc.outputs.nproc }}
|
build_nproc: ${{ steps.nproc.outputs.nproc }}
|
||||||
build_type: ${{ inputs.build_type }}
|
build_type: ${{ inputs.build_type }}
|
||||||
|
sanitizers: ${{ inputs.sanitizers }}
|
||||||
# Set the verbosity to "quiet" for Windows to avoid an excessive
|
# Set the verbosity to "quiet" for Windows to avoid an excessive
|
||||||
# amount of logs. For other OSes, the "verbose" logs are more useful.
|
# amount of logs. For other OSes, the "verbose" logs are more useful.
|
||||||
log_verbosity: ${{ runner.os == 'Windows' && 'quiet' || 'verbose' }}
|
log_verbosity: ${{ runner.os == 'Windows' && 'quiet' || 'verbose' }}
|
||||||
|
|||||||
11
conan/profiles/ci
Normal file
11
conan/profiles/ci
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
include(./default)
|
||||||
|
|
||||||
|
[settings]
|
||||||
|
{% set sanitizers = os.getenv("CMAKE_SANITIZERS") %}
|
||||||
|
|
||||||
|
[conf]
|
||||||
|
{% if sanitizers == "Address" %}
|
||||||
|
tools.build:cxxflags+=['-fsanitize=address,undefined,float-divide-by-zero,unsigned-integer-overflow']
|
||||||
|
{% elif sanitizers == "Thread" %}
|
||||||
|
tools.build:cxxflags+=['-fsanitize=thread,undefined,float-divide-by-zero,unsigned-integer-overflow']
|
||||||
|
{% endif %}
|
||||||
Reference in New Issue
Block a user