diff --git a/.github/actions/set-package-list/action.yml b/.github/actions/set-package-list/action.yml new file mode 100644 index 0000000..6f5f58b --- /dev/null +++ b/.github/actions/set-package-list/action.yml @@ -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 diff --git a/.github/workflows/reusable-debian-build.yml b/.github/workflows/reusable-debian-build.yml index fe6b7dd..bf69334 100644 --- a/.github/workflows/reusable-debian-build.yml +++ b/.github/workflows/reusable-debian-build.yml @@ -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 diff --git a/.github/workflows/reusable-rhel-binary-build.yml b/.github/workflows/reusable-rhel-binary-build.yml index c920bbc..3c73f62 100644 --- a/.github/workflows/reusable-rhel-binary-build.yml +++ b/.github/workflows/reusable-rhel-binary-build.yml @@ -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 diff --git a/.github/workflows/reusable-ros-tooling-source-build.yml b/.github/workflows/reusable-ros-tooling-source-build.yml index acdc764..86a2d2c 100644 --- a/.github/workflows/reusable-ros-tooling-source-build.yml +++ b/.github/workflows/reusable-ros-tooling-source-build.yml @@ -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 }} @@ -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/action-ros-ci@0.3.6 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/upload-artifact@v4.3.1 with: - name: colcon-logs-ubuntu-22.04-${{ inputs.ros_distro }} + name: colcon-logs-${{ inputs.os_name }}-${{ inputs.ros_distro }} path: ros_ws/log