zebra/.github/workflows/continous-integration-docke...

290 lines
12 KiB
YAML
Raw Normal View History

name: CI Docker
on:
workflow_dispatch:
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
inputs:
network:
default: 'Mainnet'
description: 'Network to deploy: Mainnet or Testnet'
required: true
checkpoint_sync:
default: 'true'
description: 'Configures `zebrad` to use as many checkpoints as possible'
required: true
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
regenerate-disks:
type: boolean
default: false
description: 'Just update mandatory checkpoint disks'
required: true
run-full-sync:
type: boolean
default: false
description: 'Just run a full sync and update tip disks'
required: true
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
pull_request:
branches:
- main
paths:
# code and tests
- '**/*.rs'
# hard-coded checkpoints and proptest regressions
- '**/*.txt'
# test data snapshots
- '**/*.snap'
# dependencies
- '**/Cargo.toml'
- '**/Cargo.lock'
# workflow definitions
- 'docker/**'
- '.github/workflows/continous-integration-docker.yml'
- '.github/workflows/deploy-gcp-tests.yml'
- '.github/workflows/build-docker-image.yml'
push:
branches:
- main
paths:
# code and tests
- '**/*.rs'
# hard-coded checkpoints and proptest regressions
- '**/*.txt'
# test data snapshots
- '**/*.snap'
# dependencies
- '**/Cargo.toml'
- '**/Cargo.lock'
# workflow definitions
- 'docker/**'
- '.github/workflows/continous-integration-docker.yml'
- '.github/workflows/deploy-gcp-tests.yml'
- '.github/workflows/build-docker-image.yml'
env:
# TODO: use the output from ./.github/workflows/build-docker-image.yml
IMAGE_NAME: zebrad-test
GAR_BASE: us-docker.pkg.dev/zealous-zebra/zebra
jobs:
changed-files:
runs-on: ubuntu-latest
name: Checks changed-files
outputs:
rebuild: ${{ steps.changed-files-rebuild.outputs.any_changed == 'true' }}
steps:
- uses: actions/checkout@v3.0.2
with:
persist-credentials: false
fetch-depth: 0
- name: Disk rebuild files
id: changed-files-rebuild
uses: tj-actions/changed-files@v19
with:
files: |
zebra-state/**/constants.rs
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
build:
uses: ./.github/workflows/build-docker-image.yml
with:
dockerfile_path: ./docker/Dockerfile
dockerfile_target: tests
image_name: zebrad-test
# TODO: validate how to use variable/conditional values for Testnet
network: Mainnet
checkpoint_sync: true
rust_backtrace: full
rust_lib_backtrace: full
colorbt_show_hidden: '1'
zebra_skip_ipv6_tests: '1'
rust_log: info
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
# Run all the zebra tests, including tests that are ignored by default.
# Skips tests that need a cached state disk or a lightwalletd binary.
#
# (We activate the gRPC feature to avoid recompiling `zebrad`, but we don't actually run any gRPC tests.)
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
test-all:
name: Test all
runs-on: ubuntu-latest
needs: build
if: ${{ github.event.inputs.regenerate-disks != 'true' && github.event.inputs.run-full-sync != 'true' }}
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
steps:
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
with:
short-length: 7
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
- name: Run all zebrad tests
run: |
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}
docker run --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} cargo test --locked --release --features lightwalletd-grpc-tests --workspace -- --nocapture --include-ignored
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
# Run state tests with fake activation heights.
#
# This test changes zebra-chain's activation heights,
# which can recompile all the Zebra crates,
# so we want its build products to be cached separately.
#
# Also, we don't want to accidentally use the fake heights in other tests.
#
# (The gRPC feature is a zebrad feature, so it isn't needed here.)
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
test-fake-activation-heights:
name: Test with fake activation heights
runs-on: ubuntu-latest
needs: build
if: ${{ github.event.inputs.regenerate-disks != 'true' && github.event.inputs.run-full-sync != 'true' }}
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
steps:
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
with:
short-length: 7
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
- name: Run tests with fake activation heights
run: |
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}
docker run -e TEST_FAKE_ACTIVATION_HEIGHTS --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} cargo test --locked --release --package zebra-state --lib -- --nocapture --include-ignored with_fake_activation_heights
env:
TEST_FAKE_ACTIVATION_HEIGHTS: '1'
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
# Test that Zebra syncs and checkpoints a few thousand blocks from an empty state.
#
# (We activate the gRPC feature to avoid recompiling `zebrad`, but we don't actually run any gRPC tests.)
test-empty-sync:
name: Test checkpoint sync from empty state
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
runs-on: ubuntu-latest
needs: build
if: ${{ github.event.inputs.regenerate-disks != 'true' && github.event.inputs.run-full-sync != 'true' }}
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
steps:
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
with:
short-length: 7
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
- name: Run zebrad large sync tests
run: |
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}
docker run --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} cargo test --locked --release --features lightwalletd-grpc-tests --package zebrad --test acceptance -- --nocapture --include-ignored sync_large_checkpoints_
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
# Test launching lightwalletd with an empty lightwalletd and Zebra state.
#
# (We activate the gRPC feature to avoid recompiling `zebrad`, but we don't actually run any gRPC tests.)
test-lightwalletd-integration:
name: Test integration with lightwalletd
runs-on: ubuntu-latest
needs: build
if: ${{ github.event.inputs.regenerate-disks != 'true' && github.event.inputs.run-full-sync != 'true' }}
steps:
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
with:
short-length: 7
- name: Run tests with empty lightwalletd launch
run: |
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}
docker run -e ZEBRA_TEST_LIGHTWALLETD --name lightwalletd-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} cargo test --locked --release --features lightwalletd-grpc-tests --package zebrad --test acceptance -- --nocapture --include-ignored lightwalletd_integration
env:
ZEBRA_TEST_LIGHTWALLETD: '1'
# Regenerate mandatory checkpoint disks.
# Runs:
# - on every PR update, but only if Zebra's state version changes in the PR
# - on request
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
regenerate-stateful-disks:
needs: [ build, changed-files]
uses: ./.github/workflows/deploy-gcp-tests.yml
# Only run this job if the database format version has (likely) changed.
if: ${{ (needs.changed-files.outputs.rebuild == 'true' && github.event_name == 'push') || github.event.inputs.regenerate-disks == 'true' }}
with:
test_id: sync-to-checkpoint
test_description: Test sync up to mandatory checkpoint
test_variables: '-e TEST_DISK_REBUILD=1 -e ZEBRA_FORCE_USE_COLOR=1'
needs_zebra_state: false
saves_to_disk: true
disk_suffix: checkpoint
height_grep_text: 'flushing database to disk height=Height'
# Test that Zebra syncs and fully validates a few thousand blocks from a cached mandatory checkpoint disk
refactor(test): dockerize tests and run sync in detached mode (#3459) * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): overall pipeline improvement - Use a more ENV configurable Dockerfile - Remove cloudbuild dependency - Use compute optimized machine types - Use SSD instead of normal hard drives - Move Sentry endpoint to secrets - Use a single yml for auto & manual deploy - Migrate to Google Artifact Registry * refactor (cd): use newer google auth action * fix (cd): use newer secret as gcp credential * fix (docker): do not create extra directories * fix (docker): ignore .github for caching purposes * fix (docker): use latest rust * fix (cd): bump build timeout * fix: use a better name for manual deployment * refactor (docker): use standard directories for executable * fix (cd): most systems expect a "latest" tag Caching from the latest image is one of the main reasons to add this extra tag. Before this commit, the inline cache was not being used. * fix (cd): push the build image and the cache separately The inline cache exporter only supports `min` cache mode. To enable `max` cache mode, push the image and the cache separately by using the registry cache exporter. This also allows for smaller release images. * fix (cd): remove unused GHA cache We're leveraging the registry to cache the actions, instead of using the 10GB limits from Github Actions cache storage * refactor (cd): use cargo-chef for caching rust deps * fix: move build system deps before cargo cheg cook * fix (release): use newer debian to reduce vulnerabilities * fix (cd): use same zone, region and service accounts * fix (cd): use same disk size and type for all deployments * refactor (cd): activate interactive shells Use interactive shells for manual and test deployments. This allow greater flexibility if troubleshooting is needed inside the machines * refactor (test): use docker artifact from registry Instead of using a VM to SSH into in to build and test. Build in GHA (to have the logs available), run the workspace tests in GHA, and just run the sync tests in GCP Use a cintainer VM with zebra's image directly on it, and pass the needed parameters to run the Sync past mandatory checkpoint. * tmp (cd): bump timeout for building from scratch * tmp (test): bump build time * fix (cd, test): bump build time-out to 210 minutes * fix (docker): do not build with different settings Compiling might be slow because different steps are compiling the same code 2-4 times because of the variations * revert (docker): do not fix the rust version * fix (docker): build on the root directory * refactor(docker): Use base image commands and tools * fix (cd): use correct variables & values, add build concurrency * fix(cd): use Mainnet instead of mainnet * imp: remove checkout as Buildkit uses the git context * fix (docker): just Buildkit uses a .dockerignore in a path * imp (cd): just use needed variables in the right place * imp (cd): do not checkout if not needed * test: run on push * refactor(docker): reduce build changes * fix(cd): not checking out was limiting some variables * refactor(test): add an multistage exclusive for testing * fix(cd): remove tests as a runtime dependency * fix(cd): use default service account with cloud-platform scope * fix(cd): revert checkout actions * fix: use GA c2 instead of Preview c2d machine types * fix(actions): remove workflow_dispatch from patched actions This causes GitHub confusion as it can't determined which of the actions using workflow_dispatch is the right one * fix(actions): remove patches from push actions * test: validate changes on each push * fix(test): wrong file syntax on test job * fix(test): add missing env parameters * fix(docker): Do not rebuild to download params and run tests * fix(test): setup gcloud and loginto artifact just when needed Try not to rebuild the tests * fix(test): use GCP container to sync past mandatory checkpoint * fix(test): missing separators * test * fix(test): mount the available disk * push * refactor(test): merge disk regeneration into test.yml * fix(cd): minor typo fixes * fix(docker): rebuild on .github changes * fix(cd): keep compatibility with gcr.io To prevent conflicts between registries, and migrate when the time is right, we'll keep pushing to both registries and use github actions cache to prevent conflicts between artifacts. * fix(cd): typo and scope * fix(cd): typos everywhere * refactor(test): use smarter docker wait and keep old registry * fix(cd): do not constraint the CPUs for bigger machines * revert(cd): reduce PR diff as there's a separate one for tests * fix(docker): add .github as it has no impact on caching * fix(test): run command correctly * fix(test): wiat and create image if previous step succeded * force rebuild * fix(test): do not restrict interdependant steps based on event * force push * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * fix(test): remove all hardoced values and increase disks * fix(test): use correct commands on deploy * fix(test): use args as required by google * fix(docker): try not to invalidate zebrad download cache * fix(test): minor typo * refactor(test): decouple jobs for better modularity This also allows faster tests as testing Zunstable won't be a dependency and it can't stop already started jobs if it fails. * fix(test): Do not try to execute ss and commands in one line * fix(test): do not show undeeded information in the terminal * fix(test): sleep befor/after machine creation/deletion * fix(docker): do not download zcash params twice * feat(docker): add google OS Config agent Use a separate step to have better flexibility in case a better approach is available * merge: docker-actions-refactor into docker-test-refactor * test docker wait scenarios * fix(docker): $HOME variables is not being expanded * fix(test): allow docker wait to work correctly * fix(docker): do not use variables while using COPY * fix(docker): allow to use zebrad as a command * fix(cd): use test .yml from main * fix(cd): Do not duplicate network values The Dockerfile has an ARG with a default value of 'Mainnet', if this value is changed it will be done manually on a workflow_dispatch, making the ENV option a uneeded duplicate in this workflow * fix(test): use bigger machine type for compute intensive tasks * refactor(test): add tests in CI file * fix(test): remove duplicated tests * fix(test): typo * test: build on .github changes temporarily * fix(test): bigger machines have no effect on sync times * feat: add an image to inherit from with zcash params * fix(cd): use the right image name and allow push to test * fix(cd): use the right docker target and remove extra builds * refactor(docker): use cached zcash params from previous build * fix(cd): finalize for merging * imp(cd): add double safety measure for production * fix(cd): use specific SHA for containers * fix(cd): use latest gcloud action version * fix(test): use the network as Mainnet and remove the uppercase from tests * fix(test): run disk regeneration on specific file change Just run this regeneration when changing the following files: https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state/disk_format.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/service/finalized_state.rs https://github.com/ZcashFoundation/zebra/blob/main/zebra-state/src/constants.rs * refactor(test): seggregate disks regeneration from tests Allow to regenerate disks without running tests, and to run tests from previous disk regeneration. Disk will be regenerated just if specific files were changed, or triggered manually. Tests will run just if a disk regeneration was not manually triggered. * fix(test): gcp disks require lower case conventions * fix(test): validate logs being emmited by docker GHA is transforming is somehow transforwing the variable to lowercase also, so we're changint it to adapt to it * test * fix(test): force tty terminal * fix(test): use a one line command to test terminal output * fix(test): always delete test instance * fix(test): use short SHA from the PR head Using the SHA from the base, creates confusion and it's not accurate with the SHA being shown and used on GitHub. We have to keep both as manual runs with `workflow_dispatch` does not have a PR SHA * fix(ci): do not trigger CI on docker changes There's no impact in this workflow when a change is done in the dockerfile * Instead of runing cargo test when the instance gets created, run this commands afterwards in a different step. As GHA TTY is not working as expected, and workarounds does not play nicely with `gcloud compute ssh` actions/runner#241 (comment) we decided to get the container name from the logs, log directly to the container and run the cargo command from there. * doc(test): document reasoning for new steps * fix(test): increase machine type and ssh timeout * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails * finalize(test): do not rebuild image when changing actions * fix(test): run tests on creation and follow container logs This allows to follow logs in Github Actions terminal, while the GCP container is still running. Just delete the instance when following the logs ends successfully or fails Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-02-15 16:54:16 -08:00
test-stateful-sync:
needs: build
uses: ./.github/workflows/deploy-gcp-tests.yml
feat(ci): add `sending_transactions_using_lightwalletd` test to CI (#4267) * feat(ci): add lightwalletd_*_sync tests to CI * feat(ci): add lightwalletd RPC call test * feat(ci): add send transactions test with lwd to CI * fix(ci): create a variable to run transactions test * refactor(ci): use docker in docker This is a workaround for an issue related to disk partitioning, caused by a GCP service called Konlet, while mounting the cached disks to the VM and then to the container * fix(build): persist docker login credentials * fix(ci): get sync height from docker logs instead of gcp * try: use gha cache for faster building * fix(ci): mount disk in container to make it available in vm * fix(build): do not invalidate cache between images * try(docker): invalidate cache as less as possible * fix(ci): GHA terminal is not a TTY * fix(build): do not ignore entrypoint.sh * fix * fix(ci): mount using root priveleges * fix(ci): use existing disk as cached state * fix(ci): wait for disks to get mounted * force rebuild * fix failed force * fix failed commit * WIP * fix(ci): some tests does not use a cached state * wip * refactor(ci): disk names and job segregation * fix(ci): do not name boot and attached disk the same * fix(ci): attach a disk to full sync, to snapshot the state * fix(ci): use correct disk implementations * fix(ci): use different disk name to allow test concurrency * feat(ci): add lightwalledt send transaction test * cleanup(ci): remove extra tests * fix(ci): allow disk concurrency with tests * fix(ci): add considerations for different tests * fix(reusable): last fixes * feat(ci): use reusable workflow for tests * fix(rw): remove nested worflow * fix(rw): minor fixes * force rebuild * fix(rw): do not use an input as job name * fix(rw): remove variable id * fix(ci): remove explicit conditions and id * fix(ci): docker does not need the variable sign ($) to work * fix(ci): mount typo * fix(ci): if a sync fails, always delete the instance This also reduces the amount of jobs needed. * refactor(ci): make all test depend on the same build * fix(ci): some tests require multiple variables * fix(docker): variable substitution * fix(ci): allow to run multiple commits from a PR at once * fix(docker): lower the NETWORK env var for test names * reduce uneeded diff * imp(keys): use better naming for builds_disks * imp(ci): use input defaults * imp(ci): remove test_name in favor of test_id * fix(ci): better key naming * fix(ci): long disk names breaks GCP naming convention * feat(ci): validate local state version with cached state * fix(ci): add condition to run tests * fix: typo * fix: app_name should not be required * fix: zebra_state_path shouldn't be required * fix: reduce diff * fix(ci): checkout to grep local state version * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * revert: merge all tests into a single workflow * Remove unused STATE_VERSION env var * fix: minor fixes * fix(ci): make test.patch the same as test * fix(ci): negate the input value * imp(ci): better cached state conditional handling * imp(ci): exit code is captured by `docker run` * fix(deploy): mount disks with better write performance * fix(ci): change sync id to a broader id name * fix(ci): use correct input validation * fix(ci): do not make test with cached state dependant on other * imp(ci): organiza keys better * fix(ci): use appropiate naming * fix(ci): create docker volume before mounting * fix(lint): do not fail on all new changes * imp(ci): do not report in pr review * fix(ci): partition clean disks * fix: typo * fix: test called the wrong way * fix(build): stop using gha cache * ref(ci): validate run condition before calling reusable workflow * fix(ci): use a better filesystem dir and fix other values * fix: linting errors * fix(ci): typo * Revert "fix(build): stop using gha cache" This reverts commit a8fbc5f416df561e58b388e065d1dc9696983508. Cache expiration is a lesser evil than not using caching at all and then failing with a 401 * imp(ci): do not set a default for needs_zebra_state * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * fix(deps): remove dependencies * force build * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * fix(docker): add RUST_LOG as an ARG and ENV * fix(test): add `#[ignore]` to send transactions test This test needs state then it should be marked as #[ignore] * fix(ci): differentiate between root cache path and its dir * Remove extra `state` directory That was a workaround for an issue that has been fixed. * imp(docs): use better test descriptions Co-authored-by: teor <teor@riseup.net> * fix: reduce unwanted diff with main * fix(ci): make lwd conditions consistent * Remove another extra `state` directory Was also part of a workaround for an issue that has been fixed. * fix(ci): use better conditionals to run test jobs Co-authored-by: teor <teor@riseup.net> * Tweak to support different lightwalletd versions Some versions print `Waiting for block`, and some versions print `Ingestor waiting for block`. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: teor <teor@riseup.net> Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>
2022-05-05 22:30:38 -07:00
if: ${{ github.event.inputs.regenerate-disks != 'true' && github.event.inputs.run-full-sync != 'true' }}
with:
test_id: sync-past-checkpoint
test_description: Test full validation sync from a cached state
test_variables: '-e TEST_CHECKPOINT_SYNC=1 -e ZEBRA_FORCE_USE_COLOR=1'
needs_zebra_state: true
saves_to_disk: false
disk_suffix: checkpoint
# Test that Zebra can run a full mainnet sync and regenerate tip disks.
# Runs:
# - after every PR is merged to `main`
# - on every PR update, but only if Zebra's state version changes in the PR
# - on request
test-full-sync:
needs: build
uses: ./.github/workflows/deploy-gcp-tests.yml
# TODO change `github.ref_name == 'main'` to `startsWith(github.head_ref, 'mergify/merge-queue/')`
# to only run on Mergify head branches, and on manual dispatch:
# 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') || (needs.changed-files.outputs.rebuild == 'true' && github.event_name == 'push') || github.event.inputs.run-full-sync == 'true' }}
with:
test_id: full-sync-to-tip
test_description: Test a full sync up to the tip
test_variables: '-e TEST_FULL_SYNC=1 -e ZEBRA_FORCE_USE_COLOR=1 -e FULL_SYNC_MAINNET_TIMEOUT_MINUTES=600'
needs_zebra_state: false
saves_to_disk: true
disk_suffix: tip
height_grep_text: 'finished initial sync to chain tip, using gossiped blocks sync_percent=100.* current_height=Height'
feat(ci): add `sending_transactions_using_lightwalletd` test to CI (#4267) * feat(ci): add lightwalletd_*_sync tests to CI * feat(ci): add lightwalletd RPC call test * feat(ci): add send transactions test with lwd to CI * fix(ci): create a variable to run transactions test * refactor(ci): use docker in docker This is a workaround for an issue related to disk partitioning, caused by a GCP service called Konlet, while mounting the cached disks to the VM and then to the container * fix(build): persist docker login credentials * fix(ci): get sync height from docker logs instead of gcp * try: use gha cache for faster building * fix(ci): mount disk in container to make it available in vm * fix(build): do not invalidate cache between images * try(docker): invalidate cache as less as possible * fix(ci): GHA terminal is not a TTY * fix(build): do not ignore entrypoint.sh * fix * fix(ci): mount using root priveleges * fix(ci): use existing disk as cached state * fix(ci): wait for disks to get mounted * force rebuild * fix failed force * fix failed commit * WIP * fix(ci): some tests does not use a cached state * wip * refactor(ci): disk names and job segregation * fix(ci): do not name boot and attached disk the same * fix(ci): attach a disk to full sync, to snapshot the state * fix(ci): use correct disk implementations * fix(ci): use different disk name to allow test concurrency * feat(ci): add lightwalledt send transaction test * cleanup(ci): remove extra tests * fix(ci): allow disk concurrency with tests * fix(ci): add considerations for different tests * fix(reusable): last fixes * feat(ci): use reusable workflow for tests * fix(rw): remove nested worflow * fix(rw): minor fixes * force rebuild * fix(rw): do not use an input as job name * fix(rw): remove variable id * fix(ci): remove explicit conditions and id * fix(ci): docker does not need the variable sign ($) to work * fix(ci): mount typo * fix(ci): if a sync fails, always delete the instance This also reduces the amount of jobs needed. * refactor(ci): make all test depend on the same build * fix(ci): some tests require multiple variables * fix(docker): variable substitution * fix(ci): allow to run multiple commits from a PR at once * fix(docker): lower the NETWORK env var for test names * reduce uneeded diff * imp(keys): use better naming for builds_disks * imp(ci): use input defaults * imp(ci): remove test_name in favor of test_id * fix(ci): better key naming * fix(ci): long disk names breaks GCP naming convention * feat(ci): validate local state version with cached state * fix(ci): add condition to run tests * fix: typo * fix: app_name should not be required * fix: zebra_state_path shouldn't be required * fix: reduce diff * fix(ci): checkout to grep local state version * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * revert: merge all tests into a single workflow * Remove unused STATE_VERSION env var * fix: minor fixes * fix(ci): make test.patch the same as test * fix(ci): negate the input value * imp(ci): better cached state conditional handling * imp(ci): exit code is captured by `docker run` * fix(deploy): mount disks with better write performance * fix(ci): change sync id to a broader id name * fix(ci): use correct input validation * fix(ci): do not make test with cached state dependant on other * imp(ci): organiza keys better * fix(ci): use appropiate naming * fix(ci): create docker volume before mounting * fix(lint): do not fail on all new changes * imp(ci): do not report in pr review * fix(ci): partition clean disks * fix: typo * fix: test called the wrong way * fix(build): stop using gha cache * ref(ci): validate run condition before calling reusable workflow * fix(ci): use a better filesystem dir and fix other values * fix: linting errors * fix(ci): typo * Revert "fix(build): stop using gha cache" This reverts commit a8fbc5f416df561e58b388e065d1dc9696983508. Cache expiration is a lesser evil than not using caching at all and then failing with a 401 * imp(ci): do not set a default for needs_zebra_state * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * fix(deps): remove dependencies * force build * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * fix(docker): add RUST_LOG as an ARG and ENV * fix(test): add `#[ignore]` to send transactions test This test needs state then it should be marked as #[ignore] * fix(ci): differentiate between root cache path and its dir * Remove extra `state` directory That was a workaround for an issue that has been fixed. * imp(docs): use better test descriptions Co-authored-by: teor <teor@riseup.net> * fix: reduce unwanted diff with main * fix(ci): make lwd conditions consistent * Remove another extra `state` directory Was also part of a workaround for an issue that has been fixed. * fix(ci): use better conditionals to run test jobs Co-authored-by: teor <teor@riseup.net> * Tweak to support different lightwalletd versions Some versions print `Waiting for block`, and some versions print `Ingestor waiting for block`. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: teor <teor@riseup.net> Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>
2022-05-05 22:30:38 -07:00
# Test that Zebra can answer a synthetic RPC call, using a cached Zebra tip state
lightwalletd-rpc-test:
needs: build
uses: ./.github/workflows/deploy-gcp-tests.yml
feat(ci): add `sending_transactions_using_lightwalletd` test to CI (#4267) * feat(ci): add lightwalletd_*_sync tests to CI * feat(ci): add lightwalletd RPC call test * feat(ci): add send transactions test with lwd to CI * fix(ci): create a variable to run transactions test * refactor(ci): use docker in docker This is a workaround for an issue related to disk partitioning, caused by a GCP service called Konlet, while mounting the cached disks to the VM and then to the container * fix(build): persist docker login credentials * fix(ci): get sync height from docker logs instead of gcp * try: use gha cache for faster building * fix(ci): mount disk in container to make it available in vm * fix(build): do not invalidate cache between images * try(docker): invalidate cache as less as possible * fix(ci): GHA terminal is not a TTY * fix(build): do not ignore entrypoint.sh * fix * fix(ci): mount using root priveleges * fix(ci): use existing disk as cached state * fix(ci): wait for disks to get mounted * force rebuild * fix failed force * fix failed commit * WIP * fix(ci): some tests does not use a cached state * wip * refactor(ci): disk names and job segregation * fix(ci): do not name boot and attached disk the same * fix(ci): attach a disk to full sync, to snapshot the state * fix(ci): use correct disk implementations * fix(ci): use different disk name to allow test concurrency * feat(ci): add lightwalledt send transaction test * cleanup(ci): remove extra tests * fix(ci): allow disk concurrency with tests * fix(ci): add considerations for different tests * fix(reusable): last fixes * feat(ci): use reusable workflow for tests * fix(rw): remove nested worflow * fix(rw): minor fixes * force rebuild * fix(rw): do not use an input as job name * fix(rw): remove variable id * fix(ci): remove explicit conditions and id * fix(ci): docker does not need the variable sign ($) to work * fix(ci): mount typo * fix(ci): if a sync fails, always delete the instance This also reduces the amount of jobs needed. * refactor(ci): make all test depend on the same build * fix(ci): some tests require multiple variables * fix(docker): variable substitution * fix(ci): allow to run multiple commits from a PR at once * fix(docker): lower the NETWORK env var for test names * reduce uneeded diff * imp(keys): use better naming for builds_disks * imp(ci): use input defaults * imp(ci): remove test_name in favor of test_id * fix(ci): better key naming * fix(ci): long disk names breaks GCP naming convention * feat(ci): validate local state version with cached state * fix(ci): add condition to run tests * fix: typo * fix: app_name should not be required * fix: zebra_state_path shouldn't be required * fix: reduce diff * fix(ci): checkout to grep local state version * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * revert: merge all tests into a single workflow * Remove unused STATE_VERSION env var * fix: minor fixes * fix(ci): make test.patch the same as test * fix(ci): negate the input value * imp(ci): better cached state conditional handling * imp(ci): exit code is captured by `docker run` * fix(deploy): mount disks with better write performance * fix(ci): change sync id to a broader id name * fix(ci): use correct input validation * fix(ci): do not make test with cached state dependant on other * imp(ci): organiza keys better * fix(ci): use appropiate naming * fix(ci): create docker volume before mounting * fix(lint): do not fail on all new changes * imp(ci): do not report in pr review * fix(ci): partition clean disks * fix: typo * fix: test called the wrong way * fix(build): stop using gha cache * ref(ci): validate run condition before calling reusable workflow * fix(ci): use a better filesystem dir and fix other values * fix: linting errors * fix(ci): typo * Revert "fix(build): stop using gha cache" This reverts commit a8fbc5f416df561e58b388e065d1dc9696983508. Cache expiration is a lesser evil than not using caching at all and then failing with a 401 * imp(ci): do not set a default for needs_zebra_state * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * fix(deps): remove dependencies * force build * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * fix(docker): add RUST_LOG as an ARG and ENV * fix(test): add `#[ignore]` to send transactions test This test needs state then it should be marked as #[ignore] * fix(ci): differentiate between root cache path and its dir * Remove extra `state` directory That was a workaround for an issue that has been fixed. * imp(docs): use better test descriptions Co-authored-by: teor <teor@riseup.net> * fix: reduce unwanted diff with main * fix(ci): make lwd conditions consistent * Remove another extra `state` directory Was also part of a workaround for an issue that has been fixed. * fix(ci): use better conditionals to run test jobs Co-authored-by: teor <teor@riseup.net> * Tweak to support different lightwalletd versions Some versions print `Waiting for block`, and some versions print `Ingestor waiting for block`. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: teor <teor@riseup.net> Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>
2022-05-05 22:30:38 -07:00
if: ${{ github.event.inputs.regenerate-disks != 'true' && github.event.inputs.run-full-sync != 'true' }}
with:
app_name: lightwalletd
test_id: fully-synced-rpc
test_description: Test lightwalletd RPC with a Zebra tip state
test_variables: '-e TEST_LWD_RPC_CALL=1 -e ZEBRA_TEST_LIGHTWALLETD=1 -e ZEBRA_FORCE_USE_COLOR=1 -e ZEBRA_CACHED_STATE_DIR=/var/cache/zebrad-cache'
needs_zebra_state: true
saves_to_disk: false
disk_suffix: tip
feat(ci): add `sending_transactions_using_lightwalletd` test to CI (#4267) * feat(ci): add lightwalletd_*_sync tests to CI * feat(ci): add lightwalletd RPC call test * feat(ci): add send transactions test with lwd to CI * fix(ci): create a variable to run transactions test * refactor(ci): use docker in docker This is a workaround for an issue related to disk partitioning, caused by a GCP service called Konlet, while mounting the cached disks to the VM and then to the container * fix(build): persist docker login credentials * fix(ci): get sync height from docker logs instead of gcp * try: use gha cache for faster building * fix(ci): mount disk in container to make it available in vm * fix(build): do not invalidate cache between images * try(docker): invalidate cache as less as possible * fix(ci): GHA terminal is not a TTY * fix(build): do not ignore entrypoint.sh * fix * fix(ci): mount using root priveleges * fix(ci): use existing disk as cached state * fix(ci): wait for disks to get mounted * force rebuild * fix failed force * fix failed commit * WIP * fix(ci): some tests does not use a cached state * wip * refactor(ci): disk names and job segregation * fix(ci): do not name boot and attached disk the same * fix(ci): attach a disk to full sync, to snapshot the state * fix(ci): use correct disk implementations * fix(ci): use different disk name to allow test concurrency * feat(ci): add lightwalledt send transaction test * cleanup(ci): remove extra tests * fix(ci): allow disk concurrency with tests * fix(ci): add considerations for different tests * fix(reusable): last fixes * feat(ci): use reusable workflow for tests * fix(rw): remove nested worflow * fix(rw): minor fixes * force rebuild * fix(rw): do not use an input as job name * fix(rw): remove variable id * fix(ci): remove explicit conditions and id * fix(ci): docker does not need the variable sign ($) to work * fix(ci): mount typo * fix(ci): if a sync fails, always delete the instance This also reduces the amount of jobs needed. * refactor(ci): make all test depend on the same build * fix(ci): some tests require multiple variables * fix(docker): variable substitution * fix(ci): allow to run multiple commits from a PR at once * fix(docker): lower the NETWORK env var for test names * reduce uneeded diff * imp(keys): use better naming for builds_disks * imp(ci): use input defaults * imp(ci): remove test_name in favor of test_id * fix(ci): better key naming * fix(ci): long disk names breaks GCP naming convention * feat(ci): validate local state version with cached state * fix(ci): add condition to run tests * fix: typo * fix: app_name should not be required * fix: zebra_state_path shouldn't be required * fix: reduce diff * fix(ci): checkout to grep local state version * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * revert: merge all tests into a single workflow * Remove unused STATE_VERSION env var * fix: minor fixes * fix(ci): make test.patch the same as test * fix(ci): negate the input value * imp(ci): better cached state conditional handling * imp(ci): exit code is captured by `docker run` * fix(deploy): mount disks with better write performance * fix(ci): change sync id to a broader id name * fix(ci): use correct input validation * fix(ci): do not make test with cached state dependant on other * imp(ci): organiza keys better * fix(ci): use appropiate naming * fix(ci): create docker volume before mounting * fix(lint): do not fail on all new changes * imp(ci): do not report in pr review * fix(ci): partition clean disks * fix: typo * fix: test called the wrong way * fix(build): stop using gha cache * ref(ci): validate run condition before calling reusable workflow * fix(ci): use a better filesystem dir and fix other values * fix: linting errors * fix(ci): typo * Revert "fix(build): stop using gha cache" This reverts commit a8fbc5f416df561e58b388e065d1dc9696983508. Cache expiration is a lesser evil than not using caching at all and then failing with a 401 * imp(ci): do not set a default for needs_zebra_state * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * fix(deps): remove dependencies * force build * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * fix(docker): add RUST_LOG as an ARG and ENV * fix(test): add `#[ignore]` to send transactions test This test needs state then it should be marked as #[ignore] * fix(ci): differentiate between root cache path and its dir * Remove extra `state` directory That was a workaround for an issue that has been fixed. * imp(docs): use better test descriptions Co-authored-by: teor <teor@riseup.net> * fix: reduce unwanted diff with main * fix(ci): make lwd conditions consistent * Remove another extra `state` directory Was also part of a workaround for an issue that has been fixed. * fix(ci): use better conditionals to run test jobs Co-authored-by: teor <teor@riseup.net> * Tweak to support different lightwalletd versions Some versions print `Waiting for block`, and some versions print `Ingestor waiting for block`. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: teor <teor@riseup.net> Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>
2022-05-05 22:30:38 -07:00
root_state_path: '/var/cache'
zebra_state_dir: 'zebrad-cache'
# Test that Zebra can handle a lightwalletd send transaction RPC call, using a cached Zebra tip state
# TODO: use a cached lightwalletd tip state to speed up the test (#4303)
lightwalletd-transactions-test:
needs: build
uses: ./.github/workflows/deploy-gcp-tests.yml
feat(ci): add `sending_transactions_using_lightwalletd` test to CI (#4267) * feat(ci): add lightwalletd_*_sync tests to CI * feat(ci): add lightwalletd RPC call test * feat(ci): add send transactions test with lwd to CI * fix(ci): create a variable to run transactions test * refactor(ci): use docker in docker This is a workaround for an issue related to disk partitioning, caused by a GCP service called Konlet, while mounting the cached disks to the VM and then to the container * fix(build): persist docker login credentials * fix(ci): get sync height from docker logs instead of gcp * try: use gha cache for faster building * fix(ci): mount disk in container to make it available in vm * fix(build): do not invalidate cache between images * try(docker): invalidate cache as less as possible * fix(ci): GHA terminal is not a TTY * fix(build): do not ignore entrypoint.sh * fix * fix(ci): mount using root priveleges * fix(ci): use existing disk as cached state * fix(ci): wait for disks to get mounted * force rebuild * fix failed force * fix failed commit * WIP * fix(ci): some tests does not use a cached state * wip * refactor(ci): disk names and job segregation * fix(ci): do not name boot and attached disk the same * fix(ci): attach a disk to full sync, to snapshot the state * fix(ci): use correct disk implementations * fix(ci): use different disk name to allow test concurrency * feat(ci): add lightwalledt send transaction test * cleanup(ci): remove extra tests * fix(ci): allow disk concurrency with tests * fix(ci): add considerations for different tests * fix(reusable): last fixes * feat(ci): use reusable workflow for tests * fix(rw): remove nested worflow * fix(rw): minor fixes * force rebuild * fix(rw): do not use an input as job name * fix(rw): remove variable id * fix(ci): remove explicit conditions and id * fix(ci): docker does not need the variable sign ($) to work * fix(ci): mount typo * fix(ci): if a sync fails, always delete the instance This also reduces the amount of jobs needed. * refactor(ci): make all test depend on the same build * fix(ci): some tests require multiple variables * fix(docker): variable substitution * fix(ci): allow to run multiple commits from a PR at once * fix(docker): lower the NETWORK env var for test names * reduce uneeded diff * imp(keys): use better naming for builds_disks * imp(ci): use input defaults * imp(ci): remove test_name in favor of test_id * fix(ci): better key naming * fix(ci): long disk names breaks GCP naming convention * feat(ci): validate local state version with cached state * fix(ci): add condition to run tests * fix: typo * fix: app_name should not be required * fix: zebra_state_path shouldn't be required * fix: reduce diff * fix(ci): checkout to grep local state version * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * revert: merge all tests into a single workflow * Remove unused STATE_VERSION env var * fix: minor fixes * fix(ci): make test.patch the same as test * fix(ci): negate the input value * imp(ci): better cached state conditional handling * imp(ci): exit code is captured by `docker run` * fix(deploy): mount disks with better write performance * fix(ci): change sync id to a broader id name * fix(ci): use correct input validation * fix(ci): do not make test with cached state dependant on other * imp(ci): organiza keys better * fix(ci): use appropiate naming * fix(ci): create docker volume before mounting * fix(lint): do not fail on all new changes * imp(ci): do not report in pr review * fix(ci): partition clean disks * fix: typo * fix: test called the wrong way * fix(build): stop using gha cache * ref(ci): validate run condition before calling reusable workflow * fix(ci): use a better filesystem dir and fix other values * fix: linting errors * fix(ci): typo * Revert "fix(build): stop using gha cache" This reverts commit a8fbc5f416df561e58b388e065d1dc9696983508. Cache expiration is a lesser evil than not using caching at all and then failing with a 401 * imp(ci): do not set a default for needs_zebra_state * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * fix(deps): remove dependencies * force build * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * fix(docker): add RUST_LOG as an ARG and ENV * fix(test): add `#[ignore]` to send transactions test This test needs state then it should be marked as #[ignore] * fix(ci): differentiate between root cache path and its dir * Remove extra `state` directory That was a workaround for an issue that has been fixed. * imp(docs): use better test descriptions Co-authored-by: teor <teor@riseup.net> * fix: reduce unwanted diff with main * fix(ci): make lwd conditions consistent * Remove another extra `state` directory Was also part of a workaround for an issue that has been fixed. * fix(ci): use better conditionals to run test jobs Co-authored-by: teor <teor@riseup.net> * Tweak to support different lightwalletd versions Some versions print `Waiting for block`, and some versions print `Ingestor waiting for block`. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: teor <teor@riseup.net> Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>
2022-05-05 22:30:38 -07:00
if: ${{ github.event.inputs.regenerate-disks != 'true' && github.event.inputs.run-full-sync != 'true' }}
with:
app_name: lightwalletd
test_id: lwd-send-transactions
test_description: Test sending transactions via lightwalletd
test_variables: '-e TEST_LWD_TRANSACTIONS=1 -e ZEBRA_TEST_LIGHTWALLETD=1 -e ZEBRA_FORCE_USE_COLOR=1 -e ZEBRA_CACHED_STATE_DIR=/var/cache/zebrad-cache -e LIGHTWALLETD_DATA_DIR=/var/cache/lwd-cache'
feat(ci): add `sending_transactions_using_lightwalletd` test to CI (#4267) * feat(ci): add lightwalletd_*_sync tests to CI * feat(ci): add lightwalletd RPC call test * feat(ci): add send transactions test with lwd to CI * fix(ci): create a variable to run transactions test * refactor(ci): use docker in docker This is a workaround for an issue related to disk partitioning, caused by a GCP service called Konlet, while mounting the cached disks to the VM and then to the container * fix(build): persist docker login credentials * fix(ci): get sync height from docker logs instead of gcp * try: use gha cache for faster building * fix(ci): mount disk in container to make it available in vm * fix(build): do not invalidate cache between images * try(docker): invalidate cache as less as possible * fix(ci): GHA terminal is not a TTY * fix(build): do not ignore entrypoint.sh * fix * fix(ci): mount using root priveleges * fix(ci): use existing disk as cached state * fix(ci): wait for disks to get mounted * force rebuild * fix failed force * fix failed commit * WIP * fix(ci): some tests does not use a cached state * wip * refactor(ci): disk names and job segregation * fix(ci): do not name boot and attached disk the same * fix(ci): attach a disk to full sync, to snapshot the state * fix(ci): use correct disk implementations * fix(ci): use different disk name to allow test concurrency * feat(ci): add lightwalledt send transaction test * cleanup(ci): remove extra tests * fix(ci): allow disk concurrency with tests * fix(ci): add considerations for different tests * fix(reusable): last fixes * feat(ci): use reusable workflow for tests * fix(rw): remove nested worflow * fix(rw): minor fixes * force rebuild * fix(rw): do not use an input as job name * fix(rw): remove variable id * fix(ci): remove explicit conditions and id * fix(ci): docker does not need the variable sign ($) to work * fix(ci): mount typo * fix(ci): if a sync fails, always delete the instance This also reduces the amount of jobs needed. * refactor(ci): make all test depend on the same build * fix(ci): some tests require multiple variables * fix(docker): variable substitution * fix(ci): allow to run multiple commits from a PR at once * fix(docker): lower the NETWORK env var for test names * reduce uneeded diff * imp(keys): use better naming for builds_disks * imp(ci): use input defaults * imp(ci): remove test_name in favor of test_id * fix(ci): better key naming * fix(ci): long disk names breaks GCP naming convention * feat(ci): validate local state version with cached state * fix(ci): add condition to run tests * fix: typo * fix: app_name should not be required * fix: zebra_state_path shouldn't be required * fix: reduce diff * fix(ci): checkout to grep local state version * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * revert: merge all tests into a single workflow * Remove unused STATE_VERSION env var * fix: minor fixes * fix(ci): make test.patch the same as test * fix(ci): negate the input value * imp(ci): better cached state conditional handling * imp(ci): exit code is captured by `docker run` * fix(deploy): mount disks with better write performance * fix(ci): change sync id to a broader id name * fix(ci): use correct input validation * fix(ci): do not make test with cached state dependant on other * imp(ci): organiza keys better * fix(ci): use appropiate naming * fix(ci): create docker volume before mounting * fix(lint): do not fail on all new changes * imp(ci): do not report in pr review * fix(ci): partition clean disks * fix: typo * fix: test called the wrong way * fix(build): stop using gha cache * ref(ci): validate run condition before calling reusable workflow * fix(ci): use a better filesystem dir and fix other values * fix: linting errors * fix(ci): typo * Revert "fix(build): stop using gha cache" This reverts commit a8fbc5f416df561e58b388e065d1dc9696983508. Cache expiration is a lesser evil than not using caching at all and then failing with a 401 * imp(ci): do not set a default for needs_zebra_state * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * fix(deps): remove dependencies * force build * Update .github/workflows/test.yml Co-authored-by: teor <teor@riseup.net> * fix(docker): add RUST_LOG as an ARG and ENV * fix(test): add `#[ignore]` to send transactions test This test needs state then it should be marked as #[ignore] * fix(ci): differentiate between root cache path and its dir * Remove extra `state` directory That was a workaround for an issue that has been fixed. * imp(docs): use better test descriptions Co-authored-by: teor <teor@riseup.net> * fix: reduce unwanted diff with main * fix(ci): make lwd conditions consistent * Remove another extra `state` directory Was also part of a workaround for an issue that has been fixed. * fix(ci): use better conditionals to run test jobs Co-authored-by: teor <teor@riseup.net> * Tweak to support different lightwalletd versions Some versions print `Waiting for block`, and some versions print `Ingestor waiting for block`. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: teor <teor@riseup.net> Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>
2022-05-05 22:30:38 -07:00
needs_zebra_state: true
saves_to_disk: false
disk_suffix: tip
root_state_path: '/var/cache'
zebra_state_dir: 'zebrad-cache'
# Test full sync of lightwalletd with a Zebra tip state
lightwalletd-full-sync:
needs: build
uses: ./.github/workflows/deploy-gcp-tests.yml
if: ${{ github.event.inputs.regenerate-disks != 'true' && github.event.inputs.run-full-sync != 'true' }}
with:
app_name: lightwalletd
test_id: lwd-full-sync
test_description: Test lightwalletd full sync
test_variables: '-e TEST_LWD_FULL_SYNC=1 -e ZEBRA_TEST_LIGHTWALLETD=1 -e ZEBRA_FORCE_USE_COLOR=1 -e ZEBRA_CACHED_STATE_DIR=/var/cache/zebrad-cache -e LIGHTWALLETD_DATA_DIR=/var/cache/lwd-cache'
needs_zebra_state: true
saves_to_disk: true
disk_prefix: lwd-cache
disk_suffix: tip
root_state_path: '/var/cache'
zebra_state_dir: 'zebrad-cache'
lwd_state_dir: 'lwd-cache'