diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 28bcfcb2..b90cd80f 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -32,7 +32,7 @@ jobs: AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS: 1 steps: - uses: actions/checkout@v1 - - uses: ros-tooling/setup-ros@master + - uses: ros-tooling/setup-ros@0.7.15 with: required-ros-distributions: ${{ matrix.distro }} - uses: ros-tooling/action-ros-lint@master diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d92ce5f4..8ef934b6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -9,8 +9,40 @@ on: - cron: "0 20 * * 0" jobs: + ros_distro_from_branch_name: + runs-on: ubuntu-latest + outputs: + distro: ${{ steps.set-distro.outputs.distro }} + steps: + - name: Set ROS distro from branch name + id: set-distro + run: | + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "This is a PR. Getting branch name from base ref." + branch_name="${{ github.event.pull_request.base.ref }}" + else + echo "This is a push. Getting branch name from head ref." + branch_name="${{ github.head_ref }}" + fi + echo "> Branch name is: ${branch_name}" + + if [[ "${branch_name}" == *"ros2"* ]]; then + distro="rolling" + elif [[ "${branch_name}" == *"ros2-humble"* ]]; then + distro="humble" + elif [[ "${branch_name}" == *"ros2-jazzy"* ]]; then + distro="jazzy" + elif [[ "${branch_name}" == *"ros2-kilted"* ]]; then + distro="kilted" + else + echo "! Unknown branch for determining ROS distro: ${GITHUB_REF##*/}" + exit 1 + fi + echo "> Determined ROS distro to be: ${distro}!" + echo "distro=$distro" >> $GITHUB_OUTPUT build_and_test: - name: ${{ matrix.package }} on ${{ matrix.distro }} + name: ${{ matrix.package }} under ${{ matrix.distro }} + needs: ros_distro_from_branch_name strategy: fail-fast: false matrix: @@ -22,17 +54,51 @@ jobs: self_test, ] include: - - distro: rolling + - distro: ${{ needs.ros_distro_from_branch_name.outputs.distro }} os: 24.04 runs-on: ubuntu-latest container: ubuntu:${{ matrix.os }} steps: - - uses: ros-tooling/setup-ros@master + - uses: ros-tooling/setup-ros@0.7.15 with: required-ros-distributions: ${{ matrix.distro }} - - uses: ros-tooling/action-ros-ci@master + - uses: ros-tooling/action-ros-ci@0.4.5 with: target-ros2-distro: ${{ matrix.distro }} package-name: ${{ matrix.package }} # vcs-repo-file-url: | # https://raw.githubusercontent.com/ros2/ros2/master/ros2.repos + build_and_test_win: + name: ${{ matrix.package }} under ${{ matrix.distro }} (windows) + needs: ros_distro_from_branch_name + strategy: + fail-fast: false + matrix: + package: [ + diagnostic_aggregator, + diagnostic_common_diagnostics, + diagnostic_remote_logging, + diagnostic_updater, + self_test, + ] + include: + - distro: ${{ needs.ros_distro_from_branch_name.outputs.distro }} + runs-on: windows-2022 + steps: + - uses: ros-tooling/setup-ros@0.7.15 + with: + required-ros-distributions: ${{ matrix.distro }} + - name: Upgrade colcon-meson + # Workaround for "Exception in package identification extension 'meson' in 'src\ohkszihoidm': __init__() missing 2 required positional arguments: 'subproject_dir' and 'env'" + run: python -m pip install -U colcon-meson==0.5.0 + - name: Install package dependencies + run: | + rosdep update + rosdep install ${{ matrix.package }} -r -y + - uses: ros-tooling/action-ros-ci@0.4.5 + with: + target-ros2-distro: ${{ matrix.distro }} + package-name: ${{ matrix.package }} + # vcs-repo-file-url: https://raw.githubusercontent.com/ros2/ros2/${{ matrix.distro }}/ros2.repos + # All of this is quite unstable, atm: + # continue-on-error: true \ No newline at end of file