Files
blockbook/.github/workflows/deploy.yml

104 lines
3.0 KiB
YAML

name: Deploy
on:
workflow_dispatch:
inputs:
coins:
description: "Comma-separated coin aliases from configs/coins, or ALL"
required: true
ref:
description: "Git ref to deploy (leave empty for current ref)"
required: false
default: ""
permissions:
contents: read
jobs:
prepare:
name: Prepare Plan
runs-on: ubuntu-latest
outputs:
deploy_matrix: ${{ steps.plan.outputs.deploy_matrix }}
e2e_regex: ${{ steps.plan.outputs.e2e_regex }}
coins_csv: ${{ steps.plan.outputs.coins_csv }}
test_coins_csv: ${{ steps.plan.outputs.test_coins_csv }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref != '' && inputs.ref || github.ref }}
- name: Build deploy/e2e plan
id: plan
env:
VARS_JSON: ${{ toJSON(vars) }}
COINS_INPUT: ${{ inputs.coins }}
run: ./.github/scripts/prepare_deploy_plan.py
deploy:
name: Deploy (${{ matrix.coin }})
needs: prepare
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.prepare.outputs.deploy_matrix) }}
runs-on: [self-hosted, bb-dev-selfhosted, "${{ matrix.runner }}"]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref != '' && inputs.ref || github.ref }}
- name: Export repository variables
uses: ./.github/actions/export-repository-variables
with:
vars_json: ${{ toJSON(vars) }}
- name: Deploy blockbook package
run: ./contrib/scripts/deploy-blockbook-local.sh "${{ matrix.coin }}"
wait-for-sync:
name: Wait For Sync
needs: [prepare, deploy]
if: ${{ needs.deploy.result == 'success' }}
runs-on: [self-hosted, bb-dev-selfhosted]
timeout-minutes: 31
env:
COINS_INPUT: ${{ needs.prepare.outputs.test_coins_csv }}
SYNC_TIMEOUT_SECONDS: "1800"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref != '' && inputs.ref || github.ref }}
- name: Export repository variables
uses: ./.github/actions/export-repository-variables
with:
vars_json: ${{ toJSON(vars) }}
- name: Wait for Blockbook sync
run: python3 ./.github/scripts/wait_for_blockbook_sync.py
e2e-tests:
name: E2E Tests (post-deploy)
needs: [prepare, deploy, wait-for-sync]
if: ${{ needs.deploy.result == 'success' && needs.wait-for-sync.result == 'success' }}
runs-on: [self-hosted, bb-dev-selfhosted]
env:
E2E_REGEX: ${{ needs.prepare.outputs.e2e_regex }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref != '' && inputs.ref || github.ref }}
- name: Export repository variables
uses: ./.github/actions/export-repository-variables
with:
vars_json: ${{ toJSON(vars) }}
- name: Run e2e tests
run: make test-e2e ARGS="-v"