Skip to content

Commit 7ad4c16

Browse files
authored
Merge pull request #9 from Futu-reADS/FDV-548
[FDV-548] Create a CI workflow with Autoware Foundation's actions
2 parents fb92c58 + 4bdf8ee commit 7ad4c16

File tree

1 file changed

+167
-0
lines changed

1 file changed

+167
-0
lines changed
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# It directly uses autowarefoundation/autoware-github-actions for now
2+
# but may change using Futu-reADS/autoware-github-actions
3+
# that will be forked or mirrored from the original
4+
5+
name: build-and-test
6+
7+
on:
8+
push:
9+
### - branches: [ "main" ]
10+
### schedule:
11+
### - cron: 0 0 * * *
12+
workflow_dispatch:
13+
14+
jobs:
15+
build-and-test:
16+
if: (github.event_name == 'push' && github.event.before != '0000000000000000000000000000000000000000') ||
17+
(github.event_name == 'workflow_dispatch')
18+
runs-on: ubuntu-22.04
19+
container: ${{ matrix.container }}
20+
strategy:
21+
fail-fast: false
22+
# Currently, only for ROS 2 Humble
23+
matrix:
24+
rosdistro:
25+
- humble
26+
include:
27+
- rosdistro: humble
28+
container: ros:humble
29+
build-depends-repos: build_depends.repos
30+
steps:
31+
- name: Check out repository
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 1
35+
36+
- name: Show disk space before the tasks
37+
run: df -h
38+
39+
- name: Remove exec_depend
40+
uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1
41+
42+
- name: Get self packages
43+
id: get-self-packages
44+
uses: autowarefoundation/autoware-github-actions/get-self-packages@v1
45+
46+
# Added for FUTU-RE
47+
- name: Check build_depends.repos
48+
id: check-file
49+
run: |
50+
if [ -f build_depends.repos ]; then
51+
echo "build_depends_repos=true" >> $GITHUB_OUTPUT
52+
else
53+
echo "build_depends_repos=false" >> $GITHUB_OUTPUT
54+
fi
55+
56+
# Added for FUTU-RE
57+
- name: Copy our latest autoware.repos
58+
if: ${{ steps.check-file.outputs.build_depends_repos != 'true' }}
59+
uses: actions/checkout@v4
60+
with:
61+
repository: Futu-reADS/autoware.FTD
62+
sparse-checkout: |
63+
autoware.repos
64+
sparse-checkout-cone-mode: false
65+
path: autoware.FTD
66+
- run: |
67+
cd autoware.FTD
68+
cp autoware.repos ../build_depends.repos
69+
# Do not process here afterwards
70+
touch AMENT_IGNORE COLCON_IGNORE
71+
72+
# Added for FUTU-RE
73+
- name: Install additional packages
74+
run: |
75+
# Install dependent packages
76+
sudo apt-get update -qy
77+
sudo apt-get install -y \
78+
ros-humble-autoware-common-msgs \
79+
libunwind-dev \
80+
apt-utils
81+
82+
# Added for FUTU-RE
83+
- name: Pass ROS environment variables to the subsequent steps
84+
run: |
85+
# It runs on sh but not bash
86+
. /opt/ros/${{ matrix.rosdistro }}/setup.sh
87+
env | grep -E -e '^ROS_' -e '/ros/' >> "$GITHUB_ENV"
88+
89+
# Added for FUTU-RE
90+
- name: Set Git credential for private repos
91+
run: |
92+
git config --global credential.helper store
93+
echo "url=${{ github.server_url }}" > ~/url-username-password.txt
94+
echo "username=oku-s" >> ~/url-username-password.txt
95+
echo "password=${{ secrets.UNITTEST_WORKFLOW_TOKEN }}" >> ~/url-username-password.txt
96+
git credential approve < ~/url-username-password.txt
97+
98+
# Added for FUTU-RE
99+
# NOTE:
100+
# This step might be able to be removed
101+
# by tuning package.xml and/or autoware.repos appropriately
102+
# so that colcon can find the following modules
103+
- name: Build and install dependent modules
104+
run: |
105+
mkdir -p src_tmp
106+
cat build_depends.repos \
107+
| sed 's/[email protected]:/https:\/\/github.com\//' \
108+
| vcs import --shallow --recursive src_tmp
109+
sudo rosdep init || true
110+
rosdep update
111+
rosdep install --from-paths src_tmp --ignore-src -r -y -t build
112+
for PKG in \
113+
autoware_auto_msgs \
114+
autoware_auto_system_msgs \
115+
autoware_adapi_v1_msgs \
116+
tier4_control_msgs \
117+
tier4_system_msgs \
118+
autoware_bridge_msgs \
119+
ftd_master_msgs \
120+
; do
121+
find src_tmp \
122+
-type f \
123+
-path "*/$PKG/CMakeLists.txt" \
124+
-execdir pwd \; \
125+
| {
126+
read -r WORKDIR &&
127+
cd "$WORKDIR" &&
128+
cmake . &&
129+
make &&
130+
sudo make install
131+
}
132+
done
133+
sudo ldconfig
134+
sudo rm -rf src_tmp
135+
136+
- name: Build
137+
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
138+
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
139+
with:
140+
rosdistro: ${{ matrix.rosdistro }}
141+
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
142+
build-depends-repos: ${{ matrix.build-depends-repos }}
143+
token: ${{ secrets.UNITTEST_WORKFLOW_TOKEN }}
144+
145+
- name: Test
146+
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
147+
id: test
148+
uses: autowarefoundation/autoware-github-actions/colcon-test@v1
149+
with:
150+
rosdistro: ${{ matrix.rosdistro }}
151+
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
152+
build-depends-repos: ${{ matrix.build-depends-repos }}
153+
token: ${{ secrets.UNITTEST_WORKFLOW_TOKEN }}
154+
155+
### # Uncomment here, to use CodeCov
156+
### - name: Upload coverage to CodeCov
157+
### if: ${{ steps.test.outputs.coverage-report-files != '' }}
158+
### uses: codecov/codecov-action@v5
159+
### with:
160+
### files: ${{ steps.test.outputs.coverage-report-files }}
161+
### token: ${{ secrets.CODECOV_TOKEN }}
162+
### fail_ci_if_error: false
163+
### verbose: true
164+
### flags: total
165+
166+
- name: Show disk space after the tasks
167+
run: df -h

0 commit comments

Comments
 (0)