org imports #82
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| schedule: | |
| # Run nightly at 2 AM UTC | |
| - cron: '0 2 * * *' | |
| env: | |
| # Use the latest stable Zig version | |
| ZIG_VERSION: 0.14.1 | |
| jobs: | |
| lint: | |
| name: Lint and Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Zig | |
| uses: goto-bus-stop/setup-zig@v2 | |
| with: | |
| version: ${{ env.ZIG_VERSION }} | |
| - name: Install system dependencies | |
| shell: bash | |
| run: | | |
| echo "🔧 Installing system dependencies for ${{ runner.os }}..." | |
| case "${{ runner.os }}" in | |
| Linux) | |
| sudo apt-get update -qq | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| clang \ | |
| libc++-dev \ | |
| libc++abi-dev \ | |
| libboost-all-dev \ | |
| libssl-dev \ | |
| pkg-config \ | |
| git | |
| echo "✅ Linux dependencies installed" | |
| ;; | |
| macOS) | |
| brew update | |
| brew install boost openssl cmake | |
| echo "✅ macOS dependencies installed" | |
| ;; | |
| # Windows) | |
| # # Install basic dependencies | |
| # choco install cmake openssl | |
| # # Install Boost via vcpkg for better CMake integration | |
| # vcpkg install boost-system boost-filesystem boost-program-options --triplet x64-windows | |
| # echo "✅ Windows dependencies installed" | |
| # ;; | |
| esac | |
| - name: Cache Zig artifacts | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/zig | |
| .zig-cache | |
| key: ${{ runner.os }}-zig-${{ env.ZIG_VERSION }}-${{ hashFiles('build.zig', 'build.zig.zon') }} | |
| restore-keys: | | |
| ${{ runner.os }}-zig-${{ env.ZIG_VERSION }}- | |
| - name: Check formatting | |
| run: | | |
| echo "🔍 Checking code formatting..." | |
| zig fmt --check src/ || { | |
| echo "❌ Code formatting issues found. Run 'zig fmt src/' to fix." | |
| exit 1 | |
| } | |
| echo "✅ Code formatting is correct" | |
| - name: Lint code | |
| run: | | |
| echo "🔍 Running linter..." | |
| find src/ -name "*.zig" -exec zig ast-check {} \; || { | |
| echo "❌ Linting issues found" | |
| exit 1 | |
| } | |
| echo "✅ All files pass linting" | |
| test: | |
| name: Test | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] # windows-latest commented out until Boost issues resolved | |
| zig-version: [0.14.1] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Zig | |
| uses: goto-bus-stop/setup-zig@v2 | |
| with: | |
| version: ${{ matrix.zig-version }} | |
| - name: Install system dependencies | |
| shell: bash | |
| run: | | |
| echo "🔧 Installing system dependencies for ${{ runner.os }}..." | |
| case "${{ runner.os }}" in | |
| Linux) | |
| sudo apt-get update -qq | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| clang \ | |
| libc++-dev \ | |
| libc++abi-dev \ | |
| libboost-all-dev \ | |
| libssl-dev \ | |
| pkg-config \ | |
| git | |
| echo "✅ Linux dependencies installed" | |
| ;; | |
| macOS) | |
| brew update | |
| brew install boost openssl cmake | |
| echo "✅ macOS dependencies installed" | |
| ;; | |
| # Windows) | |
| # # Install basic dependencies | |
| # choco install cmake openssl | |
| # # Install Boost via vcpkg for better CMake integration | |
| # vcpkg install boost-system boost-filesystem boost-program-options --triplet x64-windows | |
| # echo "✅ Windows dependencies installed" | |
| # ;; | |
| esac | |
| - name: Cache Zig artifacts | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/zig | |
| .zig-cache | |
| key: ${{ runner.os }}-zig-${{ matrix.zig-version }}-${{ hashFiles('build.zig', 'build.zig.zon') }} | |
| restore-keys: | | |
| ${{ runner.os }}-zig-${{ matrix.zig-version }}- | |
| - name: Build project | |
| shell: bash | |
| run: | | |
| echo "🔨 Building Ora compiler..." | |
| zig build | |
| echo "✅ Build successful" | |
| - name: Run comprehensive tests | |
| shell: bash | |
| run: | | |
| echo "🧪 Running comprehensive test suite..." | |
| zig build test || echo "⚠️ Some tests failed" | |
| echo "✅ Comprehensive test suite completed" | |
| - name: Run AST tests | |
| shell: bash | |
| run: | | |
| echo "🧪 Running AST visitor tests..." | |
| zig build test-ast || echo "⚠️ AST tests failed" | |
| echo "✅ AST tests completed" | |
| - name: Run lexer tests | |
| shell: bash | |
| run: | | |
| echo "🧪 Running lexer tests..." | |
| zig build test-lexer || echo "⚠️ Lexer tests failed" | |
| echo "✅ Lexer tests completed" | |
| - name: Run expression parser tests | |
| shell: bash | |
| run: | | |
| echo "🧪 Running expression parser tests..." | |
| zig build test-expression-parser || echo "⚠️ Expression parser tests failed" | |
| echo "✅ Expression parser tests completed" | |
| - name: Run test framework tests | |
| shell: bash | |
| run: | | |
| echo "🧪 Running test framework tests..." | |
| zig build test-framework || echo "⚠️ Test framework tests failed" | |
| echo "✅ Test framework tests completed" | |
| - name: Run example tests | |
| shell: bash | |
| run: | | |
| echo "🧪 Running example tests..." | |
| zig build test-examples || echo "⚠️ Example tests failed (some expected due to compiler bugs)" | |
| echo "✅ Example tests completed" | |
| - name: Test individual components | |
| shell: bash | |
| run: | | |
| echo "🔧 Testing individual components..." | |
| zig build-lib src/lexer.zig && echo "✅ Lexer compiles" | |
| zig build-lib src/parser.zig && echo "✅ Parser compiles" | |
| zig build-lib src/semantics.zig && echo "✅ Semantics compiles" | |
| zig build-lib src/typer.zig && echo "✅ Typer compiles" | |
| - name: Clean up build artifacts | |
| shell: bash | |
| run: | | |
| rm -f lib*.a lib*.a.o | |
| examples: | |
| name: Build Examples | |
| runs-on: ubuntu-latest | |
| needs: [lint, test] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Zig | |
| uses: goto-bus-stop/setup-zig@v2 | |
| with: | |
| version: ${{ env.ZIG_VERSION }} | |
| - name: Install system dependencies | |
| shell: bash | |
| run: | | |
| echo "🔧 Installing system dependencies for ${{ runner.os }}..." | |
| case "${{ runner.os }}" in | |
| Linux) | |
| sudo apt-get update -qq | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| clang \ | |
| libc++-dev \ | |
| libc++abi-dev \ | |
| libboost-all-dev \ | |
| libssl-dev \ | |
| pkg-config \ | |
| git | |
| echo "✅ Linux dependencies installed" | |
| ;; | |
| macOS) | |
| brew update | |
| brew install boost openssl cmake | |
| echo "✅ macOS dependencies installed" | |
| ;; | |
| Windows) | |
| choco install boost-msvc-14.3 cmake openssl | |
| echo "✅ Windows dependencies installed" | |
| ;; | |
| esac | |
| - name: Cache Zig artifacts | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/zig | |
| .zig-cache | |
| key: ${{ runner.os }}-zig-${{ env.ZIG_VERSION }}-${{ hashFiles('build.zig', 'build.zig.zon') }} | |
| restore-keys: | | |
| ${{ runner.os }}-zig-${{ env.ZIG_VERSION }}- | |
| - name: Build and test examples | |
| shell: bash | |
| run: | | |
| echo "🧪 Running unified test suite..." | |
| ./scripts/test-all.sh -q all | |
| comprehensive-tests: | |
| name: Comprehensive Feature Tests | |
| runs-on: ${{ matrix.os }} | |
| needs: [lint, test] | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] # windows-latest commented out until Boost issues resolved | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Zig | |
| uses: goto-bus-stop/setup-zig@v2 | |
| with: | |
| version: ${{ env.ZIG_VERSION }} | |
| - name: Install system dependencies | |
| shell: bash | |
| run: | | |
| echo "🔧 Installing system dependencies for ${{ runner.os }}..." | |
| case "${{ runner.os }}" in | |
| Linux) | |
| sudo apt-get update -qq | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| clang \ | |
| libc++-dev \ | |
| libc++abi-dev \ | |
| libboost-all-dev \ | |
| libssl-dev \ | |
| pkg-config \ | |
| git | |
| echo "✅ Linux dependencies installed" | |
| ;; | |
| macOS) | |
| brew update | |
| brew install boost openssl cmake | |
| echo "✅ macOS dependencies installed" | |
| ;; | |
| # Windows) | |
| # # Install basic dependencies | |
| # choco install cmake openssl | |
| # # Install Boost via vcpkg for better CMake integration | |
| # vcpkg install boost-system boost-filesystem boost-program-options --triplet x64-windows | |
| # echo "✅ Windows dependencies installed" | |
| # ;; | |
| esac | |
| - name: Cache Zig artifacts | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/zig | |
| .zig-cache | |
| key: ${{ runner.os }}-zig-${{ env.ZIG_VERSION }}-${{ hashFiles('build.zig', 'build.zig.zon') }} | |
| restore-keys: | | |
| ${{ runner.os }}-zig-${{ env.ZIG_VERSION }}- | |
| - name: Run comprehensive tests | |
| shell: bash | |
| run: | | |
| echo "🏗️ Running comprehensive tests..." | |
| ./scripts/test-all.sh struct enum core advanced | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: struct-test-results-${{ matrix.os }} | |
| path: test-results/ | |
| retention-days: 30 | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: success() | |
| with: | |
| name: ora-compiler-${{ runner.os }} | |
| path: | | |
| zig-out/bin/ | |
| zig-out/lib/ | |
| retention-days: 7 | |
| security: | |
| name: Security Scan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Run security scan | |
| shell: bash | |
| run: | | |
| echo "🔍 Running basic security scan..." | |
| # Basic security checks - more comprehensive scans in security.yml | |
| - name: Check for security issues | |
| shell: bash | |
| run: | | |
| echo "🔒 Running security checks..." | |
| # Check for common security patterns | |
| echo "🔍 Checking for unsafe patterns..." | |
| if grep -r "unsafe" src/ 2>/dev/null; then | |
| echo "⚠️ Found unsafe code patterns" | |
| else | |
| echo "✅ No unsafe patterns found" | |
| fi | |
| # Check for TODO/FIXME security notes | |
| echo "🔍 Checking for security TODOs..." | |
| if grep -r -i "todo.*security\|fixme.*security" src/ 2>/dev/null; then | |
| echo "⚠️ Found security-related TODOs" | |
| else | |
| echo "✅ No security TODOs found" | |
| fi | |
| echo "✅ Security scan completed" | |
| performance: | |
| name: Performance Benchmarks | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'performance') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Zig | |
| uses: goto-bus-stop/setup-zig@v2 | |
| with: | |
| version: ${{ env.ZIG_VERSION }} | |
| - name: Install system dependencies | |
| shell: bash | |
| run: | | |
| echo "🔧 Installing system dependencies for ${{ runner.os }}..." | |
| case "${{ runner.os }}" in | |
| Linux) | |
| sudo apt-get update -qq | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| clang \ | |
| libc++-dev \ | |
| libc++abi-dev \ | |
| libboost-all-dev \ | |
| libssl-dev \ | |
| pkg-config \ | |
| git | |
| echo "✅ Linux dependencies installed" | |
| ;; | |
| macOS) | |
| brew update | |
| brew install boost openssl cmake | |
| echo "✅ macOS dependencies installed" | |
| ;; | |
| Windows) | |
| choco install boost-msvc-14.3 cmake openssl | |
| echo "✅ Windows dependencies installed" | |
| ;; | |
| esac | |
| - name: Cache Zig artifacts | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/zig | |
| .zig-cache | |
| key: ${{ runner.os }}-zig-${{ env.ZIG_VERSION }}-${{ hashFiles('build.zig', 'build.zig.zon') }} | |
| restore-keys: | | |
| ${{ runner.os }}-zig-${{ env.ZIG_VERSION }}- | |
| - name: Build with optimizations | |
| shell: bash | |
| run: | | |
| echo "🚀 Building optimized version..." | |
| zig build -Doptimize=ReleaseFast | |
| - name: Run performance tests | |
| shell: bash | |
| run: | | |
| echo "⚡ Running performance benchmarks..." | |
| # Time compilation of test files | |
| if [ -f "zig-out/bin/ora" ]; then | |
| echo "📊 Timing compilation performance..." | |
| time ./zig-out/bin/ora --version 2>/dev/null || echo "⚠️ Compiler version check failed" | |
| fi | |
| # Memory usage tests | |
| echo "💾 Checking memory usage..." | |
| /usr/bin/time -v zig build 2>&1 | grep -E "(Maximum resident set size|User time|System time)" || echo "⚠️ Memory profiling failed" | |
| echo "✅ Performance benchmarks completed" | |
| release: | |
| name: Release Check | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| needs: [lint, test, examples, comprehensive-tests, security] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Zig | |
| uses: goto-bus-stop/setup-zig@v2 | |
| with: | |
| version: ${{ env.ZIG_VERSION }} | |
| - name: Install system dependencies | |
| shell: bash | |
| run: | | |
| echo "🔧 Installing system dependencies for ${{ runner.os }}..." | |
| case "${{ runner.os }}" in | |
| Linux) | |
| sudo apt-get update -qq | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| clang \ | |
| libc++-dev \ | |
| libc++abi-dev \ | |
| libboost-all-dev \ | |
| libssl-dev \ | |
| pkg-config \ | |
| git | |
| echo "✅ Linux dependencies installed" | |
| ;; | |
| macOS) | |
| brew update | |
| brew install boost openssl cmake | |
| echo "✅ macOS dependencies installed" | |
| ;; | |
| Windows) | |
| choco install boost-msvc-14.3 cmake openssl | |
| echo "✅ Windows dependencies installed" | |
| ;; | |
| esac | |
| - name: Build release version | |
| shell: bash | |
| run: | | |
| echo "🎯 Building release version..." | |
| zig build -Doptimize=ReleaseFast -Dtarget=x86_64-linux | |
| # macOS Intel build removed; keep Linux and other targets as needed | |
| zig build -Doptimize=ReleaseFast -Dtarget=x86_64-windows | |
| echo "✅ Release builds completed" | |
| - name: Create release summary | |
| shell: bash | |
| run: | | |
| echo "📋 Release Summary:" > release-summary.md | |
| echo "- Commit: ${{ github.sha }}" >> release-summary.md | |
| echo "- Date: $(date)" >> release-summary.md | |
| echo "- Tests: ✅ Passed" >> release-summary.md | |
| echo "- Examples: ✅ Built" >> release-summary.md | |
| echo "- Security: ✅ Scanned" >> release-summary.md | |
| echo "📋 Release summary created" | |
| cat release-summary.md | |
| - name: Upload release artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ora-release-${{ github.sha }} | |
| path: | | |
| zig-out/ | |
| release-summary.md | |
| retention-days: 30 | |
| notification: | |
| name: Notification | |
| runs-on: ubuntu-latest | |
| if: always() | |
| needs: [lint, test, examples, comprehensive-tests, security] | |
| steps: | |
| - name: Notify on success | |
| if: needs.lint.result == 'success' && needs.test.result == 'success' && needs.examples.result == 'success' && needs.comprehensive-tests.result == 'success' | |
| run: | | |
| echo "✅ 🎉 All CI checks passed successfully!" | |
| echo "📊 Results:" | |
| echo " - Lint: ✅" | |
| echo " - Test: ✅" | |
| echo " - Examples: ✅" | |
| echo " - Security: ✅" | |
| - name: Notify on failure | |
| if: needs.lint.result == 'failure' || needs.test.result == 'failure' || needs.examples.result == 'failure' | |
| run: | | |
| echo "❌ Some CI checks failed" | |
| echo "📊 Results:" | |
| echo " - Lint: ${{ needs.lint.result }}" | |
| echo " - Test: ${{ needs.test.result }}" | |
| echo " - Examples: ${{ needs.examples.result }}" | |
| echo " - Security: ${{ needs.security.result }}" |