test: harden chain pattern assertions and boundary contracts #36
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: ClawZero CI | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| security-events: write # For SARIF upload | |
| jobs: | |
| test: | |
| name: Test Suite | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Lint with ruff | |
| run: ruff check src/ tests/ | |
| - name: Type check with mypy | |
| run: mypy src/clawzero/ --ignore-missing-imports | |
| - name: Run unit tests | |
| run: pytest tests/ -v --tb=short -x | |
| - name: Run attack pack (50 vectors) | |
| run: pytest tests/attack_pack/ -v --tb=short | |
| attack-pack: | |
| name: Attack Pack Validation | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Run full attack pack with witness generation | |
| run: | | |
| mkdir -p witnesses | |
| pytest tests/attack_pack/ -v --tb=long 2>&1 | tee attack_pack_results.txt | |
| - name: Generate SARIF report | |
| if: always() | |
| run: | | |
| clawzero report sarif --input ./witnesses --output clawzero-scan.sarif || true | |
| if [ ! -f clawzero-scan.sarif ]; then | |
| printf '%s\n' '{"$schema":"https://json.schemastore.org/sarif-2.1.0.json","version":"2.1.0","runs":[{"tool":{"driver":{"name":"clawzero","version":"0.2.1","informationUri":"https://github.com/mvar-security/clawzero","rules":[]}},"results":[]}]}' > clawzero-scan.sarif | |
| fi | |
| - name: Upload SARIF to GitHub Security | |
| if: always() | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: clawzero-scan.sarif | |
| continue-on-error: true | |
| - name: Upload attack pack results | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: attack-pack-results | |
| path: | | |
| attack_pack_results.txt | |
| witnesses/ | |
| benchmark: | |
| name: Benchmark | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Run benchmark | |
| run: | | |
| python -m clawzero.benchmark --iterations 1000 --output benchmark_results.json || true | |
| - name: Upload benchmark results | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: benchmark-results | |
| path: benchmark_results.json | |
| continue-on-error: true |