Repository navigation
feat: add pt-snap-helper skill and agent help epilog #239
Workflow file for this run
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: Test | |
| on: | |
| workflow_call: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| types: [opened, synchronize, reopened, edited] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: test-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| snapshot-provenance: | |
| name: Snapshot provenance | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Require provenance evaluation for snapshot runtime changes | |
| if: github.event_name == 'pull_request' | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| PR_BODY: ${{ github.event.pull_request.body }} | |
| run: >- | |
| python .github/scripts/check_snapshot_provenance.py | |
| --base "$BASE_SHA" --head "$HEAD_SHA" --require-decision | |
| - name: Enforce append-only provenance outside pull requests | |
| if: github.event_name != 'pull_request' | |
| env: | |
| BEFORE_SHA: ${{ github.event.before }} | |
| HEAD_SHA: ${{ github.sha }} | |
| REF_TYPE: ${{ github.ref_type }} | |
| run: | | |
| if [ "$REF_TYPE" = "tag" ]; then | |
| BASE_SHA=$(git describe --tags --abbrev=0 "${HEAD_SHA}^" 2>/dev/null || git rev-list --max-parents=0 "$HEAD_SHA") | |
| else | |
| BASE_SHA="$BEFORE_SHA" | |
| if ! git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null; then | |
| BASE_SHA=$(git rev-list --max-parents=0 "$HEAD_SHA") | |
| fi | |
| fi | |
| python .github/scripts/check_snapshot_provenance.py --base "$BASE_SHA" --head "$HEAD_SHA" | |
| lint: | |
| name: Lint & Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Install dependencies | |
| run: pip install -e ".[dev]" | |
| - name: Ruff lint check | |
| run: ruff check . | |
| - name: Black format check | |
| run: black --check . | |
| - name: basedPyright check | |
| run: python -m basedpyright --pythonpath "$(python -c 'import sys; print(sys.executable)')" | |
| test: | |
| name: Test (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: pip-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| pip-${{ runner.os }}-${{ matrix.python-version }}- | |
| - name: Install dependencies | |
| run: pip install -e ".[dev]" | |
| - name: Run tests with coverage | |
| run: pytest tests/test_fixture_provenance.py && pytest --cov --cov-report=xml --cov-report=term-missing | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| if: matrix.python-version == '3.13' && always() | |
| with: | |
| name: coverage-report | |
| path: coverage.xml | |
| retention-days: 30 | |
| - name: Build wheel | |
| if: matrix.python-version == '3.13' | |
| run: | | |
| python -m pip install --upgrade build | |
| python -m build --wheel | |
| - name: Wheel smoke test (verify snapshot runtime is packaged) | |
| if: matrix.python-version == '3.13' | |
| run: | | |
| set -euo pipefail | |
| python -m pip install --force-reinstall dist/*.whl | |
| # Confirm the first-party runtime was actually packaged into the wheel. | |
| python -c "import pt_snap_cli.snapshot.tools.adaptors.snapshot2db as m; assert hasattr(m, 'run_dump_to_db'), 'snapshot run_dump_to_db missing in installed wheel'" | |
| # End-to-end import against a real fixture — catches any packaging | |
| # regression where setuptools drops src/pt_snap_cli/snapshot/. | |
| FIXTURE=tests/fixtures/snapshots/snapshot_with_empty_cache.pkl | |
| rm -rf /tmp/pt-snap-wheel-smoke | |
| mkdir -p /tmp/pt-snap-wheel-smoke | |
| DB=/tmp/pt-snap-wheel-smoke/snapshot_with_empty_cache.pkl.db | |
| pt-snap import "$FIXTURE" --no-focus --output-dir /tmp/pt-snap-wheel-smoke | |
| test -f "$DB" | |
| SECOND_IMPORT=$(pt-snap import "$FIXTURE" --no-focus --output-dir /tmp/pt-snap-wheel-smoke) | |
| echo "$SECOND_IMPORT" | grep -q '^Reused:' | |
| pt-snap metadata "$DB" --json | python -c "import json, sys; data=json.load(sys.stdin); assert data['status'] == 'available'" | |
| rm -rf /tmp/pt-snap-wheel-smoke |