-
Notifications
You must be signed in to change notification settings - Fork 59
150 lines (132 loc) · 5.16 KB
/
BuildAndRun.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Build and run
on:
workflow_dispatch:
schedule:
- cron: 0 0 * * *
pull_request:
paths:
- "**"
- "!docs/**"
- "!README.md"
- "!CONTRIBUTING.md"
- "!.github/**"
- ".github/workflows/BuildAndRun.yaml"
- "!mkdocs.yml"
- "!pyproject.toml"
- "!poetry.lock"
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
job1:
name: BuildAndRun
runs-on: ${{ matrix.runs_on }}
timeout-minutes: 180
container: ros:${{ matrix.rosdistro }}
env:
DEBIAN_FRONTEND: noninteractive
strategy:
fail-fast: false
matrix:
rosdistro: [humble]
runs_on: [ubuntu-22.04] # macos-14 is added for arm support. See also https://x.com/github/status/1752458943245189120?s=20
cmake_build_type: [RelWithDebInfo, Release] # Debug build type is currently unavailable. @TODO Fix problem and add Debug build.
steps:
- name: Suppress warnings
run: git config --global --add safe.directory '*'
- name: Setup workspace
run: mkdir -p src/scenario_simulator_v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
path: src/scenario_simulator_v2
- uses: actions/checkout@v4
with:
repository: RobotecAI/scenario_simulator_v2_scenarios
path: src/scenario_simulator_v2_scenarios
- name: Search packages in this repository
id: list_packages
run: |
echo package_list=$(colcon list --names-only | tr '\n' ' ') >> $GITHUB_OUTPUT
- name: Show target packages
run: |
echo "Target packages: ${{ steps.list_packages.outputs.package_list }}"
- name: Install dependencies
run: |
vcs import src < src/scenario_simulator_v2/dependency_${{ matrix.rosdistro }}.repos
- name: Resolve rosdep and install colcon mixin
run: |
apt-get update
apt-get install -y python3-pip python3-colcon-lcov-result lcov unzip gcovr
rosdep update --include-eol-distros
rosdep install -iy --from-paths src --rosdistro ${{ matrix.rosdistro }}
colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
colcon mixin update default
shell: bash
- name: Install sonar-scanner and build-wrapper
uses: sonarsource/sonarcloud-github-c-cpp@v3
env:
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
- name: Build with SonarCloud Build Wrapper
run: |
source /opt/ros/${{ matrix.rosdistro }}/setup.bash
build-wrapper-linux-x86-64 --out-dir src/scenario_simulator_v2/bw-output \
colcon build --symlink-install \
--cmake-args \
-DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
-DBUILD_CPP_MOCK_SCENARIOS=ON \
-DBUILD_TESTING=true \
-DCMAKE_CXX_FLAGS='-fprofile-arcs -ftest-coverage' \
-DCMAKE_C_FLAGS='-fprofile-arcs -ftest-coverage' \
--packages-up-to ${{ steps.list_packages.outputs.package_list }}
shell: bash
- name: Colcon test
run: |
source /opt/ros/${{ matrix.rosdistro }}/setup.bash
source install/local_setup.bash
colcon test --event-handlers console_cohesion+ --packages-select ${{ steps.list_packages.outputs.package_list }}
colcon lcov-result --packages-select ${{ steps.list_packages.outputs.package_list }}
shell: bash
- name: generate gcov report for sonarcloud
run: gcovr -r src/scenario_simulator_v2 build --sonarqube coverage.xml
- name: Show test result
if: always()
run: |
source /opt/ros/${{ matrix.rosdistro }}/setup.bash
source install/local_setup.bash
colcon test-result --verbose
shell: bash
- name: Scenario test
run: |
source install/setup.bash
source install/local_setup.bash
./src/scenario_simulator_v2/.github/workflows/workflow.sh ./src/scenario_simulator_v2/test_runner/scenario_test_runner/config/workflow.txt global_frame_rate:=20
shell: bash
- name: Upload Lcov result
uses: actions/upload-artifact@v4
with:
name: lcov-${{ matrix.cmake_build_type }}
path: lcov
retention-days: 1
- name: Upload Gcov result
uses: actions/upload-artifact@v4
with:
name: coverage${{ matrix.cmake_build_type }}.xml
path: coverage.xml
retention-days: 1
- name: Run SonarCloud scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io/
working-directory: src/scenario_simulator_v2/
run: sonar-scanner --define sonar.cfamily.compile-commands="bw-output/compile_commands.json"
# - name: Basic test
# run: |
# source install/setup.bash
# source install/local_setup.bash
# ./src/scenario_simulator_v2/.github/workflows/workflow.sh ./src/scenario_simulator_v2_scenarios/workflow/basic.txt
# shell: bash