zebra/.github/workflows/manual-deploy.yml

68 lines
2.4 KiB
YAML
Raw Normal View History

name: Manual Deploy
on:
workflow_dispatch:
inputs:
network:
2020-11-13 20:53:26 -08:00
default: 'Mainnet'
checkpoint_sync:
default: true
env:
PROJECT_ID: zealous-zebra
jobs:
deploy:
name: Deploy one zebrad node
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.4.0
with:
persist-credentials: false
Download Zcash Sapling parameters and load them from cached files (#3057) * Replace Zcash parameters crates with pre-downloaded local parameter files * Download Zcash parameters using the `zcashd` script in CI and Docker * Add a zcash_proofs dependency to zebra-consensus * Download Sapling parameters using zcash_proofs, rather than fetch-params.sh * Add a new `zebrad download` subcommand This command isn't required for nomrmal usage. But it's useful when testing, or launching multiple Zebra instances. * Use `zebrad download` in CI to pre-download parameters * Log a helpful hint if downloading fails * Allow some duplicate dependencies currently hidden by orchard * Spawn a separate task to download Groth16 parameters * Run the parameter download with code coverage This avoids re-compining Zebra with and without coverage. * Update Cargo.lock after rebase * Try to pass `download` as an argument to `zebrad` in coverage CI * Fix copy and paste comment typos * Add path and download examples, like zcash_proofs * Download params in CI just like zcash_proofs does * Delete a redundant build step * Implement graceful shutdown for zebrad start * Send coverage summary to /dev/null when getting the params path * Use the correct parameters path and download commands in CI * Explain pre-downloads * Avoid calling params_folder twice * Rename parameter types and methods for consistency ```sh fastmod SaplingParams SaplingParameters zebra* fastmod Groth16Params Groth16Parameters zebra* fastmod PARAMS GROTH16_PARAMETERS zebra* fastmod params_folder directory zebra* ``` And a manual variable name tweak. * rustfmt * Remove a redundant coverage step Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>
2021-11-19 15:02:56 -08:00
- name: Set project and image names
run: |
BRANCH_NAME=$(expr $GITHUB_REF : '.*/\(.*\)') && \
BRANCH_NAME=${BRANCH_NAME,,} && \
REPOSITORY=${GITHUB_REPOSITORY,,} && \
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV && \
echo "SHORT_SHA=$(git rev-parse --short=7 $GITHUB_SHA)" >> $GITHUB_ENV && \
echo "REPOSITORY=$REPOSITORY" >> $GITHUB_ENV
- name: Set up gcloud
uses: google-github-actions/setup-gcloud@master
with:
version: '295.0.0'
project_id: ${{ env.PROJECT_ID }}
service_account_key: ${{ secrets.GCLOUD_AUTH }}
# Build and push image to Google Container Registry
- name: Build
# Tagging w/ the commit SHA blocks the :latest tag on GCR
run: |
gcloud builds submit \
--config cloudbuild.yaml \
2020-11-14 19:49:05 -08:00
--substitutions SHORT_SHA="$SHORT_SHA",BRANCH_NAME="$BRANCH_NAME",_CHECKPOINT_SYNC="${{ github.event.inputs.checkpoint_sync }}",_NETWORK="${{ github.event.inputs.network }}"
# Run once: create firewall rule to allow incoming traffic to the node
# - name: Create Zcash incoming traffic firewall rule
# run: |
# gcloud compute firewall-rules create "allow-zcash" \
# --target-tags zebrad \
# --allow tcp:8233,tcp:18233 \
# --source-ranges 0.0.0.0/0 \
# --description="Allow incoming Zcash traffic from anywhere" \
# Creates Compute Engine virtual machine instance w/ zebrad container and disks
- name: Create instance running zebrad container image
run: |
gcloud compute instances create-with-container "zebrad-$BRANCH_NAME-$SHORT_SHA" \
--container-image "gcr.io/$PROJECT_ID/$REPOSITORY/$BRANCH_NAME:$SHORT_SHA" \
--container-mount-disk mount-path='/zebrad-cache',name=zebrad-cache-$SHORT_SHA \
--create-disk name=zebrad-cache-$SHORT_SHA,auto-delete=yes,size=100GB,type=pd-balanced \
--machine-type n2-standard-4 \
--service-account cos-vm@zealous-zebra.iam.gserviceaccount.com \
--tags zebrad \
--zone us-central1-a