-
Notifications
You must be signed in to change notification settings - Fork 11
205 lines (203 loc) · 8.5 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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
name: CI
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [develop, master]
jobs:
docker-build:
strategy:
matrix:
include:
- ubuntu-codename: bionic
build_lanelet_aware: true
# Currently install_lanelet2_dependencies.sh script only works for bionic. Disabled lanelet_aware build on newer distributions pending script updates.
- ubuntu-codename: focal
build_lanelet_aware: false
# Currently install_lanelet2_dependencies.sh script only works for bionic. Disabled lanelet_aware build on newer distributions pending script updates.
- ubuntu-codename: jammy
build_lanelet_aware: false
runs-on: ubuntu-latest
steps:
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker Build Streets Service Base
uses: docker/build-push-action@v3
with:
push: true
build-args: |
UBUNTU_CODENAME=${{ matrix.ubuntu-codename }}
tags: usdotfhwastoldev/streets_service_base:${{ matrix.ubuntu-codename }}
file: ./streets_service_base/Dockerfile
- name: Docker Build Streets Service Base Lanelet Aware
if: ${{ matrix.build_lanelet_aware }}
uses: docker/build-push-action@v3
with:
push: true
tags: usdotfhwastoldev/streets_service_base_lanelet_aware:bionic
file: ./streets_service_base_lanelet_aware/Dockerfile
build:
needs: docker-build
defaults:
run:
shell: bash
runs-on: ubuntu-latest-8-cores
container:
image: usdotfhwastoldev/streets_service_base_lanelet_aware:bionic
env:
DEBIAN_FRONTEND: noninteractive
SONAR_SCANNER_VERSION: "5.0.1.3006"
TERM: xterm
options: "--user root"
steps:
# Bionic's git version is not sufficient for actions/checkout 0 fetch-depth,
# remove this step after rebasing carma-streets to newer Ubuntu release
- name: Install newer git for checkout
run: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository -u ppa:git-core/ppa
apt-get install -y git
- name: Checkout ${{ github.event.repository.name }}
uses: actions/[email protected]
with:
path: ${{ github.event.repository.name }}
fetch-depth: 0
- name: Move source code
run: mv $GITHUB_WORKSPACE/${{ github.event.repository.name }} /home/carma-streets
- name: Install dependencies
run: |
# mkdir /home/carma-streets/.base-image
# touch /home/carma-streets/.base-image/init-env.sh
cd /home/carma-streets/build_scripts
# ./install_dependencies.sh
./install_test_dependencies.sh
mkdir -p /home/carma-streets/ext
./install_rest_server_dependencies.sh
# - name: Install librdkafka
# run: |
# cd /home/carma-streets/ext/
# git clone --depth 1 https://github.com/confluentinc/librdkafka.git /home/carma-streets/ext/librdkafka
# cd /home/carma-streets/ext/librdkafka/
# cmake -H. -B_cmake_build
# cmake --build _cmake_build
# cmake --build _cmake_build --target install
# - name: Install rapidjson
# run: |
# cd /home/carma-streets/ext/
# git clone https://github.com/Tencent/rapidjson /home/carma-streets/ext/rapidjson
# cd /home/carma-streets/ext/rapidjson
# git checkout a95e013b97ca6523f32da23f5095fcc9dd6067e5
# mkdir -p /home/carma-streets/ext/rapidjson/build
# cd /home/carma-streets/ext/rapidjson/build
# cmake ..
# make -j
# make install
- name: Install net-snmp
run: |
cd /home/carma-streets/ext/
apt-get install -y libperl-dev curl
curl -k -L -O http://sourceforge.net/projects/net-snmp/files/net-snmp/5.9.1/net-snmp-5.9.1.tar.gz
tar -xvzf /home/carma-streets/ext/net-snmp-5.9.1.tar.gz
cd net-snmp-5.9.1/
./configure --with-default-snmp-version="1" --with-sys-contact="@@no.where" --with-sys-location="Unknown" --with-logfile="/var/log/snmpd.log" --with-persistent-directory="/var/net-snmp"
make -j
make install
# - name: Install PROJ for coordinate transformations
# run: |
# git clone --depth 1 https://github.com/OSGeo/PROJ.git /home/carma-streets/PROJ --branch 6.2.1
# cd /home/carma-streets/PROJ
# ./autogen.sh
# ./configure
# make -j
# make install
# - name: Download a cmake module for PROJ
# run: |
# cd /usr/share/cmake-3.10/Modules
# curl -O https://raw.githubusercontent.com/mloskot/cmake-modules/master/modules/FindPROJ4.cmake
# - name: Install ROS melodic
# run: |
# apt install -y lsb-release
# sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
# curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc |apt-key add -
# apt-get update
# apt-get install -y ros-melodic-catkin
# cd /opt/ros/melodic/
# ls -a
# mkdir -p /home/carma-streets/.base-image
# echo "source /opt/ros/melodic/setup.bash" > "$INIT_ENV"
# - name: Install carma_lanelet2
# run: |
# mkdir -p /home/carma-streets/carma_lanelet2/src
# cd /home/carma-streets/carma_lanelet2/src
# git init
# echo "temp"
# git remote add origin -f https://github.com/usdot-fhwa-stol/autoware.ai.git
# git config core.sparsecheckout true
# echo "common/hardcoded_params/*" >> .git/info/sparse-checkout
# echo "common/lanelet2_extension/*" >> .git/info/sparse-checkout
# echo "lanelet2/*" >> .git/info/sparse-checkout
# echo "mrt_cmake_modules/*" >> .git/info/sparse-checkout
# git pull --depth 1 origin refactor_lanelet2_extension
# git checkout refactor_lanelet2_extension
# rm -r lanelet2/lanelet2_python
# rm -r lanelet2/lanelet2_examples
# cd /home/carma-streets/carma_lanelet2
# source /opt/ros/melodic/setup.bash
# apt-get install -y libeigen3-dev python-rospkg
# ROS_VERSION=1 LANELET2_EXTENSION_LOGGER_TYPE=1 catkin_make install
# cd /home/carma-streets/carma_lanelet2/install/
# ls -a
# echo "source /home/carma-streets/carma_lanelet2/install/setup.bash" >> "$INIT_ENV"
- name: Set up JDK 17
uses: actions/setup-java@v3 # The setup-java action provides the functionality for GitHub Actions runners for Downloading and setting up a requested version of Java
with:
java-version: 17
distribution: "temurin"
- name: Install Sonar
run: |
SONAR_DIR=/opt/sonarqube
mkdir $SONAR_DIR
curl -o $SONAR_DIR/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip
curl -o $SONAR_DIR/build-wrapper.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
curl -sL https://deb.nodesource.com/setup_16.x | bash -
apt-get install -y nodejs unzip
# Set the JAVA_HOME to a compatible version of Java, e.g., Java 17
export JAVA_HOME=$GITHUB_WORKSPACE/java-17
cd $SONAR_DIR
for ZIP in *.zip; do
unzip "$ZIP" -d .
rm "$ZIP"
done
mv $(ls $SONAR_DIR | grep "sonar-scanner-") $SONAR_DIR/sonar-scanner/
mv $(ls $SONAR_DIR | grep "build-wrapper-") $SONAR_DIR/build-wrapper/
echo $SONAR_DIR/sonar-scanner/bin >> $GITHUB_PATH
echo $SONAR_DIR/build-wrapper >> $GITHUB_PATH
env:
JAVA_HOME: $GITHUB_WORKSPACE/java-17
- name: Check Java Version
run: |
java -version
echo $JAVA_HOME
- name: Build
run: |
cd /home/carma-streets/
build-wrapper-linux-x86-64 --out-dir /home/carma-streets/bw-output ./build.sh
- name: Tests
run: |
cd /home/carma-streets/
ldconfig
./coverage.sh
- name: Archive test results
uses: actions/upload-artifact@v3
with:
name: Test Results
path: /home/carma-streets/test_results
- name: Run SonarScanner
uses: usdot-fhwa-stol/actions/sonar-scanner@main
with:
sonar-token: ${{ secrets.SONAR_TOKEN }}
working-dir: /home/carma-streets