ci(tests): run network syncs on a weekly schedule (#6920)

* ci(tests): just run the full sync weekly

This change allows to run the Zebra full sync test every Friday at mid-day UTC.

* fix: also run Testnet & LWD full sync only on schedule

* chore: remove not needed file

* chore: fix wording and comments

Co-authored-by: teor <teor@riseup.net>

---------

Co-authored-by: teor <teor@riseup.net>
This commit is contained in:
Gustavo Valverde 2023-06-12 21:27:22 -04:00 committed by GitHub
parent c058f77a34
commit 16ee87a19f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 15 deletions

View File

@ -8,6 +8,12 @@ concurrency:
cancel-in-progress: true
on:
schedule:
# Run this job every Friday at mid-day UTC
# This is limited to the Zebra and lightwalletd Full Sync jobs
# TODO: we should move this behavior to a separate workflow
- cron: '0 12 * * 5'
workflow_dispatch:
inputs:
network:
@ -80,6 +86,9 @@ on:
- '.github/workflows/find-cached-disks.yml'
jobs:
# to also run a job on Mergify head branches,
# add `|| (github.event_name == 'push' && startsWith(github.head_ref, 'mergify/merge-queue/'))`:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-workflow-based-on-the-head-or-base-branch-of-a-pull-request-1
# Check if the cached state disks used by the tests are available for the default network.
#
@ -359,7 +368,7 @@ jobs:
# This test always runs on mainnet.
#
# Runs:
# - after every PR is merged to `main`
# - on schedule, as defined at the top of the workflow
# - on every PR update, but only if the state version in constants.rs has no cached disk
# - in manual workflow runs, when run-full-sync is 'true' and network is 'Mainnet'
#
@ -368,10 +377,7 @@ jobs:
name: Zebra tip
needs: [ build, get-available-disks ]
uses: ./.github/workflows/deploy-gcp-tests.yml
# to also run on Mergify head branches,
# add `|| (github.event_name == 'push' && startsWith(github.head_ref, 'mergify/merge-queue/'))`:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-workflow-based-on-the-head-or-base-branch-of-a-pull-request-1
if: ${{ (github.event_name == 'push' && github.ref_name == 'main') || !fromJSON(needs.get-available-disks.outputs.zebra_tip_disk) || (github.event.inputs.run-full-sync == 'true' && github.event.inputs.network == 'Mainnet') }}
if: ${{ github.event_name == 'schedule' || !fromJSON(needs.get-available-disks.outputs.zebra_tip_disk) || (github.event.inputs.run-full-sync == 'true' && github.event.inputs.network == 'Mainnet') }}
with:
app_name: zebrad
test_id: full-sync-to-tip
@ -473,7 +479,7 @@ jobs:
# This job always runs on testnet, regardless of any inputs or variable settings.
#
# Runs:
# - after every PR is merged to `main`
# - on schedule, as defined at the top of the workflow
# - on every PR update, but only if the state version in constants.rs has no cached disk
# - in manual workflow runs, when run-full-sync is 'true' and network is 'Testnet'
#
@ -482,10 +488,7 @@ jobs:
name: Zebra tip on testnet
needs: [ build, get-available-disks-testnet ]
uses: ./.github/workflows/deploy-gcp-tests.yml
# to also run on Mergify head branches,
# add `|| (github.event_name == 'push' && startsWith(github.head_ref, 'mergify/merge-queue/'))`:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-workflow-based-on-the-head-or-base-branch-of-a-pull-request-1
if: ${{ (github.event_name == 'push' && github.ref_name == 'main') || !fromJSON(needs.get-available-disks-testnet.outputs.zebra_tip_disk) || (github.event.inputs.run-full-sync == 'true' && github.event.inputs.network == 'Testnet') }}
if: ${{ github.event_name == 'schedule' || !fromJSON(needs.get-available-disks-testnet.outputs.zebra_tip_disk) || (github.event.inputs.run-full-sync == 'true' && github.event.inputs.network == 'Testnet') }}
with:
app_name: zebrad
test_id: full-sync-to-tip-testnet
@ -552,7 +555,9 @@ jobs:
# Test full sync of lightwalletd with a Zebra tip state
#
# Runs:
# - after every PR is merged to `main`
# - on schedule, as defined at the top of the workflow
# - on every PR update, but only if the state version in constants.rs has no cached disk
# - in manual workflow runs, when run-lwd-sync is 'true' and network is 'Mainnet' (the network is required by the test-full-sync job)
#
# If the state version has changed, waits for the new cached state to be created.
# Otherwise, if the state rebuild was skipped, runs immediately after the build job.
@ -560,10 +565,7 @@ jobs:
name: lightwalletd tip
needs: [ test-full-sync, get-available-disks ]
uses: ./.github/workflows/deploy-gcp-tests.yml
# to also run on Mergify head branches,
# add `|| (github.event_name == 'push' && startsWith(github.head_ref, 'mergify/merge-queue/'))`:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-workflow-based-on-the-head-or-base-branch-of-a-pull-request-1
if: ${{ !cancelled() && !failure() && (fromJSON(needs.get-available-disks.outputs.zebra_tip_disk) || needs.test-full-sync.result == 'success') && ((github.event_name == 'push' && github.ref_name == 'main') || !fromJSON(needs.get-available-disks.outputs.lwd_tip_disk) || github.event.inputs.run-lwd-sync == 'true' ) }}
if: ${{ !cancelled() && !failure() && (fromJSON(needs.get-available-disks.outputs.zebra_tip_disk) || needs.test-full-sync.result == 'success') && (github.event_name == 'schedule' || !fromJSON(needs.get-available-disks.outputs.lwd_tip_disk) || github.event.inputs.run-lwd-sync == 'true' ) }}
with:
app_name: lightwalletd
test_id: lwd-full-sync