diff --git a/.github/workflows/reusable-debian-build.yml b/.github/workflows/reusable-debian-build.yml index 6eb341a9..708fb08d 100644 --- a/.github/workflows/reusable-debian-build.yml +++ b/.github/workflows/reusable-debian-build.yml @@ -32,9 +32,12 @@ jobs: runs-on: ubuntu-latest env: ROS_DISTRO: ${{ inputs.ros_distro }} - path: src/control_toolbox container: ghcr.io/ros-controls/ros:${{ inputs.ros_distro }}-debian steps: + - name: Get repository name + # Extract the repository name from the GITHUB_REPOSITORY environment variable + # ${{ github.event.repository.name }} seems to be not working with act + run: echo "path=src/${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV - name: Checkout default ref when build is not scheduled if: ${{ github.event_name != 'schedule' }} uses: actions/checkout@v4 @@ -46,20 +49,25 @@ jobs: with: ref: ${{ inputs.ref_for_scheduled_build }} path: ${{ env.path }} - - name: Build workspace + - name: Import upstream workspace shell: bash run: | - source /opt/ros2_ws/install/setup.bash if [[ -n "${{ inputs.upstream_workspace }}" ]]; then vcs import src < ${{ env.path }}/${{ inputs.upstream_workspace }} fi - # we need both paths, there is no wildcard/glob for packages defined in the root folder and subfolders at the same time - colcon build --packages-up-to $(colcon list --paths ${{ env.path }} --names-only) $(colcon list --paths ${{ env.path }}/* --names-only) --packages-skip ${{ inputs.skip_packages }} + - 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 - # we need both paths, there is no wildcard/glob for packages defined in the root folder and subfolders at the same time - colcon test --packages-select $(colcon list --paths ${{ env.path }} --names-only) $(colcon list --paths ${{ env.path }}/* --names-only) --packages-skip ${{ inputs.skip_packages }} + colcon test --packages-select ${{ env.package_list }} --packages-skip ${{ inputs.skip_packages }} colcon test-result --verbose diff --git a/.github/workflows/reusable-rhel-binary-build.yml b/.github/workflows/reusable-rhel-binary-build.yml index 5786042e..1d19d870 100644 --- a/.github/workflows/reusable-rhel-binary-build.yml +++ b/.github/workflows/reusable-rhel-binary-build.yml @@ -29,10 +29,12 @@ jobs: rhel_binary: name: ${{ inputs.ros_distro }} RHEL binary build runs-on: ubuntu-latest - env: - path: src/control_toolbox container: ghcr.io/ros-controls/ros:${{ inputs.ros_distro }}-rhel steps: + - name: Get repository name + # Extract the repository name from the GITHUB_REPOSITORY environment variable + # ${{ github.event.repository.name }} seems to be not working with act + run: echo "path=src/${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV - name: Checkout default ref when build is not scheduled if: ${{ github.event_name != 'schedule' }} uses: actions/checkout@v4 @@ -45,6 +47,7 @@ jobs: 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 @@ -53,19 +56,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) $(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 - # we need both paths, there is no wildcard/glob for packages defined in the root folder and subfolders at the same time - colcon build --packages-up-to $(colcon list --paths ${{ env.path }} --names-only) $(colcon list --paths ${{ env.path }}/* --names-only) --packages-skip ${{ inputs.skip_packages }} + 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 - # we need both paths, there is no wildcard/glob for packages defined in the root folder and subfolders at the same time - colcon test --packages-select $(colcon list --paths ${{ env.path }} --names-only) $(colcon list --paths ${{ env.path }}/* --names-only) --packages-skip ${{ inputs.skip_packages }} + colcon test --packages-select ${{ env.package_list }} --packages-skip ${{ inputs.skip_packages }} colcon test-result --verbose