-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds clang and sanitizers #148
Merged
agalbachicar
merged 9 commits into
master
from
agalbachicar/#136_add_clang_and_sanitizers
Dec 14, 2020
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
af10766
Adds Github Actions with nightly builds.
agalbachicar bbc3358
Merge branch 'master' into agalbachicar/#136_nightly_builds
agalbachicar 581712b
- Adds missing private dependencies.
agalbachicar ecbe4e3
Fixes clone path of dsim-repos-index
agalbachicar 573d34a
Changed clone and referencing path of dsim-repos-index.
agalbachicar aa613fd
Adds clang and sanitizers to nightly builds.
agalbachicar 72145d0
Fix clang installation script path.
agalbachicar 7ba9dcb
Merge branch 'master' into agalbachicar/#136_add_clang_and_sanitizers
agalbachicar d5cf3b2
Makes the sanitizers to run every Monday.
agalbachicar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#! /bin/bash | ||
|
||
####################################### | ||
# Installs clang suite packages. | ||
# Arguments: | ||
# Version of the clang suite package. | ||
# Returns: | ||
# 0 if no error was detected, non-zero otherwise. | ||
####################################### | ||
function install_clang_suite() { | ||
local version=$1 | ||
|
||
apt install -y \ | ||
clang-${version} \ | ||
lldb-${version} \ | ||
lld-${version} \ | ||
clang-format-${version} \ | ||
clang-tidy-${version} \ | ||
libc++-${version}-dev \ | ||
libc++abi-${version}-dev | ||
} | ||
|
||
####################################### | ||
# Setups alternatives for clang suite. | ||
# Arguments: | ||
# Version of the clang suite package. | ||
# Returns: | ||
# 0 if no error was detected, 2 otherwise. | ||
####################################### | ||
function update_clang_suite_alternatives() { | ||
local version=$1 | ||
local priority=$2 | ||
|
||
update-alternatives \ | ||
--install /usr/bin/clang clang /usr/bin/clang-${version} ${priority}\ | ||
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-${version} \ | ||
--slave /usr/bin/asan_symbolize asan_symbolize /usr/bin/asan_symbolize-${version} \ | ||
--slave /usr/bin/c-index-test c-index-test /usr/bin/c-index-test-${version} \ | ||
--slave /usr/bin/clang-check clang-check /usr/bin/clang-check-${version} \ | ||
--slave /usr/bin/clang-cl clang-cl /usr/bin/clang-cl-${version} \ | ||
--slave /usr/bin/clang-cpp clang-cpp /usr/bin/clang-cpp-${version} \ | ||
--slave /usr/bin/clang-format clang-format /usr/bin/clang-format-${version} \ | ||
--slave /usr/bin/clang-format-diff clang-format-diff /usr/bin/clang-format-diff-${version} \ | ||
--slave /usr/bin/clang-import-test clang-import-test /usr/bin/clang-import-test-${version} \ | ||
--slave /usr/bin/clang-include-fixer clang-include-fixer /usr/bin/clang-include-fixer-${version} \ | ||
--slave /usr/bin/clang-offload-bundler clang-offload-bundler /usr/bin/clang-offload-bundler-${version} \ | ||
--slave /usr/bin/clang-query clang-query /usr/bin/clang-query-${version} \ | ||
--slave /usr/bin/clang-rename clang-rename /usr/bin/clang-rename-${version} \ | ||
--slave /usr/bin/clang-reorder-fields clang-reorder-fields /usr/bin/clang-reorder-fields-${version} \ | ||
--slave /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-${version} \ | ||
--slave /usr/bin/lldb lldb /usr/bin/lldb-${version} \ | ||
--slave /usr/bin/lldb-server lldb-server /usr/bin/lldb-server-${version} | ||
} | ||
|
||
|
||
####################################### | ||
# Modify clang suite version and priority as required. | ||
####################################### | ||
CLANG_SUITE_VERSION=8 | ||
CLANG_SUITE_ALTERNATIVE_PRIORITY=10 | ||
|
||
install_clang_suite ${CLANG_SUITE_VERSION} | ||
update_clang_suite_alternatives ${CLANG_SUITE_VERSION} ${CLANG_SUITE_ALTERNATIVE_PRIORITY} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
name: clang | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
schedule: | ||
- cron: '0 9 * * *' # 9:00am UTC, 1:00am PST. | ||
|
||
env: | ||
PACKAGE_NAME: dsim-repos-index | ||
ROS_DISTRO: dashing | ||
ROS_WS: maliput_ws | ||
|
||
jobs: | ||
compile_and_test: | ||
name: Compile and test | ||
runs-on: ubuntu-18.04 | ||
container: | ||
image: ubuntu:18.04 | ||
strategy: | ||
matrix: | ||
sanitizer: [none, asan, ubsan] | ||
include: | ||
- sanitizer: none | ||
COMPILER_FLAG: '' | ||
- sanitizer: asan | ||
COMPILER_FLAG: ' -DADDRESS_SANITIZER=On' | ||
- sanitizer: ubsan | ||
COMPILER_FLAG: ' -DUNDEFINED_SANITIZER=On' | ||
env: | ||
CC: clang | ||
CXX: clang++ | ||
LINKER_PATH: /usr/bin/llvm-ld | ||
steps: | ||
# setup-ros first since it installs git, which is needed to fetch all branches from actions/checkout | ||
- uses: ros-tooling/[email protected] | ||
# install git from ppa since git 2.18+ is needed to fetch all branches from actions/checkout | ||
# this step can be removed on 20.04 | ||
- name: install git from ppa | ||
shell: bash | ||
run: | | ||
apt update; | ||
apt install -y software-properties-common; | ||
add-apt-repository -y -u ppa:git-core/ppa; | ||
apt install -y git; | ||
- uses: actions/checkout@v2 | ||
with: | ||
path: dsim-repos-index | ||
# clone private dependencies | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: ToyotaResearchInstitute/maliput | ||
fetch-depth: 0 | ||
path: ${{ env.ROS_WS }}/src/maliput | ||
token: ${{ secrets.MALIPUT_TOKEN }} | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: ToyotaResearchInstitute/maliput-dragway | ||
fetch-depth: 0 | ||
path: ${{ env.ROS_WS }}/src/maliput_dragway | ||
token: ${{ secrets.MALIPUT_TOKEN }} | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: ToyotaResearchInstitute/maliput-multilane | ||
fetch-depth: 0 | ||
path: ${{ env.ROS_WS }}/src/maliput_multilane | ||
token: ${{ secrets.MALIPUT_TOKEN }} | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: ToyotaResearchInstitute/maliput_malidrive | ||
fetch-depth: 0 | ||
path: ${{ env.ROS_WS }}/src/maliput_malidrive | ||
token: ${{ secrets.MALIPUT_TOKEN }} | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: ToyotaResearchInstitute/malidrive | ||
fetch-depth: 0 | ||
path: ${{ env.ROS_WS }}/src/malidrive | ||
token: ${{ secrets.MALIPUT_TOKEN }} | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: ToyotaResearchInstitute/delphyne | ||
fetch-depth: 0 | ||
path: ${{ env.ROS_WS }}/src/delphyne | ||
token: ${{ secrets.MALIPUT_TOKEN }} | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: ToyotaResearchInstitute/delphyne-gui | ||
fetch-depth: 0 | ||
path: ${{ env.ROS_WS }}/src/delphyne-gui | ||
token: ${{ secrets.MALIPUT_TOKEN }} | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: ToyotaResearchInstitute/drake-vendor | ||
fetch-depth: 0 | ||
path: ${{ env.ROS_WS }}/src/drake_vendor | ||
token: ${{ secrets.MALIPUT_TOKEN }} | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: ToyotaResearchInstitute/maliput-documentation | ||
fetch-depth: 0 | ||
path: ${{ env.ROS_WS }}/src/maliput_documentation | ||
token: ${{ secrets.MALIPUT_TOKEN }} | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: ToyotaResearchInstitute/maliput-integration | ||
fetch-depth: 0 | ||
path: ${{ env.ROS_WS }}/src/maliput_integration | ||
token: ${{ secrets.MALIPUT_TOKEN }} | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: ToyotaResearchInstitute/maliput-integration-tests | ||
fetch-depth: 0 | ||
path: ${{ env.ROS_WS }}/src/maliput_integration_tests | ||
token: ${{ secrets.MALIPUT_TOKEN }} | ||
- name: check if dependencies have a matching branch | ||
shell: bash | ||
working-directory: ${{ env.ROS_WS }}/src | ||
run: ${GITHUB_WORKSPACE}/dsim-repos-index/.github/try_vcs_checkout ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} . | ||
# install drake_vendor prereqs using dsim-repos-index/tools/prereqs.lib | ||
- name: install drake_vendor prereqs | ||
shell: bash | ||
working-directory: ${{ env.ROS_WS }}/src/drake_vendor | ||
run: ${GITHUB_WORKSPACE}/dsim-repos-index/tools/prereqs-install -t drake . | ||
# install delphyne prereqs using dsim-repos-index/tools/prereqs.lib | ||
- name: install delphyne prereqs | ||
shell: bash | ||
working-directory: ${{ env.ROS_WS }}/src/delphyne | ||
run: ${GITHUB_WORKSPACE}/dsim-repos-index/tools/prereqs-install -t ignition . | ||
# install delphyne-gui prereqs using dsim-repos-index/tools/prereqs.lib | ||
- name: install delphyne-gui prereqs | ||
shell: bash | ||
working-directory: ${{ env.ROS_WS }}/src/delphyne-gui | ||
run: ${GITHUB_WORKSPACE}/dsim-repos-index/tools/prereqs-install -t ignition . | ||
- name: clang 8 install | ||
shell: bash | ||
run: ${GITHUB_WORKSPACE}/dsim-repos-index/.github/clang_suite_installation.sh | ||
# clone public dependencies | ||
- name: vcs import | ||
shell: bash | ||
working-directory: ${{ env.ROS_WS }} | ||
run: vcs import src < ${GITHUB_WORKSPACE}/${PACKAGE_NAME}/.github/dependencies.repos | ||
- run: colcon graph | ||
shell: bash | ||
working-directory: ${{ env.ROS_WS }} | ||
- name: rosdep install | ||
shell: bash | ||
working-directory: ${{ env.ROS_WS }} | ||
run: | | ||
rosdep update; | ||
rosdep install -i -y --rosdistro ${ROS_DISTRO} \ | ||
--skip-keys "ignition-transport5 ignition-msgs2 ignition-math6 ignition-common3 ignition-gui0 ignition-rendering2 libqt5multimedia5 pybind11" \ | ||
--from-paths src | ||
- name: colcon build libraries | ||
shell: bash | ||
working-directory: ${{ env.ROS_WS }} | ||
run: | | ||
. /opt/ros/${ROS_DISTRO}/setup.bash; | ||
colcon build --cmake-args -DCMAKE_LINKER=${LINKER_PATH} \ | ||
--event-handlers=console_direct+ \ | ||
${COMPILER_FLAG} | ||
- name: colcon test | ||
shell: bash | ||
working-directory: ${{ env.ROS_WS }} | ||
run: | | ||
. /opt/ros/${ROS_DISTRO}/setup.bash; | ||
colcon test --event-handlers=console_direct+; | ||
colcon test-result --verbose; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
running clang and the sanitizers every night will multiply my previous estimate of usage time by 4
should we consider only testing gcc for the nightly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to a weekly test.