-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (78 loc) · 2.52 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Test
on:
pull_request:
branches: [ "master" ]
types: [ opened, reopened, ready_for_review, synchronize ]
push:
branches: [ "master" ]
workflow_dispatch:
jobs:
extract-image:
name: Extraction of configs
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
echo $IMAGE_URL
build-and-check:
name: Building, testing, linting
needs: extract-image
runs-on: self-hosted
concurrency:
group: build-and-check-${{ github.ref }}
cancel-in-progress: true
env:
CMAKE_ARGS: "-DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_TOOLS_ADDRESS_SANITIZER=1"
container:
image: ${{ needs.extract-image.outputs.image-url}}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Build ROS2 packages
shell: bash
run: |
source $ROS_ROOT/setup.bash
cd $GITHUB_WORKSPACE/packages
colcon build --merge-install --cmake-args $CMAKE_ARGS
source install/setup.bash
- name: Test ROS2 packages
continue-on-error: true
shell: bash
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
shell: bash
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"
for FILE in $FILES; do
echo $FILE
clang-tidy --fix -p=packages/build $FILE
done
code-style:
name: Formatting
needs: extract-image
runs-on: self-hosted
concurrency:
group: code-style-${{ github.ref }}
cancel-in-progress: true
container:
image: ${{ needs.extract-image.outputs.image-url}}
steps:
- name: Checkout repository
uses: actions/checkout@v3
# temporary solution until pre-commit is not installed in the container
- name: Launching pre-commit
shell: bash
run: |
pip3 install pre-commit
pre-commit run --color=always --all-files