Skip to content

main: Add CLI entry point supporting training, inference, and interac… #31

main: Add CLI entry point supporting training, inference, and interac…

main: Add CLI entry point supporting training, inference, and interac… #31

Workflow file for this run

name: Syntax Check
on:
push:
branches: [ "master" ]
paths:
- "**/*.py"
- "**/*.cpp"
- "**/*.c"
- "**/*.h"
- "**/*.hpp"
pull_request:
branches: [ "master" ]
paths:
- "**/*.py"
- "**/*.cpp"
- "**/*.c"
- "**/*.h"
- "**/*.hpp"
jobs:
syntax-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# --- Python Syntax Check ---
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Python Linter
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Lint Python Files
run: |
# E9, F63, F7, F82 checks syntax errors & undefined variables
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Check C/C++ Syntax
run: |
echo "Checking C and C++ files for syntax errors..."
errors=0
# Loop through C files (-I. includes local root directory for header lookups)
while read -r file; do
if [ -z "$file" ]; then continue; fi
echo "Checking $file"
if ! gcc -fsyntax-only -I. "$file"; then
echo "::error file=$file::Syntax error in $file"
errors=$((errors + 1))
fi
done < <(find . -type f -name "*.c")
# Loop through C++ files
while read -r file; do
if [ -z "$file" ]; then continue; fi
echo "Checking $file"
if ! g++ -fsyntax-only -I. "$file"; then
echo "::error file=$file::Syntax error in $file"
errors=$((errors + 1))
fi
done < <(find . -type f -name "*.cpp")
if [ $errors -ne 0 ]; then
echo "$errors file(s) failed syntax verification."
exit 1
fi
echo "All C, C++, and Python files passed syntax checks!"