Skip to content

Commit d5da74d

Browse files
authored
Merge branch 'main' into neopixel
2 parents b656564 + 78f43a8 commit d5da74d

4 files changed

Lines changed: 192 additions & 192 deletions

File tree

.github/workflows/CodeQL.yml

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

.github/workflows/Linter.yml

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
name: Linter
2+
run-name: Linter - ${{ github.ref_name }}
3+
4+
on:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.run_id }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
configs:
16+
name: Configuration Files
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
steps:
21+
- name: Checkout Repository
22+
uses: actions/checkout@v6
23+
with:
24+
fetch-depth: 1
25+
26+
- name: Validate Configuration Files
27+
uses: kehoecj/validate-configs-action@v4
28+
29+
codeql:
30+
name: Analyze Code
31+
runs-on: ubuntu-latest
32+
permissions:
33+
actions: read
34+
contents: read
35+
security-events: write
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
include:
40+
- languages: 'c'
41+
build_mode: 'manual'
42+
- languages: 'actions'
43+
build_mode: 'none'
44+
env:
45+
SCCACHE_DIR: ${{ github.workspace }}/sccache
46+
SCCACHE_LOG: "info"
47+
SCCACHE_ERROR_LOG: ${{ github.workspace }}/sccache-error.log
48+
steps:
49+
- name: Checkout Repository
50+
uses: actions/checkout@v6
51+
52+
- name: Install Arm Toolchain
53+
if: matrix.build_mode == 'manual'
54+
uses: carlosperate/arm-none-eabi-gcc-action@v1
55+
with:
56+
release: '12.2.Rel1'
57+
58+
- name: Setup Shared Compilation Cache
59+
if: matrix.build_mode == 'manual'
60+
uses: actions/cache@v5
61+
with:
62+
path: ${{ env.SCCACHE_DIR }}
63+
key: sccache-${{ github.workflow }}-${{ runner.os }}-${{ matrix.languages }}-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}-${{ github.event.pull_request.number || github.ref }}
64+
restore-keys: |
65+
sccache-${{ github.workflow }}-${{ runner.os }}-${{ matrix.languages }}-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}-
66+
sccache-${{ github.workflow }}-${{ runner.os }}-${{ matrix.languages }}-
67+
68+
- name: Setup Shared Compilation Cache
69+
if: matrix.build_mode == 'manual'
70+
uses: mozilla-actions/sccache-action@v0.0.9
71+
72+
- name: Setup Trap Cache Directory
73+
if: matrix.build_mode == 'manual'
74+
run: mkdir -p /home/runner/work/_temp/trapCaches/cpp/tarballs
75+
76+
- name: Initialize CodeQL
77+
uses: github/codeql-action/init@v4
78+
with:
79+
languages: ${{ matrix.languages }}
80+
build-mode: ${{ matrix.build_mode }}
81+
82+
- name: Build CodeQL Database
83+
if: matrix.build_mode == 'manual'
84+
run: CMAKE_C_COMPILER_LAUNCHER=sccache make all -j
85+
86+
- name: Analyze CodeQL
87+
id: analyze
88+
uses: github/codeql-action/analyze@v4
89+
90+
- name: Upload Analysis Results
91+
if: always()
92+
uses: actions/upload-artifact@v6
93+
with:
94+
name: codeql-${{ matrix.languages }}
95+
path: ${{ steps.analyze.outputs.sarif-output }}
96+
retention-days: 2
97+
98+
perllinter:
99+
name: Perl Linter
100+
runs-on: ubuntu-slim
101+
permissions:
102+
contents: read
103+
checks: write
104+
steps:
105+
- name: Checkout Repository
106+
uses: actions/checkout@v6
107+
with:
108+
fetch-depth: 1
109+
110+
- name: Setup Perl
111+
uses: shogo82148/actions-setup-perl@v1
112+
with:
113+
install-modules: 'Perl::Critic'
114+
115+
- name: Perl Critic Output
116+
run: |
117+
set -o pipefail
118+
violations_found=0
119+
while IFS= read -r file; do
120+
echo "<details>" >> $GITHUB_STEP_SUMMARY
121+
echo "<summary><code>$file</code></summary>" >> $GITHUB_STEP_SUMMARY
122+
echo "" >> $GITHUB_STEP_SUMMARY
123+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
124+
if ! perlcritic "$file" 2>&1 | tee -a $GITHUB_STEP_SUMMARY; then
125+
violations_found=1
126+
fi
127+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
128+
echo "" >> $GITHUB_STEP_SUMMARY
129+
echo "</details>" >> $GITHUB_STEP_SUMMARY
130+
done < <(git ls-files '*.pl' '*.pm')
131+
exit $violations_found
132+
133+
- name: Perl Critic Annotations
134+
if: always()
135+
run: |
136+
set -o pipefail
137+
git ls-files '*.pl' '*.pm' \
138+
| xargs -r perlcritic --verbose '%f:%l:%c:%s:%m (%p)\n' \
139+
| jq -R -s '
140+
split("\n")
141+
| map(
142+
select(length > 0)
143+
| match("^([^:]+):([^:]+):([^:]+):([^:]+):(.+)$")
144+
| (.captures[3].string | tonumber) as $severity
145+
| {
146+
file: .captures[0].string,
147+
line: (.captures[1].string | tonumber),
148+
start_column: (.captures[2].string | tonumber),
149+
end_column: (.captures[2].string | tonumber),
150+
annotation_level: (
151+
if $severity == 5 then "failure"
152+
elif $severity >= 3 then "warning"
153+
else "notice"
154+
end
155+
),
156+
message: .captures[4].string
157+
}
158+
)
159+
' \
160+
| tee perlcritic_annotations.json
161+
162+
- name: Upload Annotations
163+
if: failure() && github.event_name == 'pull_request'
164+
uses: yuzutech/annotations-action@v0.5.0
165+
with:
166+
title: 'Perl Linter Findings'
167+
repo-token: ${{ github.token }}
168+
input: 'perlcritic_annotations.json'
169+
170+
all:
171+
name: Completed All Linting
172+
needs: [ configs, codeql, perllinter ]
173+
runs-on: ubuntu-slim
174+
permissions: { }
175+
if: always()
176+
steps:
177+
- name: Fail Linting
178+
if: >
179+
${{
180+
needs.configs.result != 'success' ||
181+
needs.codeql.result != 'success' ||
182+
needs.perllinter.result != 'success'
183+
}}
184+
run: |
185+
echo "One or more linting jobs have failed."
186+
echo "Please check the individual job logs for details."
187+
exit 1
188+
189+
- name: Complete Linting
190+
run: |
191+
echo "Linting has been completed for all configured linters."
192+
echo "Please refer to the individual job logs for detailed linting information."

.github/workflows/PerlCritic.yml

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

.github/workflows/ValidateConfigs.yml

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

0 commit comments

Comments
 (0)