5959 with :
6060 ref : ${{ inputs.branch || github.event.inputs.branch || github.ref }}
6161
62- - name : Set up Docker Buildx
63- uses : docker/setup-buildx-action@v3
64-
6562 - name : Setup CodeQL environment
6663 run : |
6764 echo "Setting up CodeQL environment for analysis..."
8279 # Enable dependency caching for better performance and accuracy
8380 dependency-caching : true
8481 env :
85- # Set CodeQL extractor options for better C++ analysis accuracy
86- CODEQL_EXTRACTOR_CPP_OPTION_INCLUDE_DIRECTORIES : " generated/config:generated/proto:/ usr/include:/usr/local/include:services:api"
82+ # Set CodeQL extractor options for better C++ analysis accuracy (no protobuf)
83+ CODEQL_EXTRACTOR_CPP_OPTION_INCLUDE_DIRECTORIES : " generated/config:/ usr/include:/usr/local/include:services:api:third_party "
8784 CODEQL_EXTRACTOR_CPP_OPTION_DEFINE : " ENABLE_CORE_DUMPS=1,ENABLE_PROTECTED_AUDIENCE=1,CODEQL_ANALYSIS=1"
8885 - name : Setup comprehensive C++ dependencies for maximum CodeQL accuracy
8986 if : matrix.language == 'cpp'
@@ -153,37 +150,17 @@ jobs:
153150
154151 echo "✅ Comprehensive C++ environment prepared for maximum CodeQL accuracy"
155152
156- - name : Generate protobuf files and handle custom macros for accuracy
153+ - name : Create configuration header for C++ macro resolution
157154 if : matrix.language == 'cpp'
158155 run : |
159- echo "Generating protobuf files to improve CodeQL analysis accuracy..."
160-
161- # Create output directory for generated files
162- mkdir -p generated/proto
163-
164- # Generate C++ files from .proto definitions
165- echo "Generating C++ files from protobuf definitions..."
166- if find api/ -name "*.proto" -print0 | xargs -0 -I {} protoc \
167- --cpp_out=generated/proto/ \
168- --grpc_out=generated/proto/ \
169- --plugin=protoc-gen-grpc=$(which grpc_cpp_plugin 2>/dev/null || echo "grpc_cpp_plugin") \
170- --proto_path=api/ \
171- --proto_path=/usr/include/ \
172- {}; then
173- echo "✅ Protobuf files generated successfully"
174- else
175- echo "⚠️ Some protobuf files failed to generate, continuing with available sources"
176- fi
156+ echo "Creating configuration header with common macros for better CodeQL analysis..."
157+ echo "Skipping protobuf generation due to missing dependencies - focusing on core C++ source analysis"
177158
178- # Create a comprehensive configuration header for better macro resolution
179- echo "Creating configuration header with common macros..."
159+ # Create configuration directory and header for better macro resolution
180160 mkdir -p generated/config
181161
182- # Generate configuration header line by line to avoid YAML issues
162+ # Create configuration header with common macros ( line by line to avoid YAML issues)
183163 echo "// CodeQL Analysis Configuration Header" > generated/config/codeql_config.h
184- echo "// This file provides macro definitions commonly used in the codebase" >> generated/config/codeql_config.h
185- echo "// to improve CodeQL analysis accuracy" >> generated/config/codeql_config.h
186- echo "" >> generated/config/codeql_config.h
187164 echo "#ifndef CODEQL_CONFIG_H" >> generated/config/codeql_config.h
188165 echo "#define CODEQL_CONFIG_H" >> generated/config/codeql_config.h
189166 echo "" >> generated/config/codeql_config.h
@@ -193,49 +170,43 @@ jobs:
193170 echo "#define ENABLE_PROTECTED_APP_SIGNALS 1" >> generated/config/codeql_config.h
194171 echo "#define ENABLE_KANON 1" >> generated/config/codeql_config.h
195172 echo "" >> generated/config/codeql_config.h
196- echo "// Common Google macros" >> generated/config/codeql_config.h
173+ echo "// Common Google/Abseil macros" >> generated/config/codeql_config.h
197174 echo "#define ABSL_HAVE_STD_STRING_VIEW 1" >> generated/config/codeql_config.h
198175 echo "#define GOOGLE_GLOG_DLL_DECL" >> generated/config/codeql_config.h
199176 echo "#define GFLAGS_DLL_DECL" >> generated/config/codeql_config.h
200177 echo "" >> generated/config/codeql_config.h
201178 echo "#endif // CODEQL_CONFIG_H" >> generated/config/codeql_config.h
202179
203- echo "✅ Configuration header created for better macro resolution "
180+ echo "✅ Configuration header created - CodeQL will analyze C++ source files without protobuf dependencies "
204181
205- - name : Verify comprehensive C++ source structure for maximum accuracy
182+ - name : Verify C++ source structure for CodeQL analysis
206183 if : matrix.language == 'cpp'
207184 run : |
208- echo "Verifying comprehensive C++ source code structure for maximum CodeQL analysis accuracy ..."
185+ echo "Verifying C++ source code structure for CodeQL analysis (without protobuf) ..."
209186
210- echo "=== Source File Analysis ==="
187+ echo "=== Core C++ Source Files ==="
211188 echo "Main service source files:"
212189 find services/ -name "*.cc" -o -name "*.cpp" | head -10
213- echo "Header files:"
190+ echo "Service header files:"
214191 find services/ -name "*.h" -o -name "*.hpp" | head -10
215- echo "Generated protobuf files:"
216- find generated/proto/ -name "*.pb.*" 2>/dev/null | head -10 || echo "No generated protobuf files"
192+ echo "Third-party C++ files:"
193+ find third_party/ -name "*.cc" -o -name "*.cpp" | head -5
217194
218195 echo "=== File Counts ==="
219196 echo "Total C++ source files: $(find . -name "*.cc" -o -name "*.cpp" | wc -l)"
220197 echo "Total header files: $(find . -name "*.h" -o -name "*.hpp" | wc -l)"
221- echo "Total protobuf definitions: $(find api/ -name "*.proto" | wc -l)"
222- echo "Generated protobuf files: $(find generated/ -name "*.pb.*" 2>/dev/null | wc -l || echo 0)"
223-
224- echo "=== Include Directory Structure ==="
225- echo "System includes:"
226- ls -la /usr/include/c++/ 2>/dev/null | head -5 || echo "C++ headers not found in /usr/include/c++/"
227- echo "Local includes available:"
228- echo "- $(pwd)/services/ ($(find services/ -name "*.h" | wc -l) headers)"
229- echo "- $(pwd)/api/ ($(find api/ -name "*.proto" | wc -l) proto files)"
230- echo "- $(pwd)/generated/config/ ($(find generated/config/ -name "*.h" 2>/dev/null | wc -l || echo 0) config headers)"
231- echo "- $(pwd)/generated/proto/ ($(find generated/proto/ -name "*.h" 2>/dev/null | wc -l || echo 0) generated headers)"
198+ echo "API proto definitions: $(find api/ -name "*.proto" | wc -l) (will be analyzed as text)"
199+ echo "Configuration headers: $(find generated/config/ -name "*.h" 2>/dev/null | wc -l || echo 0)"
232200
233- echo "=== Third-party Library Headers ==="
234- echo "Protobuf headers: $(ls /usr/include/google/protobuf/ 2>/dev/null | wc -l || echo 0) files"
235- echo "gRPC headers: $(ls /usr/include/grpcpp/ 2>/dev/null | wc -l || echo 0) files"
236- echo "Abseil headers: $(ls /usr/include/absl/ 2>/dev/null | wc -l || echo 0) files"
201+ echo "=== Include Directory Verification ==="
202+ echo "System C++ headers available: $(ls /usr/include/c++/ 2>/dev/null | wc -l || echo 0)"
203+ echo "Available library headers:"
204+ echo "- Standard library: $(ls /usr/include/c++/*/iostream 2>/dev/null | wc -l || echo 0) found"
205+ echo "- System headers: $(ls /usr/include/sys/ 2>/dev/null | wc -l || echo 0) files"
206+ echo "- Local service headers: $(find services/ -name "*.h" | wc -l)"
207+ echo "- Configuration headers: $(find generated/config/ -name "*.h" 2>/dev/null | wc -l || echo 0)"
237208
238- echo "✅ Comprehensive C++ source structure verified for maximum CodeQL accuracy "
209+ echo "✅ C++ source structure verified - CodeQL ready to analyze without protobuf dependencies "
239210
240211 - name : Create compilation database for enhanced accuracy
241212 if : matrix.language == 'cpp'
0 commit comments