Skip to content

Repository restructuring: Fix naming, add community infrastructure, enhance CI/CD #8

Repository restructuring: Fix naming, add community infrastructure, enhance CI/CD

Repository restructuring: Fix naming, add community infrastructure, enhance CI/CD #8

Workflow file for this run

name: C++ Compilation Check
on:
push:
branches: [ main, develop ]
paths:
- '**.cpp'
- '**.h'
- '**.hpp'
pull_request:
branches: [ main, develop ]
paths:
- '**.cpp'
- '**.h'
- '**.hpp'
jobs:
build:
name: Build C++ Programs
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install g++
run: |
sudo apt-get update
sudo apt-get install -y g++ build-essential
- name: Verify g++ Installation
run: |
echo "📦 Compiler Information:"
g++ --version
echo ""
- name: Find and Compile C++ Files
run: |
echo "🔍 Finding C++ source files..."
FAILED_FILES=0
SUCCESS_FILES=0
TOTAL_FILES=0
while IFS= read -r file; do
TOTAL_FILES=$((TOTAL_FILES + 1))
echo ""
echo "📝 Compiling ($TOTAL_FILES): $file"
if g++ -std=c++17 -Wall -Wextra -c "$file" -o "${file%.cpp}.o" 2>&1; then
echo "✅ Success: $file"
SUCCESS_FILES=$((SUCCESS_FILES + 1))
else
echo "❌ Failed: $file"
FAILED_FILES=$((FAILED_FILES + 1))
fi
done < <(find . -name "*.cpp" -type f)
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "📊 Compilation Summary:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Total files: $TOTAL_FILES"
echo "✅ Successful: $SUCCESS_FILES"
echo "❌ Failed: $FAILED_FILES"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
if [ $FAILED_FILES -gt 0 ]; then
echo ""
echo "⚠️ Warning: Some files failed to compile"
echo "This is expected for educational examples that may contain intentional errors."
exit 0
else
echo ""
echo "🎉 All files compiled successfully!"
fi
- name: Clean Up Object Files
if: always()
run: find . -name "*.o" -delete