-
-
Notifications
You must be signed in to change notification settings - Fork 48
98 lines (83 loc) · 3.31 KB
/
verify_library_structure.yaml
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
94
95
96
97
98
name: Verify library manifest and structure
# Triggers the workflow on push or pull request events
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pio_lint:
name: Verify library.json for PlatformIO
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Run python script to verify structure of library.json for PlatformIO
id: validate_manifest
continue-on-error: true
run: |
python continuous_integration/validate_manifest.py 2>&1 | tee validate_manifest.log
result_code=${PIPESTATUS[0]}
manifest_errors=$(cat validate_manifest.log)
manifest_errors="${manifest_errors//'%'/'%25'}"
manifest_errors="${manifest_errors//$'\n'/'%0A'}"
manifest_errors="${manifest_errors//$'\r'/'%0D'}"
echo "manifest_errors=manifest_errors" >> $GITHUB_OUTPUT
echo "$(cat validate_manifest.log)" >> $GITHUB_STEP_SUMMARY
echo "Finished library.json manifest verification"
exit $result_code
- name: Create commit comment
uses: peter-evans/commit-comment@v3
if: steps.validate_manifest.outcome=='failure'
with:
body: |
Please correct errors in the library.json file!
${{ steps.validate_manifest.outputs.manifest_errors }}
- name: Fail if cannot verify json
id: verification_failure
if: steps.validate_manifest.outcome=='failure'
run: exit 1
arduino_lint:
name: Validate library structure for Arduino Library Manager inclusion
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
steps:
- uses: actions/checkout@v4
- name: Run Arduino-Lint to verify the library structure and syntax for the Arduino IDE
id: validate_library
continue-on-error: true
env:
ARDUINO_LINT_LIBRARY_MANAGER_INDEXING: true
uses: arduino/arduino-lint-action@v1
with:
project-type: library
library-manager: submit
compliance: strict
verbose: true
report-file: arduino_lint.json
- name: beautify_lint_output
id: beautify_output
run: |
python continuous_integration/beautify_arduino_lint_log.py
lint_errors=$(cat arduino_lint.md)
lint_errors="${lint_errors//'%'/'%25'}"
lint_errors="${lint_errors//$'\n'/'%0A'}"
lint_errors="${lint_errors//$'\r'/'%0D'}"
echo "lint_errors=lint_errors" >> $GITHUB_OUTPUT
echo "$(cat arduino_lint.md)" >> $GITHUB_STEP_SUMMARY
- name: Create commit comment
uses: peter-evans/commit-comment@v3
if: steps.validate_library.outcome=='failure'
with:
body: ${{ steps.beautify_output.outputs.lint_errors }}
- name: Fail if cannot verify library structure
id: verification_failure
if: steps.validate_library.outcome=='failure'
run: exit 1