Skip to content

Commit b66d694

Browse files
authored
Tweak Ci proof-runner workflow (#51)
Various changes to make the proof-running workflow work better: * using self-hosted (normal linux) runners * configurable timeout (default 2h) * no default p-token image hash, selected from the submodule instead [This is a successful run of this workflow](https://github.com/runtimeverification/solana-token/actions/runs/18514089881) using two (short) proofs. [Here is another run (still in progress at the time of writing)](https://github.com/runtimeverification/solana-token/actions/runs/18517637649).
1 parent 08c4add commit b66d694

File tree

1 file changed

+48
-15
lines changed

1 file changed

+48
-15
lines changed

.github/workflows/rv-run-proofs.yaml

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,22 @@ on:
77
description: Start symbols for proofs to run
88
required: true
99
type: string
10-
default: "['test_ptoken_domain_data', 'this_will_fail']"
10+
default: "['test_ptoken_domain_data', 'test_process_approve', 'test_process_get_account_data_size', 'test_process_initialize_immutable_owner']"
1111
kmir:
1212
description: KMIR to work with (must exist as a docker image tag, optional)
1313
required: false
1414
type: string
15-
default: p-token-f8c403f # hard-wired now, retrieve from submodule later
15+
default: # empty = retrieve from submodule (later)
1616
smir:
1717
description: Stable MIR JSON to work with (commit hash, optional)
1818
required: false
1919
type: string
2020
default: # empty = master
21+
timeout:
22+
description: Timeout for running the proofs
23+
required: false
24+
type: string
25+
default: 7200 # 2h
2126
concurrency:
2227
group: ${{ github.workflow }}-${{ github.ref }}
2328
cancel-in-progress: true
@@ -44,7 +49,7 @@ jobs:
4449
with:
4550
flakes: github:runtimeverification/stable-mir-json/${{ inputs.smir }}
4651

47-
- name: "Build with stable_mir_json"
52+
- name: "Build with stable_mir_json"
4853
run: |
4954
cd p-token
5055
RUSTC=stable_mir_json cargo build --features runtime-verification
@@ -62,21 +67,35 @@ jobs:
6267
runs-on: ubuntu-latest
6368
outputs:
6469
proofs: ${{ steps.split.outputs.matrix }}
70+
kmir: ${{ steps.kmir.outputs.kmir }}
6571
steps:
72+
- name: "Git Checkout"
73+
uses: actions/checkout@v4
74+
6675
- name: "Create Proof Array"
6776
id: split
6877
run: |
6978
echo "proofs = '${{ inputs.proofs }}'"
7079
echo "matrix=${{ inputs.proofs }}" >> $GITHUB_OUTPUT
80+
- name: "Set KMIR version"
81+
id: kmir
82+
run: |
83+
if [ ! -z "${{ inputs.kmir }}" ]; then
84+
echo "KMIR version set to ${{ inputs.kmir }}"
85+
kmir=${{ inputs.kmir }}
86+
else
87+
kmir=p-token-$(git rev-parse --short $(git ls-tree HEAD p-token/test-properties/mir-semantics/ | awk '{print $3}'))
88+
fi
89+
echo "kmir=$kmir" >> $GITHUB_OUTPUT
7190
7291
run_proof:
7392
name: "Link SMIR and Run Proofs"
74-
needs:
93+
needs:
7594
- compile
7695
- prepare_matrix
77-
runs-on: ubuntu-latest
96+
runs-on: [self-hosted, linux, normal]
7897
# container:
79-
# image: runtimeverificationinc/kmir:${{ inputs.kmir }}
98+
# image: runtimeverificationinc/kmir:${{ needs.prepare_matrix.outputs.kmir }}
8099
strategy:
81100
matrix:
82101
proof: ${{ fromJSON(needs.prepare_matrix.outputs.proofs) }}
@@ -86,17 +105,19 @@ jobs:
86105
- name: debug matrix and docker image
87106
run: |
88107
echo "This is proof ${{ matrix.proof }}"
89-
echo "Running with $KMIR_CONTAINER_NAME, docker image runtimeverificationinc/kmir:${{ inputs.kmir }}"
108+
echo "Running with $KMIR_CONTAINER_NAME, docker image runtimeverificationinc/kmir:${{ needs.prepare_matrix.outputs.kmir }}"
90109
91110
- name: "Set up Docker Host"
92111
run: |
93112
mkdir -p $PWD/artefacts
94-
chmod a+rwx $PWD/artefacts
113+
ls -l $PWD/artefacts && rm -rf $PWD/artefacts/*
114+
chmod a+rwx $PWD/artefacts $PWD
95115
docker run --rm --detach \
116+
-u $(id -u):$(id -g) \
96117
-v $PWD:/workdir --workdir /workdir \
97118
--name "${KMIR_CONTAINER_NAME}" \
98-
runtimeverificationinc/kmir:${{ inputs.kmir }} \
99-
sleep 3600
119+
runtimeverificationinc/kmir:${{ needs.prepare_matrix.outputs.kmir }} \
120+
bash -c 'while true; do sleep 600; done'
100121
sleep 10
101122
102123
- name: "Get SMIR Files"
@@ -112,22 +133,29 @@ jobs:
112133
113134
- name: "Run Proof ${{ matrix.proof }} and store resulting tree"
114135
run: |
115-
timeout 3600 \
116-
docker exec --workdir /workdir "${KMIR_CONTAINER_NAME}" \
136+
docker exec --workdir /workdir "${KMIR_CONTAINER_NAME}" \
137+
bash -c "ls -la artefacts; mkdir -p artefacts/proof; ls -la artefacts"
138+
timeout ${{ inputs.timeout }} \
139+
docker exec \
140+
--workdir /workdir "${KMIR_CONTAINER_NAME}" \
117141
kmir prove-rs --smir artefacts/p-token.smir.json \
118142
--start-symbol 'pinocchio_token_program::entrypoint::${{ matrix.proof }}' \
119143
--verbose \
144+
--max-depth 500 \
120145
--max-iterations 100 \
121-
--proof-dir artefacts/proof
146+
--proof-dir artefacts/proof \
147+
|| echo "Runner signals proof failure"
148+
122149
docker exec --workdir /workdir "${KMIR_CONTAINER_NAME}" \
123-
kmir show --full-printer --proof-dir artefacts/proof \
150+
kmir show --statistics --leaves --proof-dir artefacts/proof \
124151
'p-token.smir.pinocchio_token_program::entrypoint::${{ matrix.proof }}' \
125152
> artefacts/proof/${{ matrix.proof }}-full.txt
126153
127154
- name: "Save proof tree and smir"
155+
if: always()
128156
uses: actions/upload-artifact@v4
129157
with:
130-
name: $artefacts-{{ matrix.proof }}
158+
name: artefacts-${{ matrix.proof }}
131159
path: |
132160
artefacts/p-token.smir.json
133161
artefacts/proof/*-full.txt
@@ -138,3 +166,8 @@ jobs:
138166
docker stop ${KMIR_CONTAINER_NAME}
139167
sleep 5
140168
docker rm -f ${KMIR_CONTAINER_NAME}
169+
170+
- name: "Clean up artefacts directory"
171+
if: always()
172+
run: |
173+
rm -rf $PWD/artefacts

0 commit comments

Comments
 (0)