-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·34 lines (34 loc) · 1.38 KB
/
motionbot_device_c_checker.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
name: motionbot-device C checker
on:
push:
branches: [ main ]
paths:
- 'sw/motionbot-device0/**'
pull_request:
branches: [ main ]
paths:
- 'sw/motionbot-device1/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check length of line in modules
id: long_line_checker
run: |
echo Checking length of line in modules
modules_ok=0
modules=($(find sw/ -type f -name '*.c' -exec echo '{}' \;))
for mod in "${modules[@]}"; do line_length=$(wc -L < "${mod}"); [[ $line_length -gt 80 ]] && modules_ok=1; done
[[ $modules_ok -eq 0 ]] && echo ::set-output name=status::success || echo ::set-output name=status::failure
- name: Check number of lines in modules
id: num_line_checker
run: |
echo Checking number of lines in modules
modules_ok=0
modules=($(find sw/ -type f -name '*.c' -exec echo '{}' \;))
for mod in "${modules[@]}"; do line_numbers=$(wc -l < "${mod}"); [[ $line_numbers -gt 300 ]] && modules_ok=1; done
[[ $modules_ok -eq 0 ]] && echo ::set-output name=status::success || echo ::set-output name=status::failure
- name: Check on failures
if: steps.long_line_checker.outputs.status == 'failure' || steps.num_line_checker.outputs.status == 'failure'
run: exit 1