forked from ubi-agni/ros-builder-action
-
Notifications
You must be signed in to change notification settings - Fork 0
175 lines (158 loc) · 6.43 KB
/
build.yaml
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
name: reusable build workflow
on:
# make this workflow reusable (and only so)
workflow_call:
inputs:
# target names
ROS_DISTRO:
type: string
description: ROS distribution codename to compile for
required: false # defaults to 'one'
DEB_DISTRO:
type: string
description: The Debian/Ubuntu distribution codename to compile for
required: false # defaults to 'lsb_release -cs'
ARCH:
type: string
required: false
description: CPU architecture
default: x64
ROS_SOURCES:
type: string
description: ROS sources to compile. See README.md for details.
required: false
COLCON_PKG_SELECTION:
type: string
description: colcon package selection arguments
required: false
# workflow control
SKIP_EXISTING:
type: boolean
description: Skip building packages already existing in the repository
required: false
DOWNLOAD_DEBS:
type: boolean
description: Continue building from previous debs artifact?
required: true
default: false
CONTINUE_FROM_PKG:
type: string
description: package to continue building from
required: false
INSTALL_TO_CHROOT:
type: boolean
description: Incrementally install built packages within the chroot?
required: false
BUILD_TIMEOUT:
type: number
description: Cancel build after this time, before github will do (minutes)
required: false
VERBOSE:
type: string
description: "Steps to run verbosely: sbuild ccache bloom"
required: false
# debian package repository options
EXTRA_DEB_SOURCES:
type: string
description: Extra debian sources to add to sources.list
required: false
INSTALL_GPG_KEYS:
type: string
description: Code to run for installing GPG keys (for use with EXTRA_DEB_SOURCES)
required: false
EXTRA_ROSDEP_SOURCES:
type: string
description: Path to a rosdep-compatible yaml file specifying custom dependency mappings
required: false
# build options
EXTRA_SBUILD_CONFIG:
type: string
description: Lines to add to ~/.sbuildrc
required: false
EXTRA_SBUILD_OPTS:
type: string
description: Options to pass to sbuild on commandline
required: false
DEB_BUILD_OPTIONS:
type: string
description: Options used debian/rules
required: false
CONTINUE_ON_ERROR:
type: boolean
description: Continue building even if some packages already failed
required: false
DEBS_PATH:
type: string
description: Path to store generated .debs in
required: false
DEBS_ARTIFACT_NAME:
type: string
description: |
Name of the debs artifact
defaults to 'debs'. Use 'skip' to skip uploading.
required: false
# only used for CI
EXPECT_EXIT_CODE:
type: number
description: Expected exit code of build step
required: false
outputs:
LATEST_PACKAGE:
description: Name of the latest package built
value: ${{ jobs.debs.outputs.LATEST_PACKAGE }}
# Define environment variables from input, from configuration variables, or defaults - in this order!
# All inputs (declared above) are deliberately optional and don't provide an explicit default.
# Thus, if an input is not explicitly provided, we can fall back to the configuration variable here (var.* context).
# This variable context originates from the _calling_ workflow. Finally, a hard-coded default is given.
# https://docs.github.com/en/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows
env:
DEB_DISTRO: ${{ inputs.DEB_DISTRO || vars.DEB_DISTRO || 'jammy' }}
ROS_DISTRO: ${{ inputs.ROS_DISTRO || vars.ROS_DISTRO || 'one' }}
ROS_SOURCES: ${{ inputs.ROS_SOURCES || vars.ROS_SOURCES || '*.repos' }}
EXTRA_DEB_SOURCES: ${{ inputs.EXTRA_DEB_SOURCES || vars.EXTRA_DEB_SOURCES }}
INSTALL_GPG_KEYS: ${{ inputs.INSTALL_GPG_KEYS || vars.INSTALL_GPG_KEYS }}
EXTRA_ROSDEP_SOURCES: ${{ inputs.EXTRA_ROSDEP_SOURCES || vars.EXTRA_ROSDEP_SOURCES }}
DEBS_PATH: ${{ inputs.DEBS_PATH || vars.DEBS_PATH || '~/debs' }}
jobs:
debs:
timeout-minutes: 10080
runs-on: self-hosted
# runs-on: ${{ inputs.ARCH == 'x64' && 'ubuntu-22.04' || inputs.ARCH }}
name: build debs
continue-on-error: true
outputs:
LATEST_PACKAGE: ${{ steps.build.outputs.LATEST_PACKAGE }}
env: # define common environment variables
CCACHE_DIR: /home/runner/ccache
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 10
DEBUG_BASH: ${{ secrets.ACTIONS_STEP_DEBUG && 'true' || 'false' }}
steps:
- uses: actions/checkout@v4
- name: Build .deb packages
uses: larics/ros-builder-action@main
id: build
with:
EXPECT_EXIT_CODE: ${{ inputs.EXPECT_EXIT_CODE }}
BUILD_TIMEOUT: ${{ inputs.BUILD_TIMEOUT || vars.BUILD_TIMEOUT }}
env:
COLCON_PKG_SELECTION: ${{ inputs.COLCON_PKG_SELECTION || vars.COLCON_PKG_SELECTION || '' }}
CONTINUE_FROM_PKG: ${{ inputs.CONTINUE_FROM_PKG }}
EXTRA_SBUILD_CONFIG: ${{ inputs.EXTRA_SBUILD_CONFIG || vars.EXTRA_SBUILD_CONFIG }}
EXTRA_SBUILD_OPTS: ${{ inputs.EXTRA_SBUILD_OPTS || vars.EXTRA_SBUILD_OPTS }}
DEB_BUILD_OPTIONS: ${{ inputs.DEB_BUILD_OPTIONS || vars.DEB_BUILD_OPTIONS || 'nocheck' }}
CONTINUE_ON_ERROR: ${{ inputs.CONTINUE_ON_ERROR || vars.CONTINUE_ON_ERROR || false }}
SKIP_EXISTING: ${{ inputs.SKIP_EXISTING || vars.SKIP_EXISTING || false }}
INSTALL_TO_CHROOT: ${{ inputs.INSTALL_TO_CHROOT || vars.INSTALL_TO_CHROOT || false }}
VERBOSE: ${{ inputs.VERBOSE || vars.VERBOSE || '' }}
- name: Remove files comprising invalid chars # they would break artifact upload
if: always() # always prepare files for upload
run: find ${{ env.DEBS_PATH }} -name '*[<>:"\\|?*]*' -print -delete
- name: Upload debs
uses: actions/upload-artifact@v4
# always upload except if name is skip (i.e. also on timeout or cancel)
if: always() && (inputs.DEBS_ARTIFACT_NAME != 'skip')
with:
name: ${{ inputs.DEBS_ARTIFACT_NAME || 'debs' }}
path: ${{ env.DEBS_PATH }}
overwrite: true
if-no-files-found: error