Rust Seed Synchronization Check #2134
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Rust Seed Synchronization Check | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 */3 * * *" # Every 3 Hours | |
| concurrency: | |
| group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" | |
| cancel-in-progress: true | |
| jobs: | |
| parse-mainnet-seed-list: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| seeds: ${{ steps.parse-mainnet-seed-list.outputs.seeds }} | |
| steps: | |
| - name: 📥 Checkout | |
| uses: actions/checkout@v4.2.2 | |
| - name: Parse Mainnet Seed List | |
| id: parse-mainnet-seed-list | |
| run: | | |
| echo "Parsing Mainnet Seed List" | |
| seeds=$(cat networks/devnet-webrtc.txt | jq -R -s -c 'split("\n") | map(select(. != ""))') | |
| echo "seeds=$seeds" >> $GITHUB_OUTPUT | |
| test-peer: | |
| needs: parse-mainnet-seed-list | |
| runs-on: o1labs-github-arc-runner-openmina | |
| container: | |
| image: o1labs/mina-rust:v0.17.0 | |
| if: needs.parse-mainnet-seed-list.outputs.seeds != '[]' && needs.parse-mainnet-seed-list.outputs.seeds != '' | |
| continue-on-error: true | |
| strategy: | |
| max-parallel: 2 | |
| matrix: | |
| seed: ${{ fromJson(needs.parse-mainnet-seed-list.outputs.seeds) }} | |
| steps: | |
| - name: 📥 Checkout | |
| uses: actions/checkout@v4.2.2 | |
| - name: Start Mina Daemon | |
| run: | | |
| echo "Starting Mina Daemon" | |
| ./scripts/start-mina-rust.sh "${{ matrix.seed }}" | |
| - name: Wait for Daemon to Sync | |
| id: wait-for-sync | |
| run: ./scripts/mina-sync-monitor.sh rust | |
| - name: Record Failing Seed | |
| id: record-fail | |
| if: ${{ failure() }} | |
| run: | | |
| echo "Update Failed Seed List" | |
| echo "${{ matrix.seed }}" > failed-seeds-${{strategy.job-index}}.txt | |
| - name: Upload failed seeds | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@v4.6.0 | |
| with: | |
| name: failed-seeds-${{strategy.job-index}} | |
| path: failed-seeds-${{strategy.job-index}}.txt | |
| retention-days: 1 | |
| print-failed-seeds: | |
| needs: test-peer | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: "failed-seeds-*" # Use a wildcard to download all artifacts matching the pattern | |
| - name: Echo Failed Seeds | |
| run: | | |
| cat failed-seeds-*/failed-seeds-*.txt > failed-seeds.txt 2>/dev/null || touch failed-seeds.txt | |
| if [ -s failed-seeds.txt ]; then | |
| jq -n --arg message "Failed to synchronize with Mina RUST Daemon using seed peer:" \ | |
| --argjson seeds "$(cat failed-seeds.txt | jq -R . | jq -s .)" \ | |
| '{"channel": "C08ADQMJZJ8", "text": ($message + "\n\n" + ($seeds | map("• " + .) | join("\n")))}' > payload-slack-content.json | |
| cat payload-slack-content.json || exit 0 | |
| fi | |
| - name: Post to a Slack channel | |
| id: slack | |
| if: ${{ success() && hashFiles('payload-slack-content.json') != '' }} | |
| uses: slackapi/slack-github-action@v2.1.0 | |
| with: | |
| method: chat.postMessage | |
| token: ${{ secrets.SLACK_N8N_JANITOR_TOKEN }} | |
| payload-file-path: payload-slack-content.json |