Skip to content

Commit

Permalink
Add reusable workflow for rosdoc2 (#48)
Browse files Browse the repository at this point in the history
* Add reusable wf for rosdoc2 check
* Use package_path_list
* Add for loop if there are more packages
* Use venv
  • Loading branch information
christophfroehlich authored Apr 17, 2024
1 parent 8cb6085 commit a0cd435
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/actions/set-package-list/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ outputs:
package_list:
description: "A white-space separated list of packages"
value: ${{ steps.colcon.outputs.package_list }}
package_path_list:
description: "A white-space separated list of package paths"
value: ${{ steps.colcon.outputs.package_path_list }}
repo_name:
description: "The name of the repo, last part of github.repository"
value: ${{ steps.split_repo.outputs.repo_name }}
Expand All @@ -22,8 +25,10 @@ runs:
run: |
if [[ -n "${{ inputs.path }}" ]]; then
echo "package_list=$(colcon list --paths ${{ inputs.path }} --names-only | tr '\n' ' ') $(colcon list --paths ${{ inputs.path }}/* --names-only | tr '\n' ' ')" >> $GITHUB_OUTPUT
echo "package_path_list=$(colcon list --paths ${{ inputs.path }} --paths-only | tr '\n' ' ') $(colcon list --paths ${{ inputs.path }}/* --paths-only | tr '\n' ' ')" >> $GITHUB_OUTPUT
else
echo "package_list=$(colcon list --names-only | tr '\n' ' ')" >> $GITHUB_OUTPUT
echo "package_path_list=$(colcon list --paths-only | tr '\n' ' ')" >> $GITHUB_OUTPUT
fi
shell: bash
- id: split_repo
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/reusable-rosdoc2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: rosdoc2
# author: Christoph Froehlich <[email protected]>

on:
workflow_call:

jobs:
check:
runs-on: ubuntu-latest
env:
# this will be src/{repo-owner}/{repo-name}
path: src/${{ github.repository }}
steps:
- uses: ros-tooling/[email protected]
- name: Install rosdoc2 and deps
run: |
sudo apt-get update
sudo apt install -y python3-pip git doxygen graphviz
python3 -m venv .venv
source .venv/bin/activate
git clone https://github.com/ros-infrastructure/rosdoc2.git
pip install --upgrade rosdoc2/
- uses: actions/checkout@v4
with:
fetch-depth: 0
path: ${{ env.path }}
- id: package_list_action
uses: ros-controls/ros2_control_ci/.github/actions/set-package-list@master
with:
path: ${{ env.path }}
- name: run rosdoc2
run: |
source .venv/bin/activate
for path in ${{ steps.package_list_action.outputs.package_path_list }}
do
rosdoc2 build --package-path $path
done

0 comments on commit a0cd435

Please sign in to comment.