11# Automated checkpoint updates.
22#
3- # Triggered when the weekly integration tests complete successfully .
3+ # Triggered whenever the integration tests complete; requires both checkpoint artifacts .
44# Downloads checkpoint artifacts produced by generate-checkpoints-* jobs,
55# appends new entries to the checkpoint files, validates them, and opens a PR.
66#
1515 types : [completed]
1616 branches : [main]
1717
18- # Manual trigger for testing; resolves the latest successful integration test run automatically
18+ # Manual trigger for testing; resolves the latest completed integration test run automatically
1919 workflow_dispatch :
2020
2121permissions : {}
2424 update-checkpoints :
2525 name : Update checkpoint files
2626 runs-on : ubuntu-latest
27- if : >-
28- github.event_name == 'workflow_dispatch' ||
29- github.event.workflow_run.conclusion == 'success'
3027 permissions :
3128 actions : read
3229 contents : read
5148
5249 # Resolve the integration test run ID.
5350 # For workflow_run: use the triggering run directly.
54- # For workflow_dispatch: find the latest successful run via the API.
51+ # For workflow_dispatch: find the latest completed run via the API.
5552 - name : Resolve integration test run ID
5653 id : resolve-run
5754 env :
@@ -68,15 +65,15 @@ jobs:
6865 RUN_ID=$(gh run list \
6966 --workflow "Integration Tests on GCP" \
7067 --branch main \
71- --status success \
68+ --status completed \
7269 --limit 1 \
7370 --json databaseId \
7471 --jq '.[0].databaseId')
7572 RUN_URL="https://github.com/${REPO}/actions/runs/${RUN_ID}"
7673 fi
7774
7875 if [ -z "$RUN_ID" ]; then
79- echo "No successful integration test run found"
76+ echo "No completed integration test run found"
8077 exit 1
8178 fi
8279
@@ -86,60 +83,33 @@ jobs:
8683
8784 # Download checkpoint artifacts from the integration test run.
8885 - name : Download mainnet checkpoint artifact
89- id : mainnet-artifact
9086 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
9187 with :
9288 name : generate-checkpoints-mainnet-checkpoints
9389 run-id : ${{ steps.resolve-run.outputs.run_id }}
9490 github-token : ${{ secrets.GITHUB_TOKEN }}
95- continue-on-error : true
9691
9792 - name : Download testnet checkpoint artifact
98- id : testnet-artifact
9993 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
10094 with :
10195 name : generate-checkpoints-testnet-checkpoints
10296 run-id : ${{ steps.resolve-run.outputs.run_id }}
10397 github-token : ${{ secrets.GITHUB_TOKEN }}
104- continue-on-error : true
10598
106- # The generate-checkpoints-* jobs are skipped when no tip disk exists
107- # (e.g., full sync still in progress) or when the workflow runs in
108- # regenerate/sync-only mode. When skipped, no artifact is produced.
109- - name : Check if any artifacts were downloaded
110- id : check-artifacts
99+ - name : Verify required checkpoint artifacts
111100 run : |
112- HAS_MAINNET="false"
113- HAS_TESTNET="false"
114-
115- # Artifact files use the same names as the repo files (new entries only)
116- if [ -f "main-checkpoints.txt" ]; then
117- LINES=$(wc -l < main-checkpoints.txt | tr -d ' ')
118- echo "Mainnet artifact: ${LINES} checkpoint lines"
119- HAS_MAINNET="true"
120- fi
121-
122- if [ -f "test-checkpoints.txt" ]; then
123- LINES=$(wc -l < test-checkpoints.txt | tr -d ' ')
124- echo "Testnet artifact: ${LINES} checkpoint lines"
125- HAS_TESTNET="true"
126- fi
127-
128- if [ "$HAS_MAINNET" = "false" ] && [ "$HAS_TESTNET" = "false" ]; then
129- echo "No checkpoint artifacts found, skipping update"
130- echo "has_updates=false" >> "$GITHUB_OUTPUT"
131- exit 0
132- fi
101+ for artifact in main-checkpoints.txt test-checkpoints.txt; do
102+ if [ ! -f "$artifact" ]; then
103+ echo "::error::Required checkpoint artifact file is missing: ${artifact}"
104+ exit 1
105+ fi
133106
134- {
135- echo "has_mainnet=${HAS_MAINNET}"
136- echo "has_testnet=${HAS_TESTNET}"
137- echo "has_updates=true"
138- } >> "$GITHUB_OUTPUT"
107+ LINES=$(wc -l < "$artifact" | tr -d ' ')
108+ echo "${artifact}: ${LINES} checkpoint lines"
109+ done
139110
140111 # Append new mainnet checkpoints (entries with heights higher than current last)
141112 - name : Append new mainnet checkpoints
142- if : steps.check-artifacts.outputs.has_mainnet == 'true'
143113 run : |
144114 CURRENT_LAST=$(tail -1 "${MAINNET_CHECKPOINTS}" | awk '{print $1}')
145115 echo "Current last mainnet checkpoint: ${CURRENT_LAST}"
@@ -156,7 +126,6 @@ jobs:
156126
157127 # Append new testnet checkpoints
158128 - name : Append new testnet checkpoints
159- if : steps.check-artifacts.outputs.has_testnet == 'true'
160129 run : |
161130 CURRENT_LAST=$(tail -1 "${TESTNET_CHECKPOINTS}" | awk '{print $1}')
162131 echo "Current last testnet checkpoint: ${CURRENT_LAST}"
@@ -172,15 +141,13 @@ jobs:
172141
173142 # Validate the updated checkpoint files
174143 - name : Validate checkpoint files
175- if : steps.check-artifacts.outputs.has_updates == 'true'
176144 run : |
177145 .github/scripts/validate-checkpoints.sh "${MAINNET_CHECKPOINTS}"
178146 .github/scripts/validate-checkpoints.sh "${TESTNET_CHECKPOINTS}"
179147
180148 # Check if there are actual changes to commit
181149 - name : Check for changes
182150 id : changes
183- if : steps.check-artifacts.outputs.has_updates == 'true'
184151 run : |
185152 if git diff --quiet; then
186153 echo "No changes to commit"
@@ -203,7 +170,7 @@ jobs:
203170 zebra-chain/src/parameters/checkpoint/test-checkpoints.txt
204171 title : " chore(chain): update checkpoints"
205172 body : |
206- Automated checkpoint update from the weekly integration test run.
173+ Automated checkpoint update from the integration test run.
207174
208175 **Source:** [Integration test run #${{ steps.resolve-run.outputs.run_id }}](${{ steps.resolve-run.outputs.run_url }})
209176
0 commit comments