-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add job to check samples for changes
- Loading branch information
Showing
1 changed file
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: Check samples | ||
|
||
# avoiding duplicate jobs on push with open pull_request: https://github.com/orgs/community/discussions/26940#discussioncomment-6656489 | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
|
||
check: | ||
if: (github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork) || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- package_name: ros2_cpp_pkg | ||
template: ros2_cpp_pkg | ||
is_component: false | ||
is_lifecycle: false | ||
has_launch_file: true | ||
has_params: true | ||
has_subscriber: true | ||
has_publisher: true | ||
has_service_server: false | ||
has_action_server: false | ||
has_timer: false | ||
- package_name: ros2_cpp_component_pkg | ||
template: ros2_cpp_pkg | ||
is_component: true | ||
is_lifecycle: false | ||
has_launch_file: true | ||
has_params: true | ||
has_subscriber: true | ||
has_publisher: true | ||
has_service_server: false | ||
has_action_server: false | ||
has_timer: false | ||
- package_name: ros2_cpp_lifecycle_pkg | ||
template: ros2_cpp_pkg | ||
is_component: false | ||
is_lifecycle: true | ||
has_launch_file: true | ||
has_params: true | ||
has_subscriber: true | ||
has_publisher: true | ||
has_service_server: false | ||
has_action_server: false | ||
has_timer: false | ||
- package_name: ros2_interfaces_pkg | ||
template: ros2_interfaces_pkg | ||
interface_types: Message,Service,Action | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
pip install "copier~=9.2.0" "jinja2-strcase~=0.0.2" | ||
- name: Generate packages | ||
run: | | ||
copier copy --trust --use-local-templates --defaults \ | ||
-d template=${{ matrix.template }} \ | ||
-d package_name=${{ matrix.package_name }} \ | ||
-d is_component=${{ matrix.is_component }} \ | ||
-d is_lifecycle=${{ matrix.is_lifecycle }} \ | ||
-d has_launch_file=${{ matrix.has_launch_file }} \ | ||
-d has_params=${{ matrix.has_params }} \ | ||
-d has_subscriber=${{ matrix.has_subscriber }} \ | ||
-d has_publisher=${{ matrix.has_publisher }} \ | ||
-d has_service_server=${{ matrix.has_service_server }} \ | ||
-d has_action_server=${{ matrix.has_action_server }} \ | ||
-d has_timer=${{ matrix.has_timer }} \ | ||
-d interface_types=${{ matrix.interface_types }} \ | ||
. packages | ||
- name: Check for repository changes | ||
run: | | ||
rm -rf samples | ||
mv packages samples | ||
if [[ ! -z "$(git status --porcelain)" ]]; then | ||
echo "Sample generation resulted in changes to the repository" | ||
git diff | ||
exit 1 | ||
fi |