-
Notifications
You must be signed in to change notification settings - Fork 9
69 lines (65 loc) · 2.27 KB
/
test.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
---
name: Test ROS workspace
# author: "Guillem Gari <[email protected]>"
# description: |
# This workflow tests a ROS (Robot Operating System) workspace. It runs
# on pushes and PRs to ros2*, humble*, and jazzy* branches, and can be
# manually triggered. It checks for changes in monitored paths, logs
# into a private Docker registry, configures Docker files, builds a
# container image, and runs ROS tests using Docker Compose.
# Key features:
# - Runs on self-hosted Kubernetes runners
# - Monitors specific paths for changes
# - Uses private Docker registry
# - Sets version dynamically based on branch name
# - Configures Docker files and runs setup scripts
# - Builds container image and runs ROS workspace tests
on:
push:
branches:
- ros2*
pull_request:
types: [opened, reopened, synchronize]
branches:
- ros2*
workflow_dispatch:
env:
MONITORED_PATHS: >-
daly_bms
jobs:
test-workspace:
name: Test ROS workspace
runs-on: ${{ vars.RUNNERS_TAGS }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/check-changes
id: check_changes
with:
monitored_paths: ${{ env.MONITORED_PATHS }}
- name: Login to Robotnik Registry
if: steps.check_changes.outputs.has_changes == 'true'
uses: docker/login-action@v3
with:
registry: registry.robotnik.ws
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Transform GITHUB_REF_NAME to VERSION
if: steps.check_changes.outputs.has_changes == 'true'
run: echo "VERSION=${GITHUB_REF_NAME//\//-}" >> $GITHUB_ENV
- name: Configure docker files
if: steps.check_changes.outputs.has_changes == 'true'
run: |
yq e '.images.version = env(VERSION)' -i setup-container.yaml
setup-container/scripts/setup.sh
- name: Build container image
if: steps.check_changes.outputs.has_changes == 'true'
run: |
cd container/test
docker compose build
- name: Run ROS workspace tests
if: steps.check_changes.outputs.has_changes == 'true'
run: |
cd container/test
docker compose up --exit-code-from container