-
Notifications
You must be signed in to change notification settings - Fork 3
82 lines (78 loc) · 3.21 KB
/
reusable-ros-tooling-source-build.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
name: Reusable industrial_ci Workflow with Cache
# Reusable action to simplify dealing with ROS/ROS2 industrial_ci builds with cache
# author: Denis Štogl <[email protected]>
on:
workflow_call:
inputs:
ros_distro:
description: 'ROS2 distribution name'
required: true
type: string
ref:
description: 'Reference on which the repo should be checkout. Usually is this name of a branch or a tag.'
required: true
type: string
ros2_repo_branch:
description: 'Branch in the ros2/ros2 repository from which ".repos" should be used.'
default: 'master'
required: false
type: string
os_name:
description: 'On which OS to run the linter'
required: false
default: 'ubuntu-latest'
type: string
container:
description: '(optional) Docker container to run the job in, e.g. ubuntu:noble'
required: false
default: ''
type: string
jobs:
reusable_ros_tooling_source_build:
name: ${{ inputs.ros_distro }} ${{ inputs.os_name }}
runs-on: ${{ inputs.os_name }}
container: ${{ inputs.container }}
env:
# this will be src/{repo-owner}/{repo-name}
path: src/${{ github.repository }}
steps:
- name: "Determine prerequisites"
id: prereq
run: |
command -v sudo >/dev/null 2>&1 || (apt update && apt install -y sudo)
DEBIAN_FRONTEND=noninteractive sudo apt update && sudo apt upgrade -y
echo "need_node=$(command -v node >/dev/null 2>&1 && echo 0 || echo 1)" >> $GITHUB_OUTPUT
# needed for github actions, and only if a bare ubuntu image is used
- uses: actions/setup-node@v4
if: ${{ steps.prereq.outputs.need_node == '1' && !env.ACT }}
- name: Install node
# Consider switching to https://github.com/actions/setup-node when it works
# https://github.com/nektos/act/issues/973
if: ${{ steps.prereq.outputs.need_node == '1' && env.ACT }}
run: |
sudo apt install -y curl
curl -sS https://webi.sh/node | sh
echo ~/.local/opt/node/bin >> $GITHUB_PATH
# needed only if a non-ros image is used
- uses: ros-tooling/[email protected]
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
path: ${{ env.path }}
- id: package_list_action
uses: ros-controls/ros2_control_ci/.github/actions/set-package-list@master
with:
path: ${{ env.path }}
- uses: ros-tooling/[email protected]
with:
target-ros2-distro: ${{ inputs.ros_distro }}
ref: ${{ inputs.ref }}
package-name: ${{ steps.package_list_action.outputs.package_list }}
vcs-repo-file-url: |
https://raw.githubusercontent.com/ros2/ros2/${{ inputs.ros2_repo_branch }}/ros2.repos
${{ env.path }}/${{ steps.package_list_action.outputs.repo_name }}.${{ inputs.ros_distro }}.repos
colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
- uses: actions/[email protected]
with:
name: colcon-logs-${{ inputs.os_name }}-${{ inputs.ros_distro }}
path: ros_ws/log