Skip to content

CI fixes

CI fixes #33

Workflow file for this run

name: Test
on:
pull_request:
branches: [master]
push:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pre-commit:
name: Run pre-commit hooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.1
extract-image:
name: Get image version
runs-on: ubuntu-latest
outputs:
image-url: ${{ steps.extractor.outputs.image_url }}
steps:
- uses: actions/checkout@v3
- name: Extract image URL
id: extractor
run: |
IMAGE_URL=$(grep -o 'image:\s*[^ ]*' docker-compose.yaml | cut -d ' ' -f2)
echo "image_url=$IMAGE_URL" >> $GITHUB_OUTPUT
echo $IMAGE_URL
build-and-check:
name: Build, test, lint
needs: extract-image
runs-on: self-hosted
container:
image: ${{ needs.extract-image.outputs.image-url}}
# TODO: Fix in dockerfile
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Build ROS2 packages
run: |
source $ROS_ROOT/setup.bash
cd $GITHUB_WORKSPACE/packages
colcon build --merge-install --cmake-args \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_TOOLS_ADDRESS_SANITIZER=ON
source install/setup.bash
- name: Test ROS2 packages
continue-on-error: true
run: |
cd $GITHUB_WORKSPACE/packages
colcon test --ctest-args tests --merge-install \
--executor parallel --parallel-workers $(nproc) \
--return-code-on-test-failure
- name: Run Clang-Tidy
run: |
FILES=$(find . \( -name '*.h' -or -name '*.cpp' -or -name '*.cc' \) \
-not -path '*/build/*' -not -path '*/install/*' -not -path '*/log/*')
echo "Files to be linted:"
echo "$FILES"
clang-tidy --fix -p=packages/build $FILES
git diff
- name: Check previous steps
if: ${{ failure() }}
run: exit 1