Skip to content

Commit aa28ee6

Browse files
committed
Improve workflows
- Release build on Windows - Debug build + linting on Ubuntu - Fail workflow if clang-tidy warnings are encountered
1 parent 5600b63 commit aa28ee6

File tree

2 files changed

+95
-18
lines changed

2 files changed

+95
-18
lines changed

.github/workflows/merge-criteria.yml

Lines changed: 95 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ jobs:
4242
4343
echo "$filtered_array"
4444
echo "matrix=$filtered_array" >> "$GITHUB_OUTPUT"
45-
45+
4646
outputs:
4747
matrix: ${{ steps.changed-files-filtered.outputs.matrix }}
48-
48+
4949
format_check:
5050
if: ${{ fromJson(needs.generate_matrix.outputs.matrix) }}
5151
name: Format Check
5252
needs: generate_matrix
5353
strategy:
5454
fail-fast: false
55-
matrix:
55+
matrix:
5656
project: ${{ fromJson(needs.generate_matrix.outputs.matrix) }}
5757
runs-on: ubuntu-latest
5858

@@ -67,42 +67,123 @@ jobs:
6767
check-path: '${{ matrix.project }}/src'
6868
exclude-regex: '(lib|telemetry/src/st|ground_station/src/format)'
6969

70-
build:
70+
build_lint:
7171
if: ${{ fromJson(needs.generate_matrix.outputs.matrix) }}
7272
needs: [generate_matrix, format_check]
73-
name: Build + Lint
74-
# We are running this on windows because the users get binaries compiled on windows.
75-
# The code should also be tested in a linux build.
73+
name: '[Ubuntu] Build + Lint'
74+
# We are linting on Ubuntu because the linter seems to work better on Linux
7675
runs-on: ubuntu-latest
7776
timeout-minutes: 60
7877
strategy:
7978
fail-fast: false
80-
matrix:
79+
matrix:
80+
project: ${{ fromJson(needs.generate_matrix.outputs.matrix) }}
81+
82+
steps:
83+
- name: Checkout
84+
uses: actions/checkout@v3
85+
86+
- name: Check cache
87+
uses: actions/cache@v3
88+
with:
89+
path: ~/.platformio/.cache
90+
# Add OS to key if testing with multiple OSes
91+
key: ${{ matrix.project }}-pio
92+
93+
- name: Set up Python
94+
uses: actions/setup-python@v3
95+
with:
96+
python-version: '3.9'
97+
cache: 'pip'
98+
99+
- name: Install dependencies
100+
run: pip install --upgrade platformio
101+
102+
- name: Install PlatformIO Libraries
103+
run: pio pkg install --global
104+
105+
- name: Build
106+
shell: bash
107+
run: |
108+
if [[ "${{ matrix.project }}" == "flight_computer" ]]; then
109+
platformio run -d ${{ matrix.project }} --environment debug
110+
else
111+
platformio run -d ${{ matrix.project }}
112+
fi
113+
114+
- name: Generate compile_commands.json
115+
run: |
116+
if [[ "${{ matrix.project }}" == "flight_computer" ]]; then
117+
platformio run -d ${{ matrix.project }} --target compiledb --environment debug
118+
else
119+
platformio run -d ${{ matrix.project }} --target compiledb
120+
fi
121+
122+
- name: Lint
123+
working-directory: ./${{ matrix.project }}
124+
run: |
125+
if [[ "${{ matrix.project }}" == "flight_computer" ]]; then
126+
output=$(platformio check --environment debug)
127+
else
128+
output=$(platformio check)
129+
fi
130+
131+
echo "$output"
132+
133+
echo "Note: Warnings 'clang-diagnostic-c++17-extensions' and 'clang-analyzer-valist.Uninitialized' are excluded from checking since they seem to be false-positives. Fix everything else!"
134+
135+
# filter the output to exclude false positives
136+
filtered_output=$(echo "$output" | grep -vE 'clang-diagnostic-c\+\+17-extensions|clang-analyzer-valist.Uninitialized')
137+
138+
if echo "$filtered_output" | grep -q "warning"; then
139+
echo "clang-tidy check failed!"
140+
exit 1
141+
fi
142+
143+
- name: Upload Compile Commands
144+
uses: actions/upload-artifact@v3
145+
with:
146+
name: ubuntu_compile_commands
147+
path: |
148+
./${{ matrix.project }}/.pio/build/**/compile_commands.json
149+
if-no-files-found: error
150+
retention-days: 90
151+
152+
build_upload:
153+
if: ${{ fromJson(needs.generate_matrix.outputs.matrix) }}
154+
needs: [generate_matrix, format_check]
155+
name: '[Windows] Build + Upload'
156+
# We are running this on windows because the users get binaries compiled on windows.
157+
runs-on: windows-latest
158+
timeout-minutes: 60
159+
strategy:
160+
fail-fast: false
161+
matrix:
81162
project: ${{ fromJson(needs.generate_matrix.outputs.matrix) }}
82163

83164
steps:
84165
- name: Checkout
85166
uses: actions/checkout@v3
86-
167+
87168
- name: Check cache
88169
uses: actions/cache@v3
89170
with:
90171
path: ~/.platformio/.cache
91172
# Add OS to key if testing with multiple OSes
92173
key: ${{ matrix.project }}-pio
93-
174+
94175
- name: Set up Python
95176
uses: actions/setup-python@v3
96177
with:
97178
python-version: '3.9'
98179
cache: 'pip'
99-
180+
100181
- name: Install dependencies
101182
run: pip install --upgrade platformio
102-
183+
103184
- name: Install PlatformIO Libraries
104185
run: pio pkg install --global
105-
186+
106187
- name: Build
107188
shell: bash
108189
run: |
@@ -113,11 +194,7 @@ jobs:
113194
114195
- name: Generate compile_commands.json
115196
run: platformio run -d ${{ matrix.project }} --target compiledb
116-
117-
- name: Lint
118-
working-directory: ./${{ matrix.project }}
119-
run: platformio check
120-
197+
121198
- name: Upload Artifacts
122199
uses: actions/upload-artifact@v3
123200
with:

flight_computer/src/target/VEGA/startup_stm32f411ccux.s renamed to flight_computer/src/target/VEGA/startup_stm32f411ccux.S

File renamed without changes.

0 commit comments

Comments
 (0)