From ddc63b179520d29de735484a1be3963b86975758 Mon Sep 17 00:00:00 2001 From: Christoph Froehlich Date: Fri, 9 Feb 2024 13:16:55 +0000 Subject: [PATCH] Use reusable wfs for debian and RHEL --- .github/workflows/humble-debian-build.yml | 39 +++------ .../workflows/humble-rhel-binary-build.yml | 43 +++------- .github/workflows/iron-debian-build.yml | 39 +++------ .github/workflows/iron-rhel-binary-build.yml | 44 +++------- .github/workflows/reusable-debian-build.yml | 75 +++++++++++++++++ .../workflows/reusable-rhel-binary-build.yml | 81 +++++++++++++++++++ .github/workflows/rolling-debian-build.yml | 38 +++------ .../workflows/rolling-rhel-binary-build.yml | 45 +++-------- 8 files changed, 224 insertions(+), 180 deletions(-) create mode 100644 .github/workflows/reusable-debian-build.yml create mode 100644 .github/workflows/reusable-rhel-binary-build.yml diff --git a/.github/workflows/humble-debian-build.yml b/.github/workflows/humble-debian-build.yml index 482504c59a9..461e3cfd765 100644 --- a/.github/workflows/humble-debian-build.yml +++ b/.github/workflows/humble-debian-build.yml @@ -1,4 +1,4 @@ -name: Debian Humble Build +name: Debian Humble Source Build on: workflow_dispatch: pull_request: @@ -10,29 +10,14 @@ on: jobs: - humble_debian: - name: Humble debian build - runs-on: ubuntu-latest - env: - ROS_DISTRO: humble - skip-packages-build: rqt_controller_manager - skip-packages-test: rqt_controller_manager controller_manager_msgs - container: ghcr.io/ros-controls/ros:humble-debian - steps: - - uses: actions/checkout@v4 - with: - path: src/ros2_control - ref: ${{ github.event_name == 'schedule' && 'humble' || '' }} - - name: Build workspace - shell: bash - run: | - source /opt/ros2_ws/install/setup.bash - vcs import src < src/ros2_control/ros2_control.${{ env.ROS_DISTRO }}.repos - colcon build --packages-up-to $(colcon list --paths src/ros2_control/* --names-only) --packages-skip ${{ env.skip-packages-build }} - - name: Test workspace - shell: bash - continue-on-error: true - run: | - source /opt/ros2_ws/install/setup.bash - colcon test --packages-select $(colcon list --paths src/ros2_control/* --names-only) --packages-skip ${{ env.skip-packages-test }} - colcon test-result --verbose + debian_source_build: + uses: ./.github/workflows/reusable-debian-build.yml + strategy: + matrix: + ROS_DISTRO: [humble] + with: + ros_distro: ${{ matrix.ROS_DISTRO }} + upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos + ref_for_scheduled_build: master + skip_packages: rqt_controller_manager + skip_packages_test: controller_manager_msgs diff --git a/.github/workflows/humble-rhel-binary-build.yml b/.github/workflows/humble-rhel-binary-build.yml index 9d3b095e39d..d1c08e78603 100644 --- a/.github/workflows/humble-rhel-binary-build.yml +++ b/.github/workflows/humble-rhel-binary-build.yml @@ -1,4 +1,4 @@ -name: RHEL Humble Binary Build +name: RHEL Humble Semi-Binary Build on: workflow_dispatch: pull_request: @@ -9,34 +9,13 @@ on: - cron: '03 1 * * *' jobs: - humble_rhel_binary: - name: Humble RHEL binary build - runs-on: ubuntu-latest - env: - ROS_DISTRO: humble - skip-packages: rqt_controller_manager - container: ghcr.io/ros-controls/ros:humble-rhel - steps: - - uses: actions/checkout@v4 - with: - path: src/ros2_control - ref: ${{ github.event_name == 'schedule' && 'humble' || '' }} - - name: Install dependencies - run: | - source /opt/ros/${{ env.ROS_DISTRO }}/setup.bash - source /opt/ros2_ws/install/local_setup.bash - rosdep update - rosdep install -iyr --from-path src/ros2_control || true - - name: Build workspace - run: | - source /opt/ros/${{ env.ROS_DISTRO }}/setup.bash - source /opt/ros2_ws/install/local_setup.bash - colcon build --packages-up-to $(colcon list --paths src/ros2_control/* --names-only) --packages-skip ${{ env.skip-packages }} - - name: Test workspace - shell: bash - continue-on-error: true - run: | - source /opt/ros/${{ env.ROS_DISTRO }}/setup.bash - source /opt/ros2_ws/install/local_setup.bash - colcon test --packages-select $(colcon list --paths src/ros2_control/* --names-only) --packages-skip ${{ env.skip-packages }} - colcon test-result --verbose + rhel_semi_binary_build: + uses: ./.github/workflows/reusable-rhel-binary-build.yml + strategy: + matrix: + ROS_DISTRO: [humble] + with: + ros_distro: ${{ matrix.ROS_DISTRO }} + upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos + ref_for_scheduled_build: humble + skip_packages: rqt_controller_manager diff --git a/.github/workflows/iron-debian-build.yml b/.github/workflows/iron-debian-build.yml index 35db1eb8d95..5934064de90 100644 --- a/.github/workflows/iron-debian-build.yml +++ b/.github/workflows/iron-debian-build.yml @@ -1,4 +1,4 @@ -name: Debian Iron Build +name: Debian Iron Source Build on: workflow_dispatch: pull_request: @@ -10,29 +10,14 @@ on: jobs: - iron_debian: - name: Iron debian build - runs-on: ubuntu-latest - env: - ROS_DISTRO: iron - skip-packages-build: rqt_controller_manager - skip-packages-test: rqt_controller_manager controller_manager_msgs - container: ghcr.io/ros-controls/ros:iron-debian - steps: - - uses: actions/checkout@v4 - with: - path: src/ros2_control - ref: ${{ github.event_name == 'schedule' && 'iron' || '' }} - - name: Build workspace - shell: bash - run: | - source /opt/ros2_ws/install/setup.bash - vcs import src < src/ros2_control/ros2_control.${{ env.ROS_DISTRO }}.repos - colcon build --packages-up-to $(colcon list --paths src/ros2_control/* --names-only) --packages-skip ${{ env.skip-packages-build }} - - name: Test workspace - shell: bash - continue-on-error: true - run: | - source /opt/ros2_ws/install/setup.bash - colcon test --packages-select $(colcon list --paths src/ros2_control/* --names-only) --packages-skip ${{ env.skip-packages-test }} - colcon test-result --verbose + debian_source_build: + uses: ./.github/workflows/reusable-debian-build.yml + strategy: + matrix: + ROS_DISTRO: [iron] + with: + ros_distro: ${{ matrix.ROS_DISTRO }} + upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos + ref_for_scheduled_build: master + skip_packages: rqt_controller_manager + skip_packages_test: controller_manager_msgs diff --git a/.github/workflows/iron-rhel-binary-build.yml b/.github/workflows/iron-rhel-binary-build.yml index 435c3e93160..8ac5bdd954c 100644 --- a/.github/workflows/iron-rhel-binary-build.yml +++ b/.github/workflows/iron-rhel-binary-build.yml @@ -1,4 +1,4 @@ -name: RHEL Iron Binary Build +name: RHEL Iron Semi-Binary Build on: workflow_dispatch: pull_request: @@ -9,35 +9,13 @@ on: - cron: '03 1 * * *' jobs: - iron_rhel_binary: - name: Iron RHEL binary build - runs-on: ubuntu-latest - env: - ROS_DISTRO: iron - skip-packages: rqt_controller_manager - container: ghcr.io/ros-controls/ros:iron-rhel - steps: - - uses: actions/checkout@v4 - with: - path: src/ros2_control - ref: ${{ github.event_name == 'schedule' && 'iron' || '' }} - - name: Install dependencies - run: | - source /opt/ros/${{ env.ROS_DISTRO }}/setup.bash - source /opt/ros2_ws/install/local_setup.bash - rosdep update - rosdep install -iyr --from-path src/ros2_control || true - - name: Build workspace - # source also underlay workspace with generate_parameter_library on rhel9 - run: | - source /opt/ros/${{ env.ROS_DISTRO }}/setup.bash - source /opt/ros2_ws/install/local_setup.bash - colcon build --packages-up-to $(colcon list --paths src/ros2_control/* --names-only) --packages-skip ${{ env.skip-packages }} - - name: Test workspace - shell: bash - continue-on-error: true - run: | - source /opt/ros/${{ env.ROS_DISTRO }}/setup.bash - source /opt/ros2_ws/install/local_setup.bash - colcon test --packages-select $(colcon list --paths src/ros2_control/* --names-only) --packages-skip ${{ env.skip-packages }} - colcon test-result --verbose + rhel_semi_binary_build: + uses: ./.github/workflows/reusable-rhel-binary-build.yml + strategy: + matrix: + ROS_DISTRO: [iron] + with: + ros_distro: ${{ matrix.ROS_DISTRO }} + upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos + ref_for_scheduled_build: iron + skip_packages: rqt_controller_manager diff --git a/.github/workflows/reusable-debian-build.yml b/.github/workflows/reusable-debian-build.yml new file mode 100644 index 00000000000..6fca63e7677 --- /dev/null +++ b/.github/workflows/reusable-debian-build.yml @@ -0,0 +1,75 @@ +name: Reusable Debian Source Build +# Reusable action to simplify dealing with debian source builds +# author: Christoph Froehlich + +on: + workflow_call: + inputs: + ros_distro: + description: 'ROS2 distribution name' + required: true + type: string + ref_for_scheduled_build: + description: 'Reference on which the repo should be checkout for scheduled build. Usually is this name of a branch or a tag.' + default: '' + required: false + type: string + upstream_workspace: + description: 'Path to local .repos file.' + default: '' + required: false + type: string + skip_packages: + description: 'Packages to skip from build and test' + default: '' + required: false + type: string + skip_packages_test: + description: 'Packages to skip from test additionally to skip_packages' + default: '' + required: false + type: string + + +jobs: + debian_source: + name: ${{ inputs.ros_distro }} debian build + runs-on: ubuntu-latest + env: + # this will be src/{repo-owner}/{repo-name} + path: src/${{ github.repository }} + container: ghcr.io/ros-controls/ros:${{ inputs.ros_distro }}-debian + steps: + - name: Checkout default ref when build is not scheduled + if: ${{ github.event_name != 'schedule' }} + uses: actions/checkout@v4 + with: + path: ${{ env.path }} + - name: Checkout ${{ inputs.ref_for_scheduled_build }} on scheduled build + if: ${{ github.event_name == 'schedule' }} + uses: actions/checkout@v4 + with: + ref: ${{ inputs.ref_for_scheduled_build }} + path: ${{ env.path }} + - name: Import upstream workspace + shell: bash + run: | + 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) $(colcon list --paths ${{ env.path }}/* --names-only)" >> $GITHUB_ENV + - 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 }} + - 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-result --verbose diff --git a/.github/workflows/reusable-rhel-binary-build.yml b/.github/workflows/reusable-rhel-binary-build.yml new file mode 100644 index 00000000000..d123fd933a4 --- /dev/null +++ b/.github/workflows/reusable-rhel-binary-build.yml @@ -0,0 +1,81 @@ +name: Reusable RHEL Binary Build +# Reusable action to simplify dealing with RHEL binary builds +# author: Christoph Froehlich + +on: + workflow_call: + inputs: + ros_distro: + description: 'ROS2 distribution name' + required: true + type: string + ref_for_scheduled_build: + description: 'Reference on which the repo should be checkout for scheduled build. Usually is this name of a branch or a tag.' + default: '' + required: false + type: string + upstream_workspace: + description: 'Path to local .repos file.' + default: '' + required: false + type: string + skip_packages: + description: 'Packages to skip from build and test' + default: '' + required: false + type: string + skip_packages_test: + description: 'Packages to skip from test additionally to skip_packages' + default: '' + required: false + type: string + +jobs: + rhel_binary: + name: ${{ inputs.ros_distro }} RHEL binary build + runs-on: ubuntu-latest + container: ghcr.io/ros-controls/ros:${{ inputs.ros_distro }}-rhel + env: + # this will be src/{repo-owner}/{repo-name} + path: src/${{ github.repository }} + steps: + - name: Checkout default ref when build is not scheduled + if: ${{ github.event_name != 'schedule' }} + uses: actions/checkout@v4 + with: + path: ${{ env.path }} + - name: Checkout ${{ inputs.ref_for_scheduled_build }} on scheduled build + if: ${{ github.event_name == 'schedule' }} + uses: actions/checkout@v4 + with: + ref: ${{ inputs.ref_for_scheduled_build }} + path: ${{ env.path }} + - name: Install dependencies + shell: bash + run: | + source /opt/ros/${{ inputs.ros_distro }}/setup.bash + source /opt/ros2_ws/install/local_setup.bash + if [[ -n "${{ inputs.upstream_workspace }}" ]]; then + vcs import src < ${{ env.path }}/${{ inputs.upstream_workspace }} + 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) $(colcon list --paths ${{ env.path }}/* --names-only)" >> $GITHUB_ENV + - 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 }} + - 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-result --verbose diff --git a/.github/workflows/rolling-debian-build.yml b/.github/workflows/rolling-debian-build.yml index efe1422404d..a6de78ff513 100644 --- a/.github/workflows/rolling-debian-build.yml +++ b/.github/workflows/rolling-debian-build.yml @@ -1,4 +1,4 @@ -name: Debian Rolling Build +name: Debian Rolling Source Build on: workflow_dispatch: pull_request: @@ -10,29 +10,13 @@ on: jobs: - rolling_debian: - name: Rolling debian build - runs-on: ubuntu-latest - env: - ROS_DISTRO: rolling - skip-packages: rqt_controller_manager - container: ghcr.io/ros-controls/ros:rolling-debian - steps: - - uses: actions/checkout@v4 - with: - path: src/ros2_control - # default behavior is correct on master branch - # ref: ${{ github.event_name == 'schedule' && 'master' || '' }} - - name: Build workspace - shell: bash - run: | - source /opt/ros2_ws/install/setup.bash - vcs import src < src/ros2_control/ros2_control.${{ env.ROS_DISTRO }}.repos - colcon build --packages-up-to $(colcon list --paths src/ros2_control/* --names-only) --packages-skip ${{ env.skip-packages }} - - name: Test workspace - shell: bash - continue-on-error: true - run: | - source /opt/ros2_ws/install/setup.bash - colcon test --packages-select $(colcon list --paths src/ros2_control/* --names-only) --packages-skip ${{ env.skip-packages }} - colcon test-result --verbose + debian_source_build: + uses: ./.github/workflows/reusable-debian-build.yml + strategy: + matrix: + ROS_DISTRO: [rolling] + with: + ros_distro: ${{ matrix.ROS_DISTRO }} + upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos + ref_for_scheduled_build: master + skip_packages: rqt_controller_manager diff --git a/.github/workflows/rolling-rhel-binary-build.yml b/.github/workflows/rolling-rhel-binary-build.yml index 8f2638405b1..b511883b77b 100644 --- a/.github/workflows/rolling-rhel-binary-build.yml +++ b/.github/workflows/rolling-rhel-binary-build.yml @@ -1,4 +1,4 @@ -name: RHEL Rolling Binary Build +name: RHEL Rolling Semi-Binary Build on: workflow_dispatch: pull_request: @@ -9,36 +9,13 @@ on: - cron: '03 1 * * *' jobs: - rolling_rhel_binary: - name: Rolling RHEL binary build - runs-on: ubuntu-latest - env: - ROS_DISTRO: rolling - skip-packages: rqt_controller_manager - container: ghcr.io/ros-controls/ros:rolling-rhel - steps: - - uses: actions/checkout@v4 - with: - path: src/ros2_control - # default behavior is correct on master branch - # ref: ${{ github.event_name == 'schedule' && 'master' || '' }} - - name: Install dependencies - run: | - source /opt/ros/${{ env.ROS_DISTRO }}/setup.bash - source /opt/ros2_ws/install/local_setup.bash - rosdep update - rosdep install -iyr --from-path src/ros2_control || true - - name: Build workspace - # source also underlay workspace with generate_parameter_library on rhel9 - run: | - source /opt/ros/${{ env.ROS_DISTRO }}/setup.bash - source /opt/ros2_ws/install/local_setup.bash - colcon build --packages-up-to $(colcon list --paths src/ros2_control/* --names-only) --packages-skip ${{ env.skip-packages }} - - name: Test workspace - shell: bash - continue-on-error: true - run: | - source /opt/ros/${{ env.ROS_DISTRO }}/setup.bash - source /opt/ros2_ws/install/local_setup.bash - colcon test --packages-select $(colcon list --paths src/ros2_control/* --names-only) --packages-skip ${{ env.skip-packages }} - colcon test-result --verbose + rhel_semi_binary_build: + uses: ./.github/workflows/reusable-rhel-binary-build.yml + strategy: + matrix: + ROS_DISTRO: [rolling] + with: + ros_distro: ${{ matrix.ROS_DISTRO }} + upstream_workspace: ros2_control.${{ matrix.ROS_DISTRO }}.repos + ref_for_scheduled_build: master + skip_packages: rqt_controller_manager