CI pipeline #11
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: ROS2 CI | |
on: | |
pull_request: | |
branches: [ "master" ] | |
types: [ opened, reopened, ready_for_review, synchronize ] | |
jobs: | |
extract-image: | |
runs-on: ubuntu-latest | |
outputs: | |
image-url: ${{ steps.extractor.outputs.image_url }} | |
steps: | |
- name: Checkout code | |
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 | |
- name: Print Image URL | |
run: echo $IMAGE_URL | |
build-and-check: | |
needs: extract-image | |
env: | |
check_changed_only: true | |
runs-on: ubuntu-20.04 | |
container: | |
image: ${{ needs.extract-image.outputs.image-url}} | |
# options: -w /handy | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Build ROS2 packages | |
shell: bash | |
run: | | |
echo "${{ needs.extract-image.outputs.image-url}}" | |
echo $ROS_ROOT/setup.bash; | |
echo "===" | |
ls / | |
echo "===" | |
ls $ROS_ROOT | |
echo "===" | |
. $ROS_ROOT/setup.bash | |
cd packages; | |
mkdir -p camera/params; | |
colcon build --merge-install --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_TOOLS_ADDRESS_SANITIZER=1; | |
. install/setup.bash | |
- name: Test ROS2 packages | |
shell: bash | |
run: | | |
pwd | |
ls | |
colcon test --ctest-args tests --merge-install --executor parallel --parallel-workers 8 --return-code-on-test-failure | |
- name: Fetch base branch | |
shell: bash | |
run: | | |
git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }}; | |
cd ..; | |
pwd; | |
ls; | |
- name: Launching pre-commit | |
uses: pre-commit/[email protected] | |
with: | |
#extra_args: --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.sha }} clang-tidy | |
extra_args: clang-tidy |