Skip to content

Commit

Permalink
Merge branch 'refactor-workflows' into ref-dry-workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavovalverde committed Oct 11, 2023
2 parents 82ea71f + eac74b8 commit 982b0b4
Show file tree
Hide file tree
Showing 61 changed files with 1,421 additions and 931 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@
!zebra-*
!zebrad
!docker/entrypoint.sh
!docker/runtime-entrypoint.sh
24 changes: 21 additions & 3 deletions .github/workflows/cd-deploy-nodes-gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
type: boolean
default: false

# Temporarily disabled to reduce network load, see #6894.
# TODO: Temporarily disabled to reduce network load, see #6894.
#push:
# branches:
# - main
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
if: ${{ !cancelled() && !failure() && ((github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'release') }}

steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.0
with:
persist-credentials: false

Expand Down Expand Up @@ -227,7 +227,7 @@ jobs:
if: github.event_name == 'workflow_dispatch'

steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.0
with:
persist-credentials: false

Expand Down Expand Up @@ -281,3 +281,21 @@ jobs:
--labels=app=zebrad,environment=qa,network=${NETWORK},github_ref=${{ env.GITHUB_REF_SLUG_URL }} \
--tags zebrad \
--zone ${{ vars.GCP_ZONE }}
failure-issue:
name: Open or update issues for release failures
# When a new job is added to this workflow, add it to this list.
needs: [ versioning, build, deploy-nodes, deploy-instance ]
# Only open tickets for failed or cancelled jobs that are not coming from PRs.
# (PR statuses are already reported in the PR jobs list, and checked by Mergify.)
if: (failure() && github.event.pull_request == null) || (cancelled() && github.event.pull_request == null)
runs-on: ubuntu-latest
steps:
- uses: jayqi/failed-build-issue-action@v1
with:
title-template: "{{refname}} branch CI failed: {{eventName}} in {{workflow}}"
# New failures open an issue with this label.
label-name: S-ci-fail-release-auto-issue
# If there is already an open issue with this label, any failures become comments on that issue.
always-create-new-issue: false
github-token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/chore-delete-gcp-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
contents: 'read'
id-token: 'write'
steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.0
with:
persist-credentials: false

Expand Down Expand Up @@ -239,7 +239,7 @@ jobs:
contents: 'read'
id-token: 'write'
steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.0
with:
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-build-crates.patch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.0

# Setup Rust with stable toolchain and minimal profile
- name: Setup Rust
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/ci-build-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.0
- uses: r7kamura/[email protected]

# Setup Rust with stable toolchain and minimal profile
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}

steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.0
with:
persist-credentials: false
- uses: r7kamura/[email protected]
Expand Down Expand Up @@ -138,3 +138,21 @@ jobs:
- name: Build ${{ matrix.crate }} crate with all features
run: |
cargo build --package ${{ matrix.crate }} --all-features
failure-issue:
name: Open or update issues for building crates individually failures
# When a new job is added to this workflow, add it to this list.
needs: [ matrix, build ]
# Only open tickets for failed or cancelled jobs that are not coming from PRs.
# (PR statuses are already reported in the PR jobs list, and checked by Mergify.)
if: (failure() && github.event.pull_request == null) || (cancelled() && github.event.pull_request == null)
runs-on: ubuntu-latest
steps:
- uses: jayqi/failed-build-issue-action@v1
with:
title-template: "{{refname}} branch CI failed: {{eventName}} in {{workflow}}"
# New failures open an issue with this label.
label-name: S-ci-fail-build-crates-auto-issue
# If there is already an open issue with this label, any failures become comments on that issue.
always-create-new-issue: false
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/ci-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
runs-on: ubuntu-latest-xl

steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.0
with:
persist-credentials: false

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci-integration-tests-gcp.patch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
- '.dockerignore'
- '.github/workflows/ci-unit-tests-docker.yml'
- '.github/workflows/sub-deploy-integration-tests-gcp.yml'
- '.github/workflows/manual-find-cached-disks.yml'
- '.github/workflows/sub-find-cached-disks.yml'
- '.github/workflows/sub-build-docker-image.yml'

jobs:
Expand Down Expand Up @@ -51,8 +51,8 @@ jobs:
steps:
- run: 'echo "No build required"'

generate-checkpoints-mainnet:
name: Generate checkpoints mainnet / Run generate-checkpoints-mainnet test
checkpoints-mainnet:
name: Generate checkpoints mainnet / Run checkpoints-mainnet test
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'
Expand Down
32 changes: 15 additions & 17 deletions .github/workflows/ci-integration-tests-gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ on:
- '.github/workflows/ci-integration-tests-gcp.yml'
- '.github/workflows/sub-deploy-integration-tests-gcp.yml'
- '.github/workflows/sub-build-docker-image.yml'
- '.github/workflows/manual-find-cached-disks.yml'
- '.github/workflows/sub-find-cached-disks.yml'

push:
branches:
Expand All @@ -88,7 +88,7 @@ on:
- '.dockerignore'
- '.github/workflows/ci-integration-tests-gcp.yml'
- '.github/workflows/sub-deploy-integration-tests-gcp.yml'
- '.github/workflows/manual-find-cached-disks.yml'
- '.github/workflows/sub-find-cached-disks.yml'
- '.github/workflows/sub-build-docker-image.yml'

jobs:
Expand All @@ -101,20 +101,20 @@ jobs:
# The default network is mainnet unless a manually triggered workflow or repository variable
# is configured differently.
#
# The outputs for this job have the same names as the workflow outputs in manual-find-cached-disks.yml
# The outputs for this job have the same names as the workflow outputs in sub-find-cached-disks.yml
get-available-disks:
name: Check if cached state disks exist for ${{ inputs.network || vars.ZCASH_NETWORK }}
uses: ./.github/workflows/manual-find-cached-disks.yml
uses: ./.github/workflows/sub-find-cached-disks.yml
with:
network: ${{ inputs.network || vars.ZCASH_NETWORK }}

# Check if the cached state disks used by the tests are available for testnet.
#
# The outputs for this job have the same names as the workflow outputs in manual-find-cached-disks.yml
# The outputs for this job have the same names as the workflow outputs in sub-find-cached-disks.yml
# Some outputs are ignored, because we don't run those jobs on testnet.
get-available-disks-testnet:
name: Check if cached state disks exist for testnet
uses: ./.github/workflows/manual-find-cached-disks.yml
uses: ./.github/workflows/sub-find-cached-disks.yml
with:
network: 'Testnet'

Expand Down Expand Up @@ -208,7 +208,7 @@ jobs:
if: ${{ github.event_name == 'schedule' || !fromJSON(needs.get-available-disks.outputs.zebra_tip_disk) || (github.event.inputs.run-full-sync == 'true' && (inputs.network || vars.ZCASH_NETWORK) == 'Mainnet') }}
with:
app_name: zebrad
test_id: full-sync-to-tip
test_id: full-sync
test_description: Test a full sync up to the tip
# The value of FULL_SYNC_MAINNET_TIMEOUT_MINUTES is currently ignored.
# TODO: update the test to use {{ input.network }} instead?
Expand Down Expand Up @@ -277,14 +277,14 @@ jobs:
#
# 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.
generate-checkpoints-mainnet:
checkpoints-mainnet:
name: Generate checkpoints mainnet
needs: [ test-full-sync, get-available-disks ]
uses: ./.github/workflows/sub-deploy-integration-tests-gcp.yml
if: ${{ !cancelled() && !failure() && (fromJSON(needs.get-available-disks.outputs.zebra_tip_disk) || needs.test-full-sync.result == 'success') && github.event.inputs.regenerate-disks != 'true' && github.event.inputs.run-full-sync != 'true' && github.event.inputs.run-lwd-sync != 'true' }}
with:
app_name: zebrad
test_id: generate-checkpoints-mainnet
test_id: checkpoints-mainnet
test_description: Generate Zebra checkpoints on mainnet
# TODO: update the test to use {{ input.network }} instead?
test_variables: '-e NETWORK=Mainnet -e GENERATE_CHECKPOINTS_MAINNET=1 -e ZEBRA_FORCE_USE_COLOR=1 -e ZEBRA_CACHED_STATE_DIR=/var/cache/zebrad-cache'
Expand Down Expand Up @@ -319,7 +319,7 @@ jobs:
if: ${{ (github.event_name == 'schedule' && vars.SCHEDULE_TESTNET_FULL_SYNC == 'true') || !fromJSON(needs.get-available-disks-testnet.outputs.zebra_tip_disk) || (github.event.inputs.run-full-sync == 'true' && (inputs.network || vars.ZCASH_NETWORK) == 'Testnet') }}
with:
app_name: zebrad
test_id: full-sync-to-tip-testnet
test_id: full-sync-testnet
test_description: Test a full sync up to the tip on testnet
# The value of FULL_SYNC_TESTNET_TIMEOUT_MINUTES is currently ignored.
test_variables: '-e NETWORK=Testnet -e FULL_SYNC_TESTNET_TIMEOUT_MINUTES=0 -e ZEBRA_FORCE_USE_COLOR=1'
Expand Down Expand Up @@ -358,14 +358,14 @@ jobs:
#
# 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.
generate-checkpoints-testnet:
checkpoints-testnet:
name: Generate checkpoints testnet
needs: [ test-full-sync-testnet, get-available-disks-testnet ]
uses: ./.github/workflows/sub-deploy-integration-tests-gcp.yml
if: ${{ !cancelled() && !failure() && (fromJSON(needs.get-available-disks-testnet.outputs.zebra_tip_disk) || needs.test-full-sync-testnet.result == 'success') && github.event.inputs.regenerate-disks != 'true' && github.event.inputs.run-full-sync != 'true' && github.event.inputs.run-lwd-sync != 'true' }}
with:
app_name: zebrad
test_id: generate-checkpoints-testnet
test_id: checkpoints-testnet
test_description: Generate Zebra checkpoints on testnet
test_variables: '-e NETWORK=Testnet -e GENERATE_CHECKPOINTS_TESTNET=1 -e ZEBRA_FORCE_USE_COLOR=1 -e ZEBRA_CACHED_STATE_DIR=/var/cache/zebrad-cache'
network: "Testnet"
Expand Down Expand Up @@ -596,19 +596,17 @@ jobs:
#
# This list is for reliable tests that are run on the `main` branch.
# Testnet jobs are not in this list, because we expect testnet to fail occasionally.
needs: [ regenerate-stateful-disks, test-full-sync, lightwalletd-full-sync, test-stateful-sync, test-update-sync, generate-checkpoints-mainnet, lightwalletd-update-sync, lightwalletd-rpc-test, lightwalletd-transactions-test, lightwalletd-grpc-test, get-block-template-test, submit-block-test ]
needs: [ regenerate-stateful-disks, test-full-sync, lightwalletd-full-sync, test-stateful-sync, test-update-sync, checkpoints-mainnet, lightwalletd-update-sync, lightwalletd-rpc-test, lightwalletd-transactions-test, lightwalletd-grpc-test, get-block-template-test, submit-block-test ]
# Only open tickets for failed scheduled jobs, manual workflow runs, or `main` branch merges.
# (PR statuses are already reported in the PR jobs list, and checked by Mergify.)
# TODO: if a job times out, we want to create a ticket. Does failure() do that? Or do we need cancelled()?
if: failure() && github.event.pull_request == null
if: (failure() && github.event.pull_request == null) || (cancelled() && github.event.pull_request == null)
runs-on: ubuntu-latest
steps:
- uses: jayqi/failed-build-issue-action@v1
with:
title-template: "{{refname}} branch CI failed: {{eventName}} in {{workflow}}"
# New failures open an issue with this label.
# TODO: do we want a different label for each workflow, or each kind of workflow?
label-name: S-ci-fail-auto-issue
label-name: S-ci-fail-main-branch-auto-issue
# If there is already an open issue with this label, any failures become comments on that issue.
always-create-new-issue: false
github-token: ${{ secrets.GITHUB_TOKEN }}
16 changes: 8 additions & 8 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ jobs:
rust: ${{ steps.changed-files-rust.outputs.any_changed == 'true' }}
workflows: ${{ steps.changed-files-workflows.outputs.any_changed == 'true' }}
steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.0
with:
persist-credentials: false
fetch-depth: 0

- name: Rust files
id: changed-files-rust
uses: tj-actions/[email protected].0
uses: tj-actions/[email protected].1
with:
files: |
**/*.rs
Expand All @@ -49,7 +49,7 @@ jobs:
- name: Workflow files
id: changed-files-workflows
uses: tj-actions/[email protected].0
uses: tj-actions/[email protected].1
with:
files: |
.github/workflows/*.yml
Expand All @@ -62,7 +62,7 @@ jobs:
if: ${{ needs.changed-files.outputs.rust == 'true' }}

steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.0
with:
persist-credentials: false

Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
if: ${{ needs.changed-files.outputs.rust == 'true' }}

steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.0
with:
persist-credentials: false
- uses: r7kamura/[email protected]
Expand Down Expand Up @@ -142,9 +142,9 @@ jobs:
needs: changed-files
if: ${{ needs.changed-files.outputs.workflows == 'true' }}
steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.0
- name: actionlint
uses: reviewdog/[email protected].0
uses: reviewdog/[email protected].1
with:
level: warning
fail_on_error: false
Expand All @@ -155,7 +155,7 @@ jobs:
runs-on: ubuntu-latest
needs: changed-files
steps:
- uses: actions/checkout@v4.0.0
- uses: actions/checkout@v4.1.0
- uses: plettich/action-codespell@master
with:
github_token: ${{ secrets.github_token }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-unit-tests-docker.patch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
- '.dockerignore'
- '.github/workflows/ci-unit-tests-docker.yml'
- '.github/workflows/sub-deploy-integration-tests-gcp.yml'
- '.github/workflows/manual-find-cached-disks.yml'
- '.github/workflows/sub-find-cached-disks.yml'
- '.github/workflows/sub-build-docker-image.yml'

jobs:
Expand Down
Loading

0 comments on commit 982b0b4

Please sign in to comment.