noqt commited on
Commit
48057d5
·
unverified ·
1 Parent(s): e33c320

Continuously replay partner receipt action in CI (#52)

Browse files
.github/workflows/ci.yml CHANGED
@@ -45,6 +45,12 @@ jobs:
45
  - name: Install test tooling
46
  run: python -m pip install jsonschema==4.26.0 ruff==0.16.1 PyYAML==6.0.3
47
 
 
 
 
 
 
 
48
  - name: Lint
49
  if: matrix.python-version == '3.11'
50
  run: ruff check src tests scripts
 
45
  - name: Install test tooling
46
  run: python -m pip install jsonschema==4.26.0 ruff==0.16.1 PyYAML==6.0.3
47
 
48
+ - name: Replay the local hosted-proof receipt action
49
+ if: matrix.python-version == '3.11'
50
+ uses: ./actions/validate-hosted-proof-receipt
51
+ with:
52
+ receipt: schemas/examples/hosted-proof-receipt-v1-success.json
53
+
54
  - name: Lint
55
  if: matrix.python-version == '3.11'
56
  run: ruff check src tests scripts
tests/test_receipt_action.py CHANGED
@@ -7,6 +7,7 @@ import yaml
7
 
8
  ROOT = Path(__file__).resolve().parents[1]
9
  ACTION = ROOT / "actions" / "validate-hosted-proof-receipt" / "action.yml"
 
10
 
11
 
12
  class HostedProofReceiptActionTests(unittest.TestCase):
@@ -38,6 +39,29 @@ class HostedProofReceiptActionTests(unittest.TestCase):
38
  )
39
  self.assertNotIn("inputs.receipt", step["run"])
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  if __name__ == "__main__":
43
  unittest.main()
 
7
 
8
  ROOT = Path(__file__).resolve().parents[1]
9
  ACTION = ROOT / "actions" / "validate-hosted-proof-receipt" / "action.yml"
10
+ CI_WORKFLOW = ROOT / ".github" / "workflows" / "ci.yml"
11
 
12
 
13
  class HostedProofReceiptActionTests(unittest.TestCase):
 
39
  )
40
  self.assertNotIn("inputs.receipt", step["run"])
41
 
42
+ def test_ci_replays_the_local_action_with_the_public_success_shape(self) -> None:
43
+ workflow = yaml.safe_load(CI_WORKFLOW.read_text(encoding="utf-8"))
44
+ action_steps = [
45
+ step
46
+ for step in workflow["jobs"]["test-and-package"]["steps"]
47
+ if step.get("uses") == "./actions/validate-hosted-proof-receipt"
48
+ ]
49
+ self.assertEqual(
50
+ [
51
+ {
52
+ "name": "Replay the local hosted-proof receipt action",
53
+ "if": "matrix.python-version == '3.11'",
54
+ "uses": "./actions/validate-hosted-proof-receipt",
55
+ "with": {
56
+ "receipt": (
57
+ "schemas/examples/hosted-proof-receipt-v1-success.json"
58
+ )
59
+ },
60
+ }
61
+ ],
62
+ action_steps,
63
+ )
64
+
65
 
66
  if __name__ == "__main__":
67
  unittest.main()