Skip to content

Commit e6df1a7

Browse files
committed
Optimize and organize github actions
Add pre-commit configuration. Add uncrustify config from the FreeRTOS/FreeRTOS repository. Replace custom url_verifier.sh script with the common url verifier from the FreeRTOS/CI-CD-Github-Actions repository. Update README.md
1 parent 995661b commit e6df1a7

File tree

12 files changed

+556
-202
lines changed

12 files changed

+556
-202
lines changed

.github/actions/url_verifier.sh

Lines changed: 0 additions & 63 deletions
This file was deleted.

.github/scripts/kernel_checker.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
KERNEL_IGNORED_FILES = [
3737
'FreeRTOS-openocd.c',
3838
'Makefile',
39-
'.DS_Store'
39+
'.DS_Store',
40+
'uncrustify.cfg'
4041
]
4142

4243
KERNEL_IGNORED_EXTENSIONS = [
@@ -60,7 +61,9 @@
6061
'.png',
6162
'.bat',
6263
'.sh',
63-
'.txt'
64+
'.txt',
65+
'.yml',
66+
'.yaml'
6467
]
6568

6669
KERNEL_ASM_EXTENSIONS = [
@@ -148,4 +151,3 @@ def main():
148151

149152
if __name__ == '__main__':
150153
exit(main())
151-

.github/workflows/ci.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/formatting.yml

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
name: Format
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "**"
7+
jobs:
8+
spelling:
9+
name: Spelling
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: "Checkout repository"
13+
uses: actions/checkout@v2
14+
- name: "Install Python"
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: 3.8
18+
- name: "List Changed Files"
19+
id: file_changes
20+
uses: trilom/file-changes-action@a6ca26c14274c33b15e6499323aac178af06ad4b # v1.2.4
21+
with:
22+
output: ' '
23+
- name: "Install dependencies"
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install pre-commit
27+
28+
- name: Check Spelling
29+
run: |
30+
pre-commit run \
31+
--files ${{ steps.file_changes.outputs.files_added}} \
32+
${{ steps.file_changes.outputs.files_changed}} \
33+
--show-diff-on-failure \
34+
codespell
35+
linters:
36+
name: Code Style
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: "Checkout repository"
40+
uses: actions/checkout@v2
41+
- name: "Install Python"
42+
uses: actions/setup-python@v2
43+
with:
44+
python-version: 3.8
45+
- name: "List Changed Files"
46+
id: file_changes
47+
uses: trilom/file-changes-action@a6ca26c14274c33b15e6499323aac178af06ad4b # v1.2.4
48+
with:
49+
output: ' '
50+
- name: "Install dependencies"
51+
run: |
52+
python -m pip install --upgrade pip
53+
pip install pre-commit
54+
55+
- name: "Lint C code (uncrustify)"
56+
run: |
57+
pre-commit run \
58+
--files ${{ steps.file_changes.outputs.files_added}} \
59+
${{ steps.file_changes.outputs.files_changed}} \
60+
--show-diff-on-failure \
61+
uncrustify
62+
63+
- name: "Lint other files"
64+
run: |
65+
pre-commit run \
66+
--files ${{ steps.file_changes.outputs.files_added}} \
67+
${{ steps.file_changes.outputs.files_changed}} \
68+
--show-diff-on-failure \
69+
check-executables-have-shebangs
70+
71+
pre-commit run \
72+
--files ${{ steps.file_changes.outputs.files_added}} \
73+
${{ steps.file_changes.outputs.files_changed}} \
74+
--show-diff-on-failure \
75+
shellcheck
76+
77+
pre-commit run \
78+
--files ${{ steps.file_changes.outputs.files_added}} \
79+
${{ steps.file_changes.outputs.files_changed}} \
80+
--show-diff-on-failure \
81+
check-ast
82+
83+
pre-commit run \
84+
--files ${{ steps.file_changes.outputs.files_added}} \
85+
${{ steps.file_changes.outputs.files_changed}} \
86+
--show-diff-on-failure \
87+
check-json
88+
89+
pre-commit run \
90+
--files ${{ steps.file_changes.outputs.files_added}} \
91+
${{ steps.file_changes.outputs.files_changed}} \
92+
--show-diff-on-failure \
93+
check-yaml
94+
95+
compatibility:
96+
name: Compatibility
97+
runs-on: ubuntu-latest
98+
steps:
99+
- name: "Checkout repository"
100+
uses: actions/checkout@v2
101+
- name: "Install Python"
102+
uses: actions/setup-python@v2
103+
with:
104+
python-version: 3.8
105+
- name: "List Changed Files"
106+
id: file_changes
107+
uses: trilom/file-changes-action@a6ca26c14274c33b15e6499323aac178af06ad4b # v1.2.4
108+
with:
109+
output: ' '
110+
- name: "Install dependencies"
111+
run: |
112+
python -m pip install --upgrade pip
113+
pip install pre-commit
114+
- name: "Emd of Line checks"
115+
run: |
116+
pre-commit run \
117+
--files ${{ steps.file_changes.outputs.files_added}} \
118+
${{ steps.file_changes.outputs.files_changed}} \
119+
--show-diff-on-failure \
120+
trailing-whitespace
121+
122+
pre-commit run \
123+
--files ${{ steps.file_changes.outputs.files_added}} \
124+
${{ steps.file_changes.outputs.files_changed}} \
125+
--show-diff-on-failure \
126+
mixed-line-ending
127+
128+
pre-commit run \
129+
--files ${{ steps.file_changes.outputs.files_added}} \
130+
${{ steps.file_changes.outputs.files_changed}} \
131+
--show-diff-on-failure \
132+
fix-byte-order-marker
133+
134+
pre-commit run \
135+
--files ${{ steps.file_changes.outputs.files_added}} \
136+
${{ steps.file_changes.outputs.files_changed}} \
137+
--show-diff-on-failure \
138+
end-of-file-fixer
139+
140+
- name: "Filename conflicts"
141+
run: |
142+
pre-commit run \
143+
--files ${{ steps.file_changes.outputs.files_added}} \
144+
${{ steps.file_changes.outputs.files_changed}} \
145+
--show-diff-on-failure \
146+
check-case-conflict
147+
148+
- name: "Version Control issues"
149+
run: |
150+
pre-commit run \
151+
--files ${{ steps.file_changes.outputs.files_added}} \
152+
${{ steps.file_changes.outputs.files_changed}} \
153+
--show-diff-on-failure \
154+
git-dirty
155+
156+
pre-commit run \
157+
--files ${{ steps.file_changes.outputs.files_added}} \
158+
${{ steps.file_changes.outputs.files_changed}} \
159+
--show-diff-on-failure \
160+
forbid-binary
161+
162+
pre-commit run \
163+
--files ${{ steps.file_changes.outputs.files_added}} \
164+
${{ steps.file_changes.outputs.files_changed}} \
165+
--show-diff-on-failure \
166+
check-added-large-files
167+
url-check:
168+
name: Broken URLs
169+
runs-on: ubuntu-latest
170+
steps:
171+
- name: Checkout Repository
172+
uses: actions/checkout@v2
173+
174+
- name: Setup Python
175+
uses: actions/setup-python@v2
176+
with:
177+
python-version: '3.8'
178+
179+
- name: Check Links
180+
uses: FreeRTOS/CI-CD-GitHub-Actions/link-verifier@main
181+
with:
182+
path: ./
183+
exclude-dirs: .git
184+
include-file-types: .c,.h,.s,.S,.asm,.inc,.src,.s26,.s43,.s79,.s82,.s85,.s87,.s90,\
185+
.json,.yaml,.yml,\
186+
.md,.readme,.txt,.url,\
187+
.bat,.sh,.py
188+
189+
file-headers:
190+
name: File Headers
191+
runs-on: ubuntu-latest
192+
steps:
193+
# Install python 3
194+
- name: Tool Setup
195+
uses: actions/setup-python@v2
196+
with:
197+
python-version: 3.8
198+
architecture: x64
199+
200+
# There is shared code, hosted by FreeRTOS/FreeRTOS, with deps needed by header checker
201+
- name: Checkout FreeRTOS Tools
202+
uses: actions/checkout@v2
203+
with:
204+
repository: FreeRTOS/FreeRTOS
205+
ref: main
206+
path: tools
207+
208+
# Checkout user pull request changes
209+
- name: Checkout Pull Request
210+
uses: actions/checkout@v2
211+
with:
212+
ref: ${{ github.event.pull_request.head.sha }}
213+
path: inspect
214+
215+
- name: "List Changed Files"
216+
id: file_changes
217+
uses: trilom/file-changes-action@a6ca26c14274c33b15e6499323aac178af06ad4b # v1.2.4
218+
219+
# Run checks
220+
- name: Check File Headers
221+
run: |
222+
cp -r tools/.github/scripts/common inspect/.github/scripts/
223+
pip install -r tools/.github/scripts/common/requirements.txt
224+
cd inspect
225+
.github/scripts/kernel_checker.py --json ${HOME}/files_modified.json ${HOME}/files_added.json ${HOME}/files_renamed.json
226+
exit $?

.github/workflows/git-secrets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: git-secrets Check
1+
name: Git-Secrets
22
on:
33
push:
44
pull_request:

0 commit comments

Comments
 (0)