Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions .github/workflows/document-record-persistence-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Document Record Persistence Quality

on:
pull_request:
branches:
- develop
- feat/document-record-evidence
paths:
- "database/migrations/0021_document_record_persistence.sql"
- "tests/test_document_record_persistence_postgres.sh"
- "docs/adr/0107-document-record-persistence.md"
- "docs/traceability/document-record-persistence.md"
- "docs/doctoring/document-record-persistence-references.md"
- ".github/workflows/document-record-persistence-quality.yml"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: document-record-persistence-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
postgres_contract:
name: Governed document-record persistence contract
runs-on: ubuntu-latest
timeout-minutes: 10
services:
postgres:
image: postgres:16.14@sha256:33f923b05f64ca54ac4401c01126a6b92afe839a0aa0a52bc5aeb5cc958e5f20
env:
POSTGRES_USER: orgmetra
POSTGRES_PASSWORD: orgmetra
POSTGRES_DB: orgmetra
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U orgmetra -d orgmetra"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
DATABASE_URL: postgresql://orgmetra:orgmetra@localhost:5432/orgmetra
steps:
- name: Checkout exact candidate
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- name: Prove exact candidate checkout
env:
ORGMETRA_EXPECTED_HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: test "$(git rev-parse HEAD)" = "$ORGMETRA_EXPECTED_HEAD_SHA"
- name: Print deterministic persistence provenance
run: |
python - <<'PY'
import hashlib
import json
from pathlib import Path

required = [
"tests/test_document_record_persistence_postgres.sh",
".github/workflows/document-record-persistence-quality.yml",
]
optional = [
"database/migrations/0021_document_record_persistence.sql",
"docs/adr/0107-document-record-persistence.md",
"docs/traceability/document-record-persistence.md",
"docs/doctoring/document-record-persistence-references.md",
]
rows = []
for path_text in required + [path for path in optional if Path(path).is_file()]:
data = Path(path_text).read_bytes()
rows.append({
"path": path_text,
"sha256": hashlib.sha256(data).hexdigest(),
"bytes": len(data),
"lines": len(data.decode("utf-8").splitlines()),
})
print(json.dumps(rows, separators=(",", ":")))
PY
- name: Run document-record persistence regressions
run: bash tests/test_document_record_persistence_postgres.sh
- name: Require clean checkout
run: |
git diff --exit-code
test -z "$(git status --porcelain)"
Loading