Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Composite action and os_name #11

Merged
merged 9 commits into from
Feb 18, 2024
30 changes: 30 additions & 0 deletions .github/actions/set-package-list/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'Get package list'
# has to be run after ROS 2 setup, i.e., by ros-tooling/setup-ros
description: 'Get a list of packages in the given path'
inputs:
path:
description: 'Path to the repository after checkout'
required: true
outputs:
package_list:
description: "A white-space separated list of packages"
value: ${{ steps.colcon.outputs.package_list }}
repo_name:
description: "The name of the repo, last part of github.repository"
value: ${{ steps.split_repo.outputs.repo_name }}


runs:
using: 'composite'
steps:
- id: colcon
run: |
echo "package_list=$(colcon list --paths ${{ inputs.path }} --names-only | tr '\n' ' ') $(colcon list --paths ${{ inputs.path }}/* --names-only | tr '\n' ' ')" >> $GITHUB_OUTPUT
shell: bash
- id: split_repo
run: |
echo "repo_name=$(echo ${{ github.repository }} | cut -d '/' -f 2)" >> $GITHUB_OUTPUT
shell: bash
- run: |
echo "repo ${{ steps.split_repo.outputs.repo_name }} contains the packages: ${{ steps.colcon.outputs.package_list }}"
shell: bash
12 changes: 6 additions & 6 deletions .github/workflows/reusable-debian-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@ jobs:
if [[ -n "${{ inputs.upstream_workspace }}" ]]; then
vcs import src < ${{ env.path }}/${{ inputs.upstream_workspace }}
fi
- name: Get list of packages
# we need both paths, there is no wildcard/glob for packages defined in the root folder and subfolders at the same time
run: |
echo "package_list=$(colcon list --paths ${{ env.path }} --names-only | tr '\n' ' ') $(colcon list --paths ${{ env.path }}/* --names-only | tr '\n' ' ')" >> $GITHUB_ENV
- id: package_list_action
uses: ros-controls/ros2_control_ci/.github/actions/set-package-list@master
with:
path: ${{ env.path }}
- name: Build workspace
shell: bash
run: |
source /opt/ros2_ws/install/setup.bash
colcon build --packages-up-to ${{ env.package_list }} --packages-skip ${{ inputs.skip_packages }}
colcon build --packages-up-to ${{ steps.package_list_action.outputs.package_list }} --packages-skip ${{ inputs.skip_packages }}
- name: Test workspace
shell: bash
continue-on-error: true
run: |
source /opt/ros2_ws/install/setup.bash
colcon test --packages-select ${{ env.package_list }} --packages-skip ${{ inputs.skip_packages }} ${{ inputs.skip_packages_test }}
colcon test --packages-select ${{ steps.package_list_action.outputs.package_list }} --packages-skip ${{ inputs.skip_packages }} ${{ inputs.skip_packages_test }}
colcon test-result --verbose
12 changes: 6 additions & 6 deletions .github/workflows/reusable-rhel-binary-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ jobs:
fi
rosdep update
rosdep install -iyr --from-path src || true
- name: Get list of packages
# we need both paths, there is no wildcard/glob for packages defined in the root folder and subfolders at the same time
run: |
echo "package_list=$(colcon list --paths ${{ env.path }} --names-only | tr '\n' ' ') $(colcon list --paths ${{ env.path }}/* --names-only | tr '\n' ' ')" >> $GITHUB_ENV
- id: package_list_action
uses: ros-controls/ros2_control_ci/.github/actions/set-package-list@master
with:
path: ${{ env.path }}
- name: Build workspace
shell: bash
# source also underlay workspace with generate_parameter_library on rhel9
run: |
source /opt/ros/${{ inputs.ros_distro }}/setup.bash
source /opt/ros2_ws/install/local_setup.bash
colcon build --packages-up-to ${{ env.package_list }} --packages-skip ${{ inputs.skip_packages }}
colcon build --packages-up-to ${{ steps.package_list_action.outputs.package_list }} --packages-skip ${{ inputs.skip_packages }}
- name: Test workspace
shell: bash
continue-on-error: true
run: |
source /opt/ros/${{ inputs.ros_distro }}/setup.bash
source /opt/ros2_ws/install/local_setup.bash
colcon test --packages-select ${{ env.package_list }} --packages-skip ${{ inputs.skip_packages }} ${{ inputs.skip_packages_test }}
colcon test --packages-select ${{ steps.package_list_action.outputs.package_list }} --packages-skip ${{ inputs.skip_packages }} ${{ inputs.skip_packages_test }}
colcon test-result --verbose
25 changes: 14 additions & 11 deletions .github/workflows/reusable-ros-tooling-source-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ on:
default: 'master'
required: false
type: string
os_name:
description: 'On which OS to run the linter'
required: false
default: 'ubuntu-latest'
type: string

jobs:
reusable_ros_tooling_source_build:
name: ${{ inputs.ros_distro }} ubuntu-22.04
runs-on: ubuntu-22.04
name: ${{ inputs.ros_distro }} ${{ inputs.os_name }}
runs-on: ${{ inputs.os_name }}
env:
# this will be src/{repo-owner}/{repo-name}
path: src/${{ github.repository }}
Expand All @@ -36,22 +41,20 @@ jobs:
with:
ref: ${{ inputs.ref }}
path: ${{ env.path }}
- name: Get list of packages
# we need both paths, there is no wildcard/glob for packages defined in the root folder and subfolders at the same time
run: |
echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d '/' -f 2)" >> $GITHUB_ENV
echo "package_list=$(colcon list --paths ${{ env.path }} --names-only | tr '\n' ' ') $(colcon list --paths ${{ env.path }}/* --names-only | tr '\n' ' ')" >> $GITHUB_ENV
echo "repo ${{ env.REPO_NAME}} has packages: ${{ env.package_list }}"
- 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: ${{ env.package_list }}
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 }}/${{ env.REPO_NAME}}.${{ inputs.ros_distro }}.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-ubuntu-22.04-${{ inputs.ros_distro }}
name: colcon-logs-${{ inputs.os_name }}-${{ inputs.ros_distro }}
path: ros_ws/log