diff --git a/.github/workflows/colcon_build.yaml b/.github/workflows/colcon_build.yaml new file mode 100644 index 00000000..6bb653db --- /dev/null +++ b/.github/workflows/colcon_build.yaml @@ -0,0 +1,11 @@ +name: ROS 2 Workspace Build +description: Build packages in a ROS 2 workspace +runs: + using: composite + steps: + - shell: bash + run: | + source install/setup.bash + colcon build --event-handlers console_cohesion+ --cmake-args + + diff --git a/.github/workflows/colcon_setup.yaml b/.github/workflows/colcon_setup.yaml new file mode 100644 index 00000000..df9d9ce1 --- /dev/null +++ b/.github/workflows/colcon_setup.yaml @@ -0,0 +1,31 @@ +name: ROS 2 Workspace Setup +description: Setup tools and dependencies for a ROS 2 workspace +inputs: + distro: + description: The ROS 2 distribution to be used + default: iron +runs: + using: composite + steps: + - shell: bash + run: | + sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list + + - shell: bash + run: | + sudo apt update + sudo apt install -y python3-colcon-common-extensions python3-rosdep + + - shell: bash + run: | + sudo rosdep init + rosdep update + rosdep install -y --rosdistro ${{ inputs.distro }} --from-paths . --ignore-src + + - shell: bash + run: | + source /opt/ros/${{ inputs.distro }}/setup.bash + colcon build --packages-skip-regex '.*' + + diff --git a/.github/workflows/colcon_test.yaml b/.github/workflows/colcon_test.yaml index 91cb81d8..093ccf4f 100644 --- a/.github/workflows/colcon_test.yaml +++ b/.github/workflows/colcon_test.yaml @@ -1,29 +1,9 @@ -name: ci -on: - push: - branches: - - master - - main -permissions: - contents: write -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Configure Git Credentials - run: | - git config user.name github-actions[bot] - git config user.email 41898282+github-actions[bot]@users.noreply.github.com - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - - uses: actions/cache@v4 - with: - key: mkdocs-material-${{ env.cache_id }} - path: .cache - restore-keys: | - mkdocs-material- - - run: pip install mkdocs-material - - run: mkdocs gh-deploy --force +name: ROS 2 Workspace Test +description: Test packages in a ROS 2 workspace +runs: + using: composite + steps: + - shell: bash + run: | + source install/setup.bash + colcon test --event-handlers console_cohesion+ --pytest-with-coverage --return-code-on-test-failure \ No newline at end of file diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml new file mode 100644 index 00000000..07bd9b3a --- /dev/null +++ b/.github/workflows/run_tests.yaml @@ -0,0 +1,28 @@ +# This YAML file is a GitHub Actions workflow configuration for running tests on a ROS 2 +name: ros2 colcon tests +on: + push: + branches: + - master + - main +permissions: + contents: write +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: ros-tooling/setup-ros@latest + with: + version: humble + - name: Colcon Test + run: | + source /opt/ros/humble/setup.bash + colcon test --event-handlers console_cohesion+ --result-base result + colcon test-result --verbose --result-base result + - name: Upload Test Results + uses: actions/upload-artifact@v3 + with: + name: test-results + path: result + +