1
- # This workflow runs a build with a python version that has debug symbols
2
- # Also generates coverage information from unit tests
3
- #
4
- # Note that for intrinsics, it only runs what gets compiled
5
- # -# and would naturally run. It also is limited to what can run in
6
- # -# a CI environment
7
- # -# IMPORTANT: binaries are not to be uploaded from this workflow!
8
- #
1
+ # This workflow runs a build with a python version that has debug symbols.
2
+ # Also generates coverage information from unit tests. Note that for intrinsics,
3
+ # it only runs what gets compiled and would naturally run. It also is limited to
4
+ # what can run in a CI environment.
9
5
# Update this workflow when our min/max python minor versions update
10
6
# This workflow is necessary to ensure that we can build and run with
11
7
# a debug python build without too much worrying about SIGABRT being thrown
12
8
# IMPORTANT: binaries are not to be uploaded from this workflow!
13
9
14
- name : Ubuntu debug
10
+ name : Ubuntu Checks
15
11
defaults :
16
12
run :
17
13
shell : bash -leo pipefail {0}
30
26
- ' *.md'
31
27
- ' .github/workflows/*.yml'
32
28
# re-include current file to not be excluded
33
- - ' !.github/workflows/build -ubuntu-debug .yml'
29
+ - ' !.github/workflows/run -ubuntu-checks .yml'
34
30
35
31
pull_request :
36
32
branches : main
42
38
- ' *.md'
43
39
- ' .github/workflows/*.yml'
44
40
# re-include current file to not be excluded
45
- - ' !.github/workflows/build -ubuntu-debug .yml'
41
+ - ' !.github/workflows/run -ubuntu-checks .yml'
46
42
47
43
concurrency :
48
- group : ${{ github.workflow }}-${{ github.ref }}-ubuntu-debug
44
+ group : ${{ github.workflow }}-${{ github.ref }}-ubuntu-checks
49
45
cancel-in-progress : true
50
46
51
47
jobs :
52
- debug :
48
+ debug_coverage :
53
49
runs-on : ${{ matrix.os }}
54
50
strategy :
55
51
fail-fast : false # if a particular matrix build fails, don't skip the rest
@@ -106,7 +102,7 @@ jobs:
106
102
id : build-pygame-ce
107
103
run : |
108
104
pyenv global ${{ matrix.python }}-debug
109
- python dev.py build --wheel -- lax --coverage --ctest
105
+ python dev.py build --lax --coverage
110
106
111
107
- name : Run tests
112
108
env :
@@ -119,7 +115,7 @@ jobs:
119
115
- name : Generate coverage
120
116
id : gen-coverage
121
117
# want to continue regardless of whether a test failed or not as long as the job wasn't cancelled
122
- if : ${{ steps.build.conclusion == 'success' && !cancelled() }}
118
+ if : ${{ steps.build-pygame-ce .conclusion == 'success' && !cancelled() }}
123
119
run : |
124
120
lcov --capture --directory . --output-file ./coverage.info
125
121
genhtml ./coverage.info --output-directory ./out
@@ -139,3 +135,32 @@ jobs:
139
135
with :
140
136
name : ctest_suite_log
141
137
path : ./ctest.log
138
+
139
+ # Run cppcheck static analysis on src_c changes
140
+ run-cppcheck :
141
+ runs-on : ubuntu-24.04
142
+ needs : debug_coverage
143
+
144
+ steps :
145
+ - uses : actions/checkout@v4.2.2
146
+
147
+ - name : Check if any src_c files changed
148
+ id : check-changes
149
+ run : |
150
+ git fetch origin ${{ github.base_ref }} --depth=1 || true
151
+ CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
152
+ echo "$CHANGED_FILES" | grep '^src_c/' || echo "::set-output name=skip::true"
153
+
154
+ - name : Install cppcheck
155
+ if : steps.check-changes.outputs.skip != 'true'
156
+ run : |
157
+ sudo apt-get update --fix-missing
158
+ sudo apt install cppcheck
159
+
160
+ - name : Run Static Checker
161
+ if : steps.check-changes.outputs.skip != 'true'
162
+ run : cppcheck src_c --enable=performance,portability,warning \
163
+ --suppress=*:src_c/freetype/ft_cache.c --suppress=*:src_c/scrap* \
164
+ --suppress=*:src_c/scale_mmx*.c --suppress=*:src_c/SDL_gfx/* \
165
+ --suppress=missingReturn --suppress=syntaxError -DWITH_THREAD -j $(nproc) \
166
+ -DPG_MAJOR_VERSION -DPG_MINOR_VERSION -DPG_PATCH_VERSION -DPG_VERSION_TAG
0 commit comments