Skip to content

github actions improvements #10

github actions improvements

github actions improvements #10

Workflow file for this run

---
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:
- self-hosted
- internal-robotnik
- linux
- kubernetes
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
- name: run ROS workspace tests
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