Skip to content

Commit 70302a8

Browse files
Use working-directory instead of base paths arguments
1 parent 7e1707b commit 70302a8

2 files changed

Lines changed: 24 additions & 18 deletions

File tree

.github/workflows/reusable-debian-build.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,34 +94,37 @@ jobs:
9494
- name: Build upstream workspace (no test)
9595
if: ${{ inputs.upstream_workspace != '' }}
9696
shell: bash
97+
working-directory: ${{ env.upstream_ws }}
9798
run: |
9899
source /opt/ros2_ws/install/setup.bash
99-
colcon build --base-paths ${{ env.upstream_ws }}/src --build-base ${{ env.upstream_ws }}/build --install-base ${{ env.upstream_ws }}/install --log-base ${{ env.upstream_ws }}/log --packages-skip ${{ inputs.skip_packages }}
100+
colcon build --packages-skip ${{ inputs.skip_packages }}
100101
- name: Build target workspace
101102
shell: bash
103+
working-directory: ${{ env.target_ws }}
102104
run: |
103105
source /opt/ros2_ws/install/setup.bash
104106
if [[ -n "${{ inputs.upstream_workspace }}" ]]; then
105-
source ${{ env.upstream_ws }}/install/setup.bash
107+
source ${{ github.workspace }}/${{ env.upstream_ws }}/install/setup.bash
106108
fi
107-
TARGET_PACKAGES=$(colcon list --names-only --base-paths ${{ env.target_ws }}/src | tr '\n' ' ')
109+
TARGET_PACKAGES=$(colcon list --names-only | tr '\n' ' ')
108110
if [[ -z "$TARGET_PACKAGES" ]]; then
109111
echo "No packages found in target workspace at ${{ env.target_ws }}/src"
110112
exit 1
111113
fi
112-
colcon build --base-paths ${{ env.target_ws }}/src --build-base ${{ env.target_ws }}/build --install-base ${{ env.target_ws }}/install --log-base ${{ env.target_ws }}/log --packages-up-to $TARGET_PACKAGES --packages-skip ${{ inputs.skip_packages }} --cmake-args ${{ inputs.target_cmake_args }}
114+
colcon build --packages-up-to $TARGET_PACKAGES --packages-skip ${{ inputs.skip_packages }} --cmake-args ${{ inputs.target_cmake_args }}
113115
- name: Test target workspace
114116
shell: bash
117+
working-directory: ${{ env.target_ws }}
115118
run: |
116119
source /opt/ros2_ws/install/setup.bash
117120
if [[ -n "${{ inputs.upstream_workspace }}" ]]; then
118-
source ${{ env.upstream_ws }}/install/setup.bash
121+
source ${{ github.workspace }}/${{ env.upstream_ws }}/install/setup.bash
119122
fi
120-
source ${{ env.target_ws }}/install/setup.bash
121-
TARGET_PACKAGES=$(colcon list --names-only --base-paths ${{ env.target_ws }}/src | tr '\n' ' ')
123+
source install/setup.bash
124+
TARGET_PACKAGES=$(colcon list --names-only | tr '\n' ' ')
122125
if [[ -z "$TARGET_PACKAGES" ]]; then
123126
echo "No packages found in target workspace at ${{ env.target_ws }}/src"
124127
exit 1
125128
fi
126-
colcon test --base-paths ${{ env.target_ws }}/src --build-base ${{ env.target_ws }}/build --install-base ${{ env.target_ws }}/install --log-base ${{ env.target_ws }}/log --executor sequential --packages-select $TARGET_PACKAGES --packages-skip ${{ inputs.skip_packages }} ${{ inputs.skip_packages_test }}
127-
colcon test-result --verbose --test-result-base ${{ env.target_ws }}/build
129+
colcon test --executor sequential --packages-select $TARGET_PACKAGES --packages-skip ${{ inputs.skip_packages }} ${{ inputs.skip_packages_test }}
130+
colcon test-result --verbose

.github/workflows/reusable-rhel-binary-build.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,38 +97,41 @@ jobs:
9797
- name: Build upstream workspace (no test)
9898
if: ${{ inputs.upstream_workspace != '' }}
9999
shell: bash
100+
working-directory: ${{ env.upstream_ws }}
100101
run: |
101102
source /opt/ros/${{ inputs.ros_distro }}/setup.bash
102103
source /opt/ros2_ws/install/local_setup.bash
103-
colcon build --base-paths ${{ env.upstream_ws }}/src --build-base ${{ env.upstream_ws }}/build --install-base ${{ env.upstream_ws }}/install --log-base ${{ env.upstream_ws }}/log --packages-skip ${{ inputs.skip_packages }}
104+
colcon build --packages-skip ${{ inputs.skip_packages }}
104105
- name: Build target workspace
105106
shell: bash
107+
working-directory: ${{ env.target_ws }}
106108
# source also underlay workspace with generate_parameter_library on rhel9
107109
run: |
108110
source /opt/ros/${{ inputs.ros_distro }}/setup.bash
109111
source /opt/ros2_ws/install/local_setup.bash
110112
if [[ -n "${{ inputs.upstream_workspace }}" ]]; then
111-
source ${{ env.upstream_ws }}/install/setup.bash
113+
source ${{ github.workspace }}/${{ env.upstream_ws }}/install/setup.bash
112114
fi
113-
TARGET_PACKAGES=$(colcon list --names-only --base-paths ${{ env.target_ws }}/src | tr '\n' ' ')
115+
TARGET_PACKAGES=$(colcon list --names-only | tr '\n' ' ')
114116
if [[ -z "$TARGET_PACKAGES" ]]; then
115117
echo "No packages found in target workspace at ${{ env.target_ws }}/src"
116118
exit 1
117119
fi
118-
colcon build --base-paths ${{ env.target_ws }}/src --build-base ${{ env.target_ws }}/build --install-base ${{ env.target_ws }}/install --log-base ${{ env.target_ws }}/log --packages-up-to $TARGET_PACKAGES --packages-skip ${{ inputs.skip_packages }} --cmake-args ${{ inputs.target_cmake_args }}
120+
colcon build --packages-up-to $TARGET_PACKAGES --packages-skip ${{ inputs.skip_packages }} --cmake-args ${{ inputs.target_cmake_args }}
119121
- name: Test target workspace
120122
shell: bash
123+
working-directory: ${{ env.target_ws }}
121124
run: |
122125
source /opt/ros/${{ inputs.ros_distro }}/setup.bash
123126
source /opt/ros2_ws/install/local_setup.bash
124127
if [[ -n "${{ inputs.upstream_workspace }}" ]]; then
125-
source ${{ env.upstream_ws }}/install/setup.bash
128+
source ${{ github.workspace }}/${{ env.upstream_ws }}/install/setup.bash
126129
fi
127-
source ${{ env.target_ws }}/install/setup.bash
128-
TARGET_PACKAGES=$(colcon list --names-only --base-paths ${{ env.target_ws }}/src | tr '\n' ' ')
130+
source install/setup.bash
131+
TARGET_PACKAGES=$(colcon list --names-only | tr '\n' ' ')
129132
if [[ -z "$TARGET_PACKAGES" ]]; then
130133
echo "No packages found in target workspace at ${{ env.target_ws }}/src"
131134
exit 1
132135
fi
133-
colcon test --base-paths ${{ env.target_ws }}/src --build-base ${{ env.target_ws }}/build --install-base ${{ env.target_ws }}/install --log-base ${{ env.target_ws }}/log --executor sequential --packages-select $TARGET_PACKAGES --packages-skip ${{ inputs.skip_packages }} ${{ inputs.skip_packages_test }}
134-
colcon test-result --verbose --test-result-base ${{ env.target_ws }}/build
136+
colcon test --executor sequential --packages-select $TARGET_PACKAGES --packages-skip ${{ inputs.skip_packages }} ${{ inputs.skip_packages_test }}
137+
colcon test-result --verbose

0 commit comments

Comments
 (0)