CI fixes #45
Workflow file for this run
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
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@v4 | |
- uses: actions/setup-python@v5 | |
with: { python-version: "3.10" } | |
- uses: pre-commit/[email protected] | |
extract-image: | |
name: Get image version | |
runs-on: ubuntu-latest | |
outputs: | |
image-url: ${{ steps.extractor.outputs.image_url }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract image URL | |
id: extractor | |
run: | | |
IMAGE_URL=$(grep -o 'image:\s*[^ ]*' docker-compose.yaml | cut -d ' ' -f2) | |
echo "image_url=$IMAGE_URL" | tee -a $GITHUB_OUTPUT | |
build-and-check: | |
name: Build, test, lint | |
needs: extract-image | |
runs-on: self-hosted | |
container: | |
image: ${{ needs.extract-image.outputs.image-url }} | |
defaults: | |
run: { shell: bash } | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build ROS2 packages | |
run: | | |
make build CMAKE_TOOLS_ADDRESS_SANITIZER=ON | |
source install/setup.bash | |
- name: Test ROS2 packages | |
continue-on-error: true | |
# TODO: use make | |
run: | | |
cd $GITHUB_WORKSPACE/packages | |
colcon test --ctest-args tests --merge-install \ | |
--executor parallel --parallel-workers $(nproc) \ | |
--return-code-on-test-failure \ | |
--event-handlers console_cohesion+ | |
- name: Run Clang-Tidy | |
# TODO: use make | |
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 |