forked from autowarefoundation/autoware
-
Notifications
You must be signed in to change notification settings - Fork 13
90 lines (86 loc) · 3.82 KB
/
Ci.yml
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
# GitHub Actions triggers based on the PR's and each commits on develop and master
name: "CI: Run tests"
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [develop, master, feature/add_gha]
workflow_dispatch:
jobs:
build:
defaults:
run:
shell: bash
working-directory: "/opt/carma/"
runs-on: ubuntu-latest
container:
image: usdotfhwastoldev/carma-base:develop
env:
INIT_ENV: "/home/carma/.base-image/init-env.sh"
ROS_2_ENV: "/opt/ros/foxy/setup.bash"
TERM: xterm
options: "--user root"
steps:
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@v3.3.0
with:
path: src/${{ github.event.repository.name }}
fetch-depth: 0
- name: Move source code
run: |
mv $GITHUB_WORKSPACE/src /opt/carma/
- name: Checkout Dependencies
run: |
./src/${{ github.event.repository.name }}/docker/checkout.bash -r /opt/carma
- name: Build ROS1
run: |
source "$INIT_ENV"
cd /opt/carma/src/${{ github.event.repository.name }}
export ROS_PARALLEL_JOBS='-j4 -l4'
export AUTOWARE_COMPILE_WITH_CUDA=1
PACKAGES=$(find . -maxdepth 2 -type f -name package.xml | sed 's/\.\///' | cut -d/ -f1)
sed -i '/colcon build/ s/$/ --packages-up-to $PACKAGES/' /home/carma/.ci-image/engineering_tools/code_coverage/make_with_coverage.bash
make_with_coverage.bash -m -e /opt/carma/ -o ./coverage_reports/gcov
- name: Run ROS1 C++ Tests
continue-on-error: true
run: |
source "$INIT_ENV"
cd /opt/carma/src/${{ github.event.repository.name }}
export ROS_PARALLEL_JOBS='-j4 -l4'
sed -i '/colcon test/ s/$/ --packages-above $PACKAGES/' /home/carma/.ci-image/engineering_tools/code_coverage/make_with_coverage.bash
make_with_coverage.bash -t -e /opt/carma/ -o ./coverage_reports/gcov
- name: Build ROS2
continue-on-error: true
run: |
source "$INIT_ENV"
source "$ROS_2_ENV"
cd /opt/carma/src/${{ github.event.repository.name }}
export ROS_PARALLEL_JOBS='-j4 -l4'
export AUTOWARE_COMPILE_WITH_CUDA=1
PACKAGES=$(find . -maxdepth 2 -type f -name package.xml | sed 's/\.\///' | cut -d/ -f1)
sed -i '/colcon build/ s/$/ --packages-up-to $PACKAGES/' /home/carma/.ci-image/engineering_tools/code_coverage/make_with_coverage.bash
make_with_coverage.bash -m -e /opt/carma/ -o ./coverage_reports/gcov
- name: Run ROS2 C++ Tests
continue-on-error: true
run: |
source "$INIT_ENV"
source "$ROS_2_ENV"
cd /opt/carma/src/${{ github.event.repository.name }}
export ROS_PARALLEL_JOBS='-j4 -l4'
sed -i '/colcon test/ s/$/ --packages-above $PACKAGES/' /home/carma/.ci-image/engineering_tools/code_coverage/make_with_coverage.bash
make_with_coverage.bash -t -e /opt/carma/ -o ./coverage_reports/gcov
- name: Combine ROS1 and ROS2 compile_commands.json files
# Combine the ROS1 and ROS2 compile_commands.json files for sonarscan
run: |
mv /opt/carma/build/compile_commands.json /opt/carma/compile_commands.ros2.json
jq -s add /opt/carma/compile_commands.ros1.json /opt/carma/compile_commands.ros2.json > /opt/carma/build/compile_commands.json
- name: Upload Coverage Reports
uses: actions/upload-artifact@v2
with:
name: coverage-reports
path: /opt/carma/src/${{ github.event.repository.name }}/coverage_reports/
- name: Run SonarScanner
uses: usdot-fhwa-stol/actions/sonar-scanner@main
with:
sonar-token: ${{ secrets.SONAR_TOKEN }}
working-dir: "/opt/carma/src/${{ github.event.repository.name }}"