Repository navigation
143 lines (126 loc) · 6.72 KB
/
Copy pathzk-exact-evaluator.yml
File metadata and controls
143 lines (126 loc) · 6.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# zkp-10.1: detached guest compilation and genuine local proofs.
name: zk-exact-evaluator
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
merge_group:
types: [checks_requested]
push:
branches: [main]
permissions:
contents: read
concurrency:
group: zk-exact-evaluator-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_BUILD_JOBS: 2
# Share the guest cache across host test and Clippy build-script variants.
CARGO_TARGET_DIR: ${{ github.workspace }}/zk/sparql-evaluator/target
RISC0_BUILD_LOCKED: 1
jobs:
exact-evaluator:
name: real exact-dataset guest and proof
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
# Two commits: a pull_request checkout is GitHub's test merge, whose
# first parent is the base tip it merged into.
fetch-depth: 2
- name: Resolve pull request merge parent
id: merge_parent
if: github.event_name == 'pull_request'
# Diff the test merge against its first parent: exactly the PR's change on
# the current base. The stale base.sha diff also counted every base commit
# the head lacked. Anything but a two-parent merge at github.sha leaves this
# empty, so classification falls back to base.sha (still fail closed).
env:
MERGE_SHA: ${{ github.sha }}
run: |
set -euo pipefail
parents=$(git rev-list --parents -n 1 HEAD)
read -r commit first second extra <<< "$parents" || true
if [ "$commit" = "$MERGE_SHA" ] && [ -n "${second:-}" ] && [ -z "${extra:-}" ]; then
echo "sha=$first" >> "$GITHUB_OUTPUT"
fi
- name: Classify exact-evaluator inputs (fail closed)
id: changes
env:
EXACT_BASE_SHA: ${{ steps.merge_parent.outputs.sha || github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}
EXACT_HEAD_SHA: ${{ steps.merge_parent.outputs.sha && github.sha || github.event.pull_request.head.sha || github.event.merge_group.head_sha || github.sha }}
run: python3 scripts/ci_exact_evaluator_paths.py
- name: Require explicit classification output
env:
EXECUTION_REQUIRED: ${{ steps.changes.outputs.required }}
run: |
case "$EXECUTION_REQUIRED" in
true|false) ;;
*) echo "Missing or invalid exact-evaluator classification" >&2; exit 1 ;;
esac
- name: Successful irrelevant-diff classification
if: steps.changes.outputs.required == 'false'
run: echo "No exact-evaluator inputs changed; the mandatory check remains successful."
- name: Install checksum-pinned RISC Zero binaries and guest Rust
if: steps.changes.outputs.required == 'true'
# Official release-asset SHA256 digests, pinned with the exact SDK version.
run: |
set -euo pipefail
tool_root="$RUNNER_TEMP/sparq-risc0-3.0.6"
mkdir -p "$tool_root/bin" "$tool_root/home/toolchains/v1.97.0-rust-x86_64-unknown-linux-gnu"
curl --fail --location --retry 3 https://github.com/risc0/risc0/releases/download/v3.0.6/cargo-risczero-x86_64-unknown-linux-gnu.tgz -o "$tool_root/cli.tgz"
curl --fail --location --retry 3 https://github.com/risc0/rust/releases/download/r0.1.97.0/rust-toolchain-x86_64-unknown-linux-gnu.tar.gz -o "$tool_root/rust.tar.gz"
echo "615d961bfb81d318db5071d7548389c850e324ac7f421c075176daf26082a60a $tool_root/cli.tgz" | sha256sum --check --strict
echo "100b597d605b706bec94e1d32bfaaf5851df8d75173f986d4b56a3e90916be53 $tool_root/rust.tar.gz" | sha256sum --check --strict
tar -xzf "$tool_root/cli.tgz" -C "$tool_root/bin"
tar -xzf "$tool_root/rust.tar.gz" -C "$tool_root/home/toolchains/v1.97.0-rust-x86_64-unknown-linux-gnu"
printf '[default_versions]\nrust = "1.97.0"\n' > "$tool_root/home/settings.toml"
"$tool_root/bin/r0vm" --version
echo "$tool_root/bin" >> "$GITHUB_PATH"
echo "RISC0_HOME=$tool_root/home" >> "$GITHUB_ENV"
echo "RISC0_SERVER_PATH=$tool_root/bin/r0vm" >> "$GITHUB_ENV"
- name: Activate pinned host Rust
if: steps.changes.outputs.required == 'true'
run: |
rustup show active-toolchain
rustup component add clippy
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
if: steps.changes.outputs.required == 'true'
with:
key: zk-exact-evaluator-risc0-3.0.6-rust-1.97.0
workspaces: zk/sparql-evaluator
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Evidence export guard regressions
if: steps.changes.outputs.required == 'true'
run: |
python3 -m unittest discover -s scripts/tests -p 'test_ci_exact_evaluator_*.py'
python3 -m unittest discover -s bench/zk-bindings -p 'test_*.py'
- name: Exact experiment native contract and rejection-class regressions
if: steps.changes.outputs.required == 'true'
# Native fixture/adapter tests; this step generates no receipt.
run: cargo test --locked --manifest-path zk/sparql-evaluator/Cargo.toml -p sparq-proved-evaluator --example exact_experiment
- name: Export source-bound actual guest and genuine proof evidence
if: steps.changes.outputs.required == 'true'
# Executes native regressions, every real guest/proof test, and Clippy.
# Local path packages are rebuilt; the same exported program must verify
# every persisted synthetic receipt. Missing provenance fails the job.
run: python3 scripts/ci_exact_evaluator_evidence.py --output "$RUNNER_TEMP/sparq-exact-evidence"
- name: Required original-fixture typed replay for all evaluator versions
if: steps.changes.outputs.required == 'true'
timeout-minutes: 15
# Every declared original case and both authority contexts must execute.
# This native lane counts zero proofs; the real campaign above remains required.
run: python3 bench/zk-bindings/exact_ci.py --output "$RUNNER_TEMP/sparq-exact-originals"
- name: Upload exact artifact and campaign evidence
if: always() && steps.changes.outputs.required == 'true'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: exact-evaluator-${{ github.sha }}-${{ github.run_attempt }}
path: |
${{ runner.temp }}/sparq-exact-evidence
${{ runner.temp }}/sparq-exact-originals
if-no-files-found: error
retention-days: 30