-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
57 lines (52 loc) · 1.62 KB
/
Copy pathaction.yml
File metadata and controls
57 lines (52 loc) · 1.62 KB
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
name: 'Validate DBC'
description: 'Github Action for validating .dbc files using cantools.'
author: 'Polymath Robotics'
branding:
icon: 'check-circle'
color: 'green'
inputs:
path:
description: 'Directory to search recursively for .dbc files (used when `files` is empty).'
required: false
default: '.'
files:
description: 'Explicit space- or newline-separated list of .dbc files. Overrides `path` when set.'
required: false
default: ''
python-version:
description: 'Python version used to run the validator.'
required: false
default: '3.10'
cantools-version:
description: 'pip version specifier appended to "cantools" (e.g. ">=40,<41").'
required: false
default: '>=40,<41'
runs:
using: 'composite'
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Install cantools
shell: bash
env:
CANTOOLS_VERSION: ${{ inputs.cantools-version }}
run: python -m pip install --upgrade "cantools${CANTOOLS_VERSION}"
- name: Validate DBC files
shell: bash
env:
INPUT_FILES: ${{ inputs.files }}
INPUT_PATH: ${{ inputs.path }}
ACTION_PATH: ${{ github.action_path }}
run: |
if [ -n "$INPUT_FILES" ]; then
read -r -a files <<< "$INPUT_FILES"
else
mapfile -t files < <(find "$INPUT_PATH" -type f -name '*.dbc' | sort)
fi
if [ "${#files[@]}" -eq 0 ]; then
echo "No .dbc files found."
exit 0
fi
python "$ACTION_PATH/scripts/validate_dbc.py" "${files[@]}"