Skip to content

Commit

Permalink
Refs #20542: Run ASan inside a container
Browse files Browse the repository at this point in the history
Signed-off-by: EduPonz <eduardoponz@eprosima.com>
  • Loading branch information
EduPonz committed Mar 15, 2024
1 parent 447b1bb commit 6e5a9bd
Showing 1 changed file with 54 additions and 43 deletions.
97 changes: 54 additions & 43 deletions .github/workflows/address-sanitizers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,22 @@ concurrency:

jobs:
asan-test:

if: ${{ !(contains(github.event.pull_request.labels.*.name, 'no-test') ||
contains(github.event.pull_request.labels.*.name, 'skip-ci') ||
contains(github.event.pull_request.labels.*.name, 'conflicts')) }}

runs-on: ubuntu-22.04

env:
FASTDDS_BRANCH: ${{ github.head_ref || github.event.inputs.fastdds_branch || 'master' }}
container:
image: ubuntu:22.04
volumes:
- ${{ github.workspace }}:/github/workspace
env:
FASTDDS_BRANCH: ${{ github.head_ref || github.event.inputs.fastdds_branch || 'master' }}

steps:
- name: Install apt packages
uses: eProsima/eProsima-CI/ubuntu/install_apt_packages@v0
with:
packages: curl grep libasio-dev libtinyxml2-dev python3 python3-pip software-properties-common wget
run: |
apt update
apt install -y curl grep libasio-dev libtinyxml2-dev python3 python3-pip software-properties-common wget git libssl-dev build-essential
- name: Get minimum supported version of CMake
uses: eProsima/eProsima-CI/external/get-cmake@v0
Expand All @@ -62,38 +63,40 @@ jobs:
uses: eProsima/eProsima-CI/ubuntu/get_file_from_repo@v0
with:
source_repository: eProsima/Fast-DDS
source_repository_branch: ${{ env.FASTDDS_BRANCH }}
source_repository_branch: ${FASTDDS_BRANCH}
file_name: fastrtps.repos
file_result: fastrtps.repos
file_result: /github/workspace/fastrtps.repos

- name: Fetch Fast DDS & dependencies
uses: eProsima/eProsima-CI/ubuntu/vcs_import@v0
with:
vcs_repos_file: fastrtps.repos
destination_workspace: src
vcs_repos_file: /github/workspace/fastrtps.repos
destination_workspace: /github/workspace/src

- name: Checkout Fast DDS branch
run: |
cd ./src/fastrtps
git checkout ${{ env.FASTDDS_BRANCH }}
cd /github/workspace/src/fastrtps
git checkout ${FASTDDS_BRANCH}
- name: Fetch Fast DDS ASan dependencies
uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0
with:
vcs_repos_file: ${{ github.workspace }}/src/fastrtps/.github/workflows/config/asan.repos
destination_workspace: src
vcs_repos_file: /github/workspace/src/fastrtps/.github/workflows/config/asan.repos
destination_workspace: /github/workspace/src
skip_existing: 'true'

- name: Build workspace
run: |
cat src/fastrtps/.github/workflows/config/asan_colcon.meta
cd /github/workspace
cat /github/workspace/src/fastrtps/.github/workflows/config/asan_colcon.meta
colcon build \
--event-handlers=console_direct+ \
--metas src/fastrtps/.github/workflows/config/asan_colcon.meta
--metas /github/workspace/src/fastrtps/.github/workflows/config/asan_colcon.meta
- name: Run tests Fast DDS
run: |
source install/setup.bash && \
cd /github/workspace
source /github/workspace/install/setup.bash && \
colcon test \
--packages-select fastrtps \
--event-handlers=console_direct+ \
Expand All @@ -107,33 +110,36 @@ jobs:
uses: actions/upload-artifact@v1
with:
name: asan-logs
path: log/
path: /github/workspace/log/
if: always()

- name: Report ASAN errors
if: always()
run: |
cd /github/workspace
bash src/fastrtps/.github/workflows/utils/specific_errors_filter.sh "==ERROR:" log/latest_test/fastrtps/stdout_stderr.log _tmp_specific_error_file.log
python3 src/fastrtps/.github/workflows/utils/log_parser.py --log-file log/latest_test/fastrtps/stdout_stderr.log --specific-error-file _tmp_specific_error_file.log --output-file $GITHUB_STEP_SUMMARY --sanitizer asan
asan-discovery-server-test:

if: ${{ !(contains(github.event.pull_request.labels.*.name, 'no-test') ||
contains(github.event.pull_request.labels.*.name, 'skip-ci') ||
contains(github.event.pull_request.labels.*.name, 'conflicts')) }}

runs-on: ubuntu-22.04

env:
FASTDDS_BRANCH: ${{ github.head_ref || github.event.inputs.fastdds_branch || 'master' }}
DEFAULT_DISCOVERY_SERVER_BRANCH: ${{ github.event.inputs.discovery_server_branch || 'master' }}
container:
image: ubuntu:22.04
volumes:
- ${{ github.workspace }}:/github/workspace
env:
FASTDDS_BRANCH: ${{ github.head_ref || github.event.inputs.fastdds_branch || 'master' }}
DEFAULT_DISCOVERY_SERVER_BRANCH: ${{ github.event.inputs.discovery_server_branch || 'master' }}

steps:
- name: Install apt packages
uses: eProsima/eProsima-CI/ubuntu/install_apt_packages@v0
with:
packages: curl grep libasio-dev libtinyxml2-dev python3 python3-pip software-properties-common wget
run: |
apt update
apt install -y curl grep libasio-dev libtinyxml2-dev python3 python3-pip software-properties-common wget git libssl-dev build-essential
- name: Install colcon
uses: eProsima/eProsima-CI/ubuntu/install_colcon@v0
Expand All @@ -147,43 +153,47 @@ jobs:
uses: eProsima/eProsima-CI/ubuntu/get_file_from_repo@v0
with:
source_repository: eProsima/Fast-DDS
source_repository_branch: ${{ env.FASTDDS_BRANCH }}
source_repository_branch: ${FASTDDS_BRANCH}
file_name: fastrtps.repos
file_result: fastrtps.repos
file_result: /github/workspace/fastrtps.repos

- name: Fetch Fast DDS & dependencies
uses: eProsima/eProsima-CI/ubuntu/vcs_import@v0
with:
vcs_repos_file: fastrtps.repos
destination_workspace: src
vcs_repos_file: /github/workspace/fastrtps.repos
destination_workspace: /github/workspace/src

- name: Checkout Fast DDS branch
run: |
cd ./src/fastrtps
git checkout ${{ env.FASTDDS_BRANCH }}
cd /github/workspace/src/fastrtps
git checkout ${FASTDDS_BRANCH}
- name: Sync eProsima/Discovery-Server repository
uses: actions/checkout@v4
with:
path: src/discovery_server
path: /github/workspace/src/discovery_server
repository: eProsima/Discovery-Server
ref: ${{ env.DEFAULT_DISCOVERY_SERVER_BRANCH }}
ref: ${DEFAULT_DISCOVERY_SERVER_BRANCH}

- name: Install GTest
uses: eProsima/eProsima-CI/ubuntu/install_gtest@v0
- name: Fetch Fast DDS ASan dependencies
uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0
with:
version: v1.12.1
vcs_repos_file: /github/workspace/src/fastrtps/.github/workflows/config/asan.repos
destination_workspace: /github/workspace/src
skip_existing: 'true'

- name: Build workspace
run: |
cat src/fastrtps/.github/workflows/config/asan_colcon.meta
cd /github/workspace
cat /github/workspace/src/fastrtps/.github/workflows/config/asan_colcon.meta
colcon build \
--event-handlers=console_direct+ \
--metas src/fastrtps/.github/workflows/config/asan_colcon.meta
--metas /github/workspace/src/fastrtps/.github/workflows/config/asan_colcon.meta
- name: Run tests Fast DDS
run: |
source install/setup.bash && \
cd /github/workspace
source /github/workspace/install/setup.bash && \
colcon test \
--packages-select discovery-server \
--event-handlers=console_direct+ \
Expand All @@ -197,11 +207,12 @@ jobs:
uses: actions/upload-artifact@v1
with:
name: asan-ds-logs
path: log/
path: /github/workspace/log/
if: always()

- name: Report ASAN errors
if: always()
run: |
cd /github/workspace
bash src/fastrtps/.github/workflows/utils/specific_errors_filter.sh "==ERROR:" log/latest_test/discovery-server/stdout_stderr.log _tmp_specific_error_file.log
python3 src/fastrtps/.github/workflows/utils/log_parser.py --log-file log/latest_test/discovery-server/stdout_stderr.log --specific-error-file _tmp_specific_error_file.log --output-file $GITHUB_STEP_SUMMARY --sanitizer=asan

0 comments on commit 6e5a9bd

Please sign in to comment.