feat: add real Bottle integration #6
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: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Compile package and scripts | |
| run: python -m compileall -q src tests skills integrations | |
| - name: Run tests | |
| run: make test | |
| - name: Install build backend | |
| if: matrix.python-version == '3.12' | |
| run: python -m pip install "setuptools>=68" | |
| - name: Build wheel | |
| if: matrix.python-version == '3.12' | |
| run: python -m pip wheel . --no-deps --no-build-isolation --wheel-dir dist | |
| shadow-validation: | |
| runs-on: ubuntu-latest | |
| env: | |
| PATCHPROOF_IMAGE: python:3.12.10-slim@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: "3.12" | |
| - name: Pull pinned validation image | |
| run: docker pull "$PATCHPROOF_IMAGE" | |
| - name: Run the real four-phase proof loop | |
| run: | | |
| run_dir="$(mktemp -d)" | |
| PYTHONPATH=src python -m patchproof propose \ | |
| --repo fixtures/calculator \ | |
| --diff fixtures/division-by-zero.diff \ | |
| --out "$run_dir/proposal.json" | |
| proposal_hash="$(python -c 'import json,sys; print(json.load(open(sys.argv[1]))["proposal_hash"])' "$run_dir/proposal.json")" | |
| PYTHONPATH=src python -m patchproof approve \ | |
| --proposal "$run_dir/proposal.json" \ | |
| --proposal-hash "$proposal_hash" \ | |
| --run-id ci-shadow \ | |
| --approved-by github-actions \ | |
| --out "$run_dir/approval.json" | |
| PYTHONPATH=src python -m patchproof validate \ | |
| --repo fixtures/calculator \ | |
| --proposal "$run_dir/proposal.json" \ | |
| --approval "$run_dir/approval.json" \ | |
| --reproduction-tests fixtures/reproduction \ | |
| --hidden-tests fixtures/hidden \ | |
| --audit-dir /tmp/patchproof-audit \ | |
| --docker-image "$PATCHPROOF_IMAGE" \ | |
| > "$run_dir/result.json" | |
| python -c 'import json,sys; result=json.load(open(sys.argv[1])); assert result["proof_grade"] is True' "$run_dir/result.json" | |
| - name: Upload proof artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: patchproof-shadow-validation | |
| path: /tmp/patchproof-audit/ | |
| if-no-files-found: error | |
| retention-days: 14 | |
| bottle-integration: | |
| runs-on: ubuntu-latest | |
| env: | |
| PATCHPROOF_IMAGE: python:3.12.10-slim@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Check out pinned Bottle pre-fix commit | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| repository: bottlepy/bottle | |
| ref: 2a743a302a71460bfe4c0b8b7cb99a306b0328c6 | |
| path: external/bottle | |
| persist-credentials: false | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: "3.12" | |
| - name: Pull pinned validation image | |
| run: docker pull "$PATCHPROOF_IMAGE" | |
| - name: Validate the real upstream Bottle fix | |
| run: | | |
| PYTHONPATH=src python integrations/bottle-http-preconditions/run_case.py \ | |
| --repo external/bottle \ | |
| --audit-dir /tmp/patchproof-bottle-audit \ | |
| --docker-image "$PATCHPROOF_IMAGE" \ | |
| > /tmp/patchproof-bottle-result.json | |
| python -c 'import json; result=json.load(open("/tmp/patchproof-bottle-result.json")); assert result["proof_grade"] is True; assert result["repository_unchanged"] is True; assert result["phases"][2]["tests_run"] == 359' | |
| - name: Upload Bottle proof artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: patchproof-bottle-integration | |
| path: /tmp/patchproof-bottle-audit/ | |
| if-no-files-found: error | |
| retention-days: 14 |