Repository navigation
bd: backup 2026-03-03 13:41 #133
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 ] | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| - 'LICENSE' | |
| - '.gitignore' | |
| pull_request: | |
| branches: [ main, develop ] | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| - 'LICENSE' | |
| - '.gitignore' | |
| workflow_dispatch: | |
| jobs: | |
| build-and-test: | |
| name: Build and Test | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| zig-version: ['0.15.2'] | |
| # Windows removed: tree-sitter library not available on Windows platform | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Setup Zig | |
| uses: mlugg/setup-zig@v2 | |
| with: | |
| version: ${{ matrix.zig-version }} | |
| - name: Install tree-sitter | |
| shell: bash | |
| run: | | |
| if [ "$RUNNER_OS" == "Linux" ]; then | |
| # Build latest tree-sitter from source to ensure ABI compatibility | |
| # with our vendored language parsers (all built from source) | |
| cd /tmp | |
| git clone --depth 1 https://github.com/tree-sitter/tree-sitter.git | |
| cd tree-sitter | |
| make | |
| sudo make install | |
| sudo ldconfig | |
| elif [ "$RUNNER_OS" == "macOS" ]; then | |
| brew install tree-sitter | |
| fi | |
| - name: Cache Zig dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/zig | |
| .zig-cache | |
| zig-out | |
| key: ${{ runner.os }}-zig-${{ matrix.zig-version }}-ts-latest-${{ hashFiles('build.zig.zon', 'build.zig') }} | |
| restore-keys: | | |
| ${{ runner.os }}-zig-${{ matrix.zig-version }}-ts-latest- | |
| ${{ runner.os }}-zig- | |
| - name: Build (Debug) | |
| run: zig build -Doptimize=Debug | |
| - name: Build (ReleaseSafe) | |
| run: zig build -Doptimize=ReleaseSafe | |
| - name: Run tests | |
| run: zig build test | |
| - name: Check formatting | |
| run: zig fmt --check src/ | |
| - name: Build examples | |
| shell: bash | |
| run: | | |
| if [ -d "examples" ]; then | |
| echo "Building examples..." | |
| for dir in examples/*/; do | |
| if [ -d "$dir" ]; then | |
| echo "Building example: $(basename $dir)" | |
| # Examples are built as part of the main build system | |
| # Add specific example build commands here if needed | |
| fi | |
| done | |
| else | |
| echo "No examples directory found, skipping" | |
| fi | |
| - name: Upload build artifacts | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ananke-${{ runner.os }}-${{ matrix.zig-version }} | |
| path: | | |
| zig-out/bin/* | |
| !zig-out/**/*.o | |
| !zig-out/**/*.obj | |
| retention-days: 7 | |
| lint: | |
| name: Lint and Code Quality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Zig | |
| uses: mlugg/setup-zig@v2 | |
| with: | |
| version: '0.15.2' | |
| - name: Check formatting | |
| run: zig fmt --check . | |
| - name: Static analysis (ast-check) | |
| shell: bash | |
| run: | | |
| find src -name '*.zig' -type f -exec zig ast-check {} \; | |
| - name: Build with all warnings | |
| run: zig build -Doptimize=Debug 2>&1 | tee build.log | |
| continue-on-error: true | |
| - name: Check for common issues | |
| shell: bash | |
| run: | | |
| echo "Checking for TODO/FIXME comments..." | |
| if grep -r "TODO\|FIXME" src/ --color=always; then | |
| echo "Found TODO/FIXME items (informational only)" | |
| fi | |
| coverage: | |
| name: Test Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Setup Zig | |
| uses: mlugg/setup-zig@v2 | |
| with: | |
| version: '0.15.2' | |
| - name: Install tree-sitter | |
| shell: bash | |
| run: | | |
| # Build latest tree-sitter from source to ensure ABI compatibility | |
| # with our vendored language parsers (all built from source) | |
| cd /tmp | |
| git clone --depth 1 https://github.com/tree-sitter/tree-sitter.git | |
| cd tree-sitter | |
| make | |
| sudo make install | |
| sudo ldconfig | |
| - name: Run tests with coverage | |
| run: | | |
| zig build test | |
| # Note: Zig test coverage reporting is still evolving | |
| # Add coverage tools as they become available | |
| security: | |
| name: Security Scan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run security audit | |
| shell: bash | |
| run: | | |
| echo "Checking for hardcoded secrets..." | |
| if grep -r -i "password\|secret\|api_key\|token" src/ --color=always | grep -v "// " | grep -v "test"; then | |
| echo "::warning::Found potential hardcoded secrets" | |
| fi | |
| - name: Dependency audit | |
| shell: bash | |
| run: | | |
| echo "Auditing dependencies in build.zig.zon..." | |
| if [ -f "build.zig.zon" ]; then | |
| cat build.zig.zon | |
| fi | |
| # Extended Build Matrix | |
| # Note: Cross-compilation with system C libraries (tree-sitter) is not supported. | |
| # The main build-and-test job already covers: | |
| # - x86_64-linux (ubuntu-latest) | |
| # - aarch64-macos (macos-latest, Apple Silicon) | |
| # | |
| # Additional targets would require: | |
| # - x86_64-macos: Run on macos-13 (Intel) | |
| # - aarch64-linux: Self-hosted ARM runner or vendoring tree-sitter | |
| # | |
| # For now, we skip the extended matrix and rely on build-and-test for coverage. | |
| # Uncomment below to add x86_64-macos builds: | |
| # | |
| # build-matrix: | |
| # name: Extended Build Matrix (x86_64-macos) | |
| # needs: [build-and-test] | |
| # runs-on: macos-13 | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # with: | |
| # submodules: recursive | |
| # - uses: mlugg/setup-zig@v2 | |
| # with: | |
| # version: '0.15.2' | |
| # - run: brew install tree-sitter | |
| # - run: zig build -Doptimize=ReleaseSafe | |
| # - uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: ananke-x86_64-macos | |
| # path: zig-out/bin/* | |
| # retention-days: 7 | |
| integration: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: [build-and-test] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Zig | |
| uses: mlugg/setup-zig@v2 | |
| with: | |
| version: '0.15.2' | |
| - name: Install tree-sitter | |
| shell: bash | |
| run: | | |
| # Build latest tree-sitter from source to ensure ABI compatibility | |
| cd /tmp | |
| git clone --depth 1 https://github.com/tree-sitter/tree-sitter.git | |
| cd tree-sitter | |
| make | |
| sudo make install | |
| sudo ldconfig | |
| - name: Build release binary | |
| run: zig build -Doptimize=ReleaseSafe | |
| - name: Run integration tests | |
| shell: bash | |
| run: | | |
| # Add integration test commands here | |
| echo "Running integration tests..." | |
| if [ -x "zig-out/bin/ananke" ]; then | |
| ./zig-out/bin/ananke --help || true | |
| fi | |
| all-checks: | |
| name: All Checks Passed | |
| if: always() | |
| needs: [build-and-test, lint, coverage, security, integration] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check job results | |
| run: | | |
| if [[ "${{ needs.build-and-test.result }}" == "success" && \ | |
| "${{ needs.lint.result }}" == "success" && \ | |
| "${{ needs.coverage.result }}" == "success" && \ | |
| "${{ needs.security.result }}" == "success" && \ | |
| "${{ needs.integration.result }}" == "success" ]]; then | |
| echo "All checks passed!" | |
| exit 0 | |
| else | |
| echo "Some checks failed" | |
| exit 1 | |
| fi |