Skip to content

Commit dafa9a6

Browse files
Try to use a bare ubuntu container
1 parent 2b93f05 commit dafa9a6

File tree

1 file changed

+56
-3
lines changed

1 file changed

+56
-3
lines changed

.github/workflows/reusable-build-coverage.yml

+56-3
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,70 @@ on:
77
required: true
88
type: string
99
os_name:
10-
description: 'On which OS to run the workflow, e.g. ubuntu-22.04'
10+
description: 'On which runner-OS to run the workflow, e.g. ubuntu-22.04'
1111
required: false
1212
default: 'ubuntu-latest'
1313
type: string
14+
container:
15+
description: '(optional) Docker container to run the job in, e.g. ubuntu:noble'
16+
required: false
17+
default: ''
18+
type: string
1419

1520
jobs:
1621
coverage:
1722
name: coverage build ${{ inputs.ros_distro }}
1823
runs-on: ${{ inputs.os_name }}
24+
container: ${{ inputs.container }}
1925
steps:
26+
- name: "Determine prerequisites"
27+
id: prereq
28+
run: |
29+
DEBIAN_FRONTEND=noninteractive apt update && apt upgrade -y
30+
apt install -y sudo apt-utils
31+
echo "need_node=$(command -v node >/dev/null 2>&1 && echo 0 || echo 1)" >> $GITHUB_OUTPUT
32+
echo "need_python=$(command -v python3 >/dev/null 2>&1 && echo 0 || echo 1)" >> $GITHUB_OUTPUT
33+
echo "need_rosdep=$(command -v rosdep >/dev/null 2>&1 && echo 0 || echo 1)" >> $GITHUB_OUTPUT
34+
echo "need_ros=$(if [ -d "/opt/ros/${{ inputs.ros_distro }}" ]; then echo 0; else echo 1; fi)" >> $GITHUB_OUTPUT
35+
36+
# needed for github actions, and only if a bare ubuntu image is used
37+
# Consider switching to https://github.com/actions/setup-node when it works
38+
# https://github.com/nektos/act/issues/973
39+
# - uses: actions/setup-node@v4
40+
# if: ${{ steps.prereq.outputs.need_node == '1' }}
41+
# with:
42+
# node-version: 16
43+
- name: Install node
44+
if: ${{ steps.prereq.outputs.need_node == '1' }}
45+
run: |
46+
apt install -y curl
47+
curl -sS https://webi.sh/node | sh
48+
echo ~/.local/opt/node/bin >> $GITHUB_PATH
49+
50+
# not working for noble yet
51+
# - uses: actions/setup-python@v5
52+
# with:
53+
# python-version: '3.11'
54+
# needed only if a bare ubuntu image is used
55+
- name: Install python
56+
if: ${{ steps.prereq.outputs.need_python == '1' }}
57+
run: |
58+
DEBIAN_FRONTEND=noninteractive apt install -y python3-pip
59+
60+
# why is this necessary for ros:rolling-ros-core-noble?
61+
# and why does this not work with setup-ros?
62+
- name: Install ros-dev-tools
63+
if: ${{ steps.prereq.outputs.need_rosdep == '1' }}
64+
run: |
65+
apt install -y ros-dev-tools \
66+
python3-colcon-common-extensions python3-colcon-mixin python3-colcon-coveragepy-result
67+
rosdep init
68+
69+
# needed only if a non-ros image is used
2070
- uses: ros-tooling/[email protected]
21-
# - name: Temporary fix for rolling by setting the ROSDISTRO_INDEX_URL
71+
if: ${{ steps.prereq.outputs.need_ros == '1' }}
72+
73+
# - name: Temporary fix for rolling@jammy by setting the ROSDISTRO_INDEX_URL
2274
# # see https://docs.ros.org/en/rolling/How-To-Guides/Using-Custom-Rosdistro.html
2375
# run: |
2476
# if [[ "${{ inputs.ros_distro }}" == "rolling" ]]; then
@@ -31,7 +83,8 @@ jobs:
3183
# echo "ROS_DISTRO: $ROS_DISTRO"
3284
# rosdep resolve test_msgs std_msgs || true
3385
# rosdep resolve test_msgs std_msgs --os=ubuntu:jammy --rosdistro=rolling
34-
# - uses: actions/checkout@v4
86+
87+
- uses: actions/checkout@v4
3588
- id: package_list_action
3689
uses: ros-controls/ros2_control_ci/.github/actions/set-package-list@master
3790
- uses: ros-tooling/[email protected]

0 commit comments

Comments
 (0)