feat(ci)!: implement reusable workflows for image building (#4173)
* refactor(ci): test building in a separate workflow * force a change * force a change * fix(ci): send the correct variables to the reusable build * fix(ci): variables are not allowed * fix(ci): conditions are not allowed as input * fix(ci): use expected value * refactor(build): simplify the use of other dockerfiles * fix(cd): depend on docker build yml * fix(cd): use main branch as image name * imp(actions): remove uneeded variable repetition * imp(build): remove unused variables * imp(actions): rename the image building workflow Not all images are for zebra execution as we also have one for zcash-params * fix(ci): add dependable workflow in paths filters * docs(ci): remove TODO as this won't be needed at least an issue arises * docs(ci): CARGO_INCREMENTAL can decrease build time when running from a cache * fix: revert forced changes * fix(build): remove unused build inputs in zcash-params * imp(cd): as this is the production image, use the executable name * imp(ci): reduce log level to improve speed Co-authored-by: teor <teor@riseup.net> * imp(ci): use the correct name for the workflow Co-authored-by: teor <teor@riseup.net> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: teor <teor@riseup.net>
This commit is contained in:
parent
597f55319d
commit
83d26890f5
|
@ -16,113 +16,24 @@ on:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_INCREMENTAL: '1'
|
|
||||||
NETWORK: Mainnet
|
NETWORK: Mainnet
|
||||||
PROJECT_ID: zealous-zebra
|
|
||||||
GAR_BASE: us-docker.pkg.dev/zealous-zebra/zebra
|
GAR_BASE: us-docker.pkg.dev/zealous-zebra/zebra
|
||||||
GCR_BASE: gcr.io/zealous-zebra
|
|
||||||
REGION: us-central1
|
REGION: us-central1
|
||||||
ZONE: us-central1-a
|
ZONE: us-central1-a
|
||||||
MACHINE_TYPE: c2-standard-4
|
MACHINE_TYPE: c2-standard-4
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build images
|
uses: ./.github/workflows/docker-image-build.yml
|
||||||
# TODO: remove timeout until we have an average build time
|
with:
|
||||||
# timeout-minutes: 180
|
dockerfile_path: ./docker/Dockerfile
|
||||||
runs-on: ubuntu-latest
|
dockerfile_target: runtime
|
||||||
permissions:
|
image_name: zebrad
|
||||||
contents: 'read'
|
network: Mainnet
|
||||||
id-token: 'write'
|
checkpoint_sync: true
|
||||||
|
rust_backtrace: '1'
|
||||||
steps:
|
zebra_skip_ipv6_tests: '1'
|
||||||
- uses: actions/checkout@v3.0.2
|
rust_log: info
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Inject slug/short variables
|
|
||||||
uses: rlespinasse/github-slug-action@v4
|
|
||||||
with:
|
|
||||||
short-length: 7
|
|
||||||
|
|
||||||
# Automatic tag management and OCI Image Format Specification for labels
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v3.7.0
|
|
||||||
with:
|
|
||||||
# list of Docker images to use as base name for tags
|
|
||||||
images: |
|
|
||||||
${{ env.GAR_BASE }}/${{ env.GITHUB_REF_SLUG_URL }}
|
|
||||||
${{ env.GCR_BASE }}/${{ env.GITHUB_REPOSITORY_SLUG_URL }}/${{ env.GITHUB_REF_SLUG_URL }}
|
|
||||||
# generate Docker tags based on the following events/attributes
|
|
||||||
tags: |
|
|
||||||
type=schedule
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=pr
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
type=sha
|
|
||||||
|
|
||||||
# Setup gcloud CLI
|
|
||||||
- name: Authenticate to Google Cloud
|
|
||||||
id: auth
|
|
||||||
uses: google-github-actions/auth@v0.7.1
|
|
||||||
with:
|
|
||||||
workload_identity_provider: 'projects/143793276228/locations/global/workloadIdentityPools/github-actions/providers/github-oidc'
|
|
||||||
service_account: 'github-service-account@zealous-zebra.iam.gserviceaccount.com'
|
|
||||||
token_format: 'access_token'
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
id: qemu
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
with:
|
|
||||||
image: tonistiigi/binfmt:latest
|
|
||||||
platforms: all
|
|
||||||
|
|
||||||
# Setup Docker Buildx to allow use of docker cache layers from GH
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Login to Google Artifact Registry
|
|
||||||
uses: docker/login-action@v1.14.1
|
|
||||||
with:
|
|
||||||
registry: us-docker.pkg.dev
|
|
||||||
username: oauth2accesstoken
|
|
||||||
password: ${{ steps.auth.outputs.access_token }}
|
|
||||||
|
|
||||||
- name: Login to Google Container Registry
|
|
||||||
uses: docker/login-action@v1.14.1
|
|
||||||
with:
|
|
||||||
registry: gcr.io
|
|
||||||
username: oauth2accesstoken
|
|
||||||
password: ${{ steps.auth.outputs.access_token }}
|
|
||||||
|
|
||||||
# Build and push image to Google Artifact Registry
|
|
||||||
- name: Build & push
|
|
||||||
id: docker_build
|
|
||||||
uses: docker/build-push-action@v2.10.0
|
|
||||||
with:
|
|
||||||
target: runtime
|
|
||||||
context: .
|
|
||||||
file: ./docker/Dockerfile
|
|
||||||
# TODO: building crates is taking too long with arm64 and it's timing out on GHA
|
|
||||||
# platforms: |
|
|
||||||
# linux/amd64
|
|
||||||
# linux/arm64
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
build-args: |
|
|
||||||
NETWORK=${{ github.event.inputs.network || env.NETWORK }}
|
|
||||||
SHORT_SHA=${{ env.GITHUB_SHA_SHORT }}
|
|
||||||
RUST_BACKTRACE=1
|
|
||||||
ZEBRA_SKIP_IPV6_TESTS="1"
|
|
||||||
CHECKPOINT_SYNC=${{ github.event.inputs.checkpoint_sync || true }}
|
|
||||||
SENTRY_DSN=${{ secrets.SENTRY_ENDPOINT }}
|
|
||||||
push: true
|
|
||||||
cache-from: type=registry,ref=${{ env.GAR_BASE }}/${{ env.GITHUB_REF_SLUG_URL }}:buildcache
|
|
||||||
cache-to: type=registry,ref=${{ env.GAR_BASE }}/${{ env.GITHUB_REF_SLUG_URL }}:buildcache,mode=max
|
|
||||||
|
|
||||||
deploy-nodes:
|
deploy-nodes:
|
||||||
name: Deploy Mainnet nodes
|
name: Deploy Mainnet nodes
|
||||||
|
|
|
@ -0,0 +1,125 @@
|
||||||
|
name: Build docker image
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
network:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
checkpoint_sync:
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
image_name:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
dockerfile_path:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
dockerfile_target:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
short_sha:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
rust_backtrace:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
rust_lib_backtrace:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
colorbt_show_hidden:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
zebra_skip_ipv6_tests:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
rust_log:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build images
|
||||||
|
timeout-minutes: 210
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: 'read'
|
||||||
|
id-token: 'write'
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3.0.2
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Inject slug/short variables
|
||||||
|
uses: rlespinasse/github-slug-action@v4
|
||||||
|
with:
|
||||||
|
short-length: 7
|
||||||
|
|
||||||
|
# Automatic tag management and OCI Image Format Specification for labels
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3.7.0
|
||||||
|
with:
|
||||||
|
# list of Docker images to use as base name for tags
|
||||||
|
images: |
|
||||||
|
us-docker.pkg.dev/zealous-zebra/zebra/${{ inputs.image_name }}
|
||||||
|
gcr.io/zealous-zebra/zcashfoundation-zebra/${{ inputs.image_name }}
|
||||||
|
# generate Docker tags based on the following events/attributes
|
||||||
|
tags: |
|
||||||
|
type=schedule
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=sha
|
||||||
|
|
||||||
|
# Setup Docker Buildx to allow use of docker cache layers from GH
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Authenticate to Google Cloud
|
||||||
|
id: auth
|
||||||
|
uses: google-github-actions/auth@v0.7.1
|
||||||
|
with:
|
||||||
|
workload_identity_provider: 'projects/143793276228/locations/global/workloadIdentityPools/github-actions/providers/github-oidc'
|
||||||
|
service_account: 'github-service-account@zealous-zebra.iam.gserviceaccount.com'
|
||||||
|
token_format: 'access_token'
|
||||||
|
|
||||||
|
- name: Login to Google Artifact Registry
|
||||||
|
uses: docker/login-action@v1.14.1
|
||||||
|
with:
|
||||||
|
registry: us-docker.pkg.dev
|
||||||
|
username: oauth2accesstoken
|
||||||
|
password: ${{ steps.auth.outputs.access_token }}
|
||||||
|
|
||||||
|
- name: Login to Google Container Registry
|
||||||
|
uses: docker/login-action@v1.14.1
|
||||||
|
with:
|
||||||
|
registry: gcr.io
|
||||||
|
username: oauth2accesstoken
|
||||||
|
password: ${{ steps.auth.outputs.access_token }}
|
||||||
|
|
||||||
|
# Build and push image to Google Artifact Registry
|
||||||
|
- name: Build & push
|
||||||
|
id: docker_build
|
||||||
|
uses: docker/build-push-action@v2.10.0
|
||||||
|
with:
|
||||||
|
target: ${{ inputs.dockerfile_target }}
|
||||||
|
context: .
|
||||||
|
file: ${{ inputs.dockerfile_path }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
build-args: |
|
||||||
|
NETWORK=${{ inputs.network }}
|
||||||
|
SHORT_SHA=${{ env.GITHUB_SHA_SHORT }}
|
||||||
|
RUST_BACKTRACE=${{ inputs.rust_backtrace }}
|
||||||
|
RUST_LIB_BACKTRACE=${{ inputs.rust_lib_backtrace }}
|
||||||
|
COLORBT_SHOW_HIDDEN=${{ inputs.colorbt_show_hidden }}
|
||||||
|
ZEBRA_SKIP_IPV6_TESTS=${{ inputs.zebra_skip_ipv6_tests }}
|
||||||
|
CHECKPOINT_SYNC=${{ inputs.checkpoint_sync }}
|
||||||
|
RUST_LOG=${{ inputs.rust_log }}
|
||||||
|
push: true
|
||||||
|
cache-from: type=registry,ref=us-docker.pkg.dev/zealous-zebra/zebra/${{ inputs.image_name }}:${{ env.GITHUB_REF_SLUG_URL }}-buildcache
|
||||||
|
cache-to: type=registry,ref=us-docker.pkg.dev/zealous-zebra/zebra/${{ inputs.image_name }}:${{ env.GITHUB_REF_SLUG_URL }}-buildcache,mode=max
|
|
@ -43,21 +43,16 @@ on:
|
||||||
# workflow definitions
|
# workflow definitions
|
||||||
- 'docker/**'
|
- 'docker/**'
|
||||||
- '.github/workflows/test-full-sync.yml'
|
- '.github/workflows/test-full-sync.yml'
|
||||||
|
- '.github/workflows/docker-image-build.yml'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_INCREMENTAL: '1'
|
|
||||||
ZEBRA_SKIP_IPV6_TESTS: '1'
|
|
||||||
RUST_BACKTRACE: full
|
|
||||||
RUST_LIB_BACKTRACE: full
|
|
||||||
COLORBT_SHOW_HIDDEN: '1'
|
|
||||||
NETWORK: Mainnet
|
NETWORK: Mainnet
|
||||||
PROJECT_ID: zealous-zebra
|
PROJECT_ID: zealous-zebra
|
||||||
|
IMAGE_NAME: zebrad-test
|
||||||
GAR_BASE: us-docker.pkg.dev/zealous-zebra/zebra
|
GAR_BASE: us-docker.pkg.dev/zealous-zebra/zebra
|
||||||
GCR_BASE: gcr.io/zealous-zebra
|
|
||||||
REGION: us-central1
|
REGION: us-central1
|
||||||
ZONE: us-central1-a
|
ZONE: us-central1-a
|
||||||
MACHINE_TYPE: c2d-standard-16
|
MACHINE_TYPE: c2d-standard-16
|
||||||
IMAGE_NAME: zebrad-test
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -65,91 +60,18 @@ jobs:
|
||||||
# only run on Mergify head branches, and on manual dispatch:
|
# 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
|
# 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.event_name == 'workflow_dispatch' }}
|
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
|
||||||
name: Build images
|
uses: ./.github/workflows/docker-image-build.yml
|
||||||
timeout-minutes: 210
|
with:
|
||||||
runs-on: ubuntu-latest
|
dockerfile_path: ./docker/Dockerfile
|
||||||
permissions:
|
dockerfile_target: tester
|
||||||
contents: 'read'
|
image_name: zebrad-test
|
||||||
id-token: 'write'
|
network: Mainnet
|
||||||
steps:
|
checkpoint_sync: true
|
||||||
- uses: actions/checkout@v3.0.2
|
rust_backtrace: full
|
||||||
with:
|
rust_lib_backtrace: full
|
||||||
persist-credentials: false
|
colorbt_show_hidden: '1'
|
||||||
|
zebra_skip_ipv6_tests: '1'
|
||||||
- name: Inject slug/short variables
|
rust_log: info
|
||||||
uses: rlespinasse/github-slug-action@v4
|
|
||||||
with:
|
|
||||||
short-length: 7
|
|
||||||
|
|
||||||
# Automatic tag management and OCI Image Format Specification for labels
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v3.7.0
|
|
||||||
with:
|
|
||||||
# list of Docker images to use as base name for tags
|
|
||||||
images: |
|
|
||||||
${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}
|
|
||||||
${{ env.GCR_BASE }}/${{ env.GITHUB_REPOSITORY_SLUG_URL }}/${{ env.IMAGE_NAME }}
|
|
||||||
# generate Docker tags based on the following events/attributes
|
|
||||||
tags: |
|
|
||||||
type=schedule
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=pr
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
type=sha
|
|
||||||
|
|
||||||
# Setup Docker Buildx to allow use of docker cache layers from GH
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Authenticate to Google Cloud
|
|
||||||
id: auth
|
|
||||||
uses: google-github-actions/auth@v0.7.1
|
|
||||||
with:
|
|
||||||
workload_identity_provider: 'projects/143793276228/locations/global/workloadIdentityPools/github-actions/providers/github-oidc'
|
|
||||||
service_account: 'github-service-account@zealous-zebra.iam.gserviceaccount.com'
|
|
||||||
token_format: 'access_token'
|
|
||||||
|
|
||||||
- name: Login to Google Artifact Registry
|
|
||||||
uses: docker/login-action@v1.14.1
|
|
||||||
with:
|
|
||||||
registry: us-docker.pkg.dev
|
|
||||||
username: oauth2accesstoken
|
|
||||||
password: ${{ steps.auth.outputs.access_token }}
|
|
||||||
|
|
||||||
- name: Login to Google Container Registry
|
|
||||||
uses: docker/login-action@v1.14.1
|
|
||||||
with:
|
|
||||||
registry: gcr.io
|
|
||||||
username: oauth2accesstoken
|
|
||||||
password: ${{ steps.auth.outputs.access_token }}
|
|
||||||
|
|
||||||
# Build and push image to Google Artifact Registry
|
|
||||||
- name: Build & push
|
|
||||||
id: docker_build
|
|
||||||
uses: docker/build-push-action@v2.10.0
|
|
||||||
with:
|
|
||||||
target: tester
|
|
||||||
context: .
|
|
||||||
file: ./docker/Dockerfile
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
build-args: |
|
|
||||||
NETWORK=${{ github.event.inputs.network || env.NETWORK }}
|
|
||||||
SHORT_SHA=${{ env.GITHUB_SHA_SHORT }}
|
|
||||||
RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}
|
|
||||||
RUST_LIB_BACKTRACE=${{ env.RUST_LIB_BACKTRACE }}
|
|
||||||
COLORBT_SHOW_HIDDEN=${{ env.COLORBT_SHOW_HIDDEN }}
|
|
||||||
ZEBRA_SKIP_NETWORK_TESTS="1"
|
|
||||||
CHECKPOINT_SYNC=${{ github.event.inputs.checkpoint_sync || true }}
|
|
||||||
RUST_LOG=debug
|
|
||||||
SENTRY_DSN=${{ secrets.SENTRY_ENDPOINT }}
|
|
||||||
push: true
|
|
||||||
cache-from: type=registry,ref=${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_REF_SLUG_URL }}-buildcache
|
|
||||||
cache-to: type=registry,ref=${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_REF_SLUG_URL }}-buildcache,mode=max
|
|
||||||
|
|
||||||
# Test that Zebra can run a full mainnet sync after a PR is approved
|
# Test that Zebra can run a full mainnet sync after a PR is approved
|
||||||
test-full-sync:
|
test-full-sync:
|
||||||
|
@ -203,7 +125,7 @@ jobs:
|
||||||
--container-restart-policy=never \
|
--container-restart-policy=never \
|
||||||
--container-stdin \
|
--container-stdin \
|
||||||
--container-tty \
|
--container-tty \
|
||||||
--container-env=ZEBRA_SKIP_IPV6_TESTS=1,TEST_FULL_SYNC=1,ZEBRA_FORCE_USE_COLOR=1,FULL_SYNC_MAINNET_TIMEOUT_MINUTES=600 \
|
--container-env=TEST_FULL_SYNC=1,ZEBRA_FORCE_USE_COLOR=1,FULL_SYNC_MAINNET_TIMEOUT_MINUTES=600 \
|
||||||
--machine-type ${{ env.MACHINE_TYPE }} \
|
--machine-type ${{ env.MACHINE_TYPE }} \
|
||||||
--scopes cloud-platform \
|
--scopes cloud-platform \
|
||||||
--metadata=google-monitoring-enabled=true,google-logging-enabled=true \
|
--metadata=google-monitoring-enabled=true,google-logging-enabled=true \
|
||||||
|
|
|
@ -12,6 +12,7 @@ on:
|
||||||
- '**/Cargo.lock'
|
- '**/Cargo.lock'
|
||||||
- 'docker/**'
|
- 'docker/**'
|
||||||
- '.github/workflows/test.yml'
|
- '.github/workflows/test.yml'
|
||||||
|
- '.github/workflows/docker-image-build.yml'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
|
@ -49,109 +49,31 @@ on:
|
||||||
# workflow definitions
|
# workflow definitions
|
||||||
- 'docker/**'
|
- 'docker/**'
|
||||||
- '.github/workflows/test.yml'
|
- '.github/workflows/test.yml'
|
||||||
|
- '.github/workflows/docker-image-build.yml'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_INCREMENTAL: '1'
|
|
||||||
ZEBRA_SKIP_IPV6_TESTS: '1'
|
|
||||||
RUST_BACKTRACE: full
|
|
||||||
RUST_LIB_BACKTRACE: full
|
|
||||||
COLORBT_SHOW_HIDDEN: '1'
|
|
||||||
NETWORK: Mainnet
|
NETWORK: Mainnet
|
||||||
PROJECT_ID: zealous-zebra
|
PROJECT_ID: zealous-zebra
|
||||||
|
IMAGE_NAME: zebrad-test
|
||||||
GAR_BASE: us-docker.pkg.dev/zealous-zebra/zebra
|
GAR_BASE: us-docker.pkg.dev/zealous-zebra/zebra
|
||||||
GCR_BASE: gcr.io/zealous-zebra
|
|
||||||
REGION: us-central1
|
REGION: us-central1
|
||||||
ZONE: us-central1-a
|
ZONE: us-central1-a
|
||||||
MACHINE_TYPE: c2d-standard-4
|
MACHINE_TYPE: c2d-standard-4
|
||||||
IMAGE_NAME: zebrad-test
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build images
|
uses: ./.github/workflows/docker-image-build.yml
|
||||||
timeout-minutes: 210
|
with:
|
||||||
runs-on: ubuntu-latest
|
dockerfile_path: ./docker/Dockerfile
|
||||||
permissions:
|
dockerfile_target: tester
|
||||||
contents: 'read'
|
image_name: zebrad-test
|
||||||
id-token: 'write'
|
network: Mainnet
|
||||||
steps:
|
checkpoint_sync: true
|
||||||
- uses: actions/checkout@v3.0.2
|
rust_backtrace: full
|
||||||
with:
|
rust_lib_backtrace: full
|
||||||
persist-credentials: false
|
colorbt_show_hidden: '1'
|
||||||
|
zebra_skip_ipv6_tests: '1'
|
||||||
- name: Inject slug/short variables
|
rust_log: info
|
||||||
uses: rlespinasse/github-slug-action@v4
|
|
||||||
with:
|
|
||||||
short-length: 7
|
|
||||||
|
|
||||||
# Automatic tag management and OCI Image Format Specification for labels
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v3.7.0
|
|
||||||
with:
|
|
||||||
# list of Docker images to use as base name for tags
|
|
||||||
images: |
|
|
||||||
${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}
|
|
||||||
${{ env.GCR_BASE }}/${{ env.GITHUB_REPOSITORY_SLUG_URL }}/${{ env.IMAGE_NAME }}
|
|
||||||
# generate Docker tags based on the following events/attributes
|
|
||||||
tags: |
|
|
||||||
type=schedule
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=pr
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
type=sha
|
|
||||||
|
|
||||||
# Setup Docker Buildx to allow use of docker cache layers from GH
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Authenticate to Google Cloud
|
|
||||||
id: auth
|
|
||||||
uses: google-github-actions/auth@v0.7.1
|
|
||||||
with:
|
|
||||||
workload_identity_provider: 'projects/143793276228/locations/global/workloadIdentityPools/github-actions/providers/github-oidc'
|
|
||||||
service_account: 'github-service-account@zealous-zebra.iam.gserviceaccount.com'
|
|
||||||
token_format: 'access_token'
|
|
||||||
|
|
||||||
- name: Login to Google Artifact Registry
|
|
||||||
uses: docker/login-action@v1.14.1
|
|
||||||
with:
|
|
||||||
registry: us-docker.pkg.dev
|
|
||||||
username: oauth2accesstoken
|
|
||||||
password: ${{ steps.auth.outputs.access_token }}
|
|
||||||
|
|
||||||
- name: Login to Google Container Registry
|
|
||||||
uses: docker/login-action@v1.14.1
|
|
||||||
with:
|
|
||||||
registry: gcr.io
|
|
||||||
username: oauth2accesstoken
|
|
||||||
password: ${{ steps.auth.outputs.access_token }}
|
|
||||||
|
|
||||||
# Build and push image to Google Artifact Registry
|
|
||||||
- name: Build & push
|
|
||||||
id: docker_build
|
|
||||||
uses: docker/build-push-action@v2.10.0
|
|
||||||
with:
|
|
||||||
target: tester
|
|
||||||
context: .
|
|
||||||
file: ./docker/Dockerfile
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
build-args: |
|
|
||||||
NETWORK=${{ github.event.inputs.network || env.NETWORK }}
|
|
||||||
SHORT_SHA=${{ env.GITHUB_SHA_SHORT }}
|
|
||||||
RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}
|
|
||||||
RUST_LIB_BACKTRACE=${{ env.RUST_LIB_BACKTRACE }}
|
|
||||||
COLORBT_SHOW_HIDDEN=${{ env.COLORBT_SHOW_HIDDEN }}
|
|
||||||
ZEBRA_SKIP_NETWORK_TESTS="1"
|
|
||||||
CHECKPOINT_SYNC=${{ github.event.inputs.checkpoint_sync || true }}
|
|
||||||
RUST_LOG=debug
|
|
||||||
SENTRY_DSN=${{ secrets.SENTRY_ENDPOINT }}
|
|
||||||
push: true
|
|
||||||
cache-from: type=registry,ref=${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_REF_SLUG_URL }}-buildcache
|
|
||||||
cache-to: type=registry,ref=${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:${{ env.GITHUB_REF_SLUG_URL }}-buildcache,mode=max
|
|
||||||
|
|
||||||
# Run all the zebra tests, including tests that are ignored by default
|
# Run all the zebra tests, including tests that are ignored by default
|
||||||
test-all:
|
test-all:
|
||||||
|
@ -168,7 +90,7 @@ jobs:
|
||||||
- name: Run all zebrad tests
|
- name: Run all zebrad tests
|
||||||
run: |
|
run: |
|
||||||
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}
|
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}
|
||||||
docker run -e ZEBRA_SKIP_IPV6_TESTS --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} cargo test --locked --release --features enable-sentry --workspace -- --include-ignored
|
docker run --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} cargo test --locked --release --features enable-sentry --workspace -- --include-ignored
|
||||||
|
|
||||||
# This test changes zebra-chain's activation heights,
|
# This test changes zebra-chain's activation heights,
|
||||||
# which can recompile all the Zebra crates,
|
# which can recompile all the Zebra crates,
|
||||||
|
@ -189,7 +111,7 @@ jobs:
|
||||||
- name: Run tests with fake activation heights
|
- name: Run tests with fake activation heights
|
||||||
run: |
|
run: |
|
||||||
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}
|
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}
|
||||||
docker run -e ZEBRA_SKIP_IPV6_TESTS -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 -- with_fake_activation_heights
|
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 -- with_fake_activation_heights
|
||||||
env:
|
env:
|
||||||
TEST_FAKE_ACTIVATION_HEIGHTS: '1'
|
TEST_FAKE_ACTIVATION_HEIGHTS: '1'
|
||||||
|
|
||||||
|
@ -208,7 +130,7 @@ jobs:
|
||||||
- name: Run zebrad large sync tests
|
- name: Run zebrad large sync tests
|
||||||
run: |
|
run: |
|
||||||
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}
|
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}
|
||||||
docker run -e ZEBRA_SKIP_IPV6_TESTS --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} cargo test --locked --release --features enable-sentry --test acceptance sync_large_checkpoints_ -- --ignored
|
docker run --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} cargo test --locked --release --features enable-sentry --test acceptance sync_large_checkpoints_ -- --ignored
|
||||||
|
|
||||||
test-lightwalletd-integration:
|
test-lightwalletd-integration:
|
||||||
name: Test integration with lightwalletd
|
name: Test integration with lightwalletd
|
||||||
|
@ -224,7 +146,7 @@ jobs:
|
||||||
- name: Run tests with included lightwalletd binary
|
- name: Run tests with included lightwalletd binary
|
||||||
run: |
|
run: |
|
||||||
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}
|
docker pull ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }}
|
||||||
docker run -e ZEBRA_SKIP_IPV6_TESTS -e ZEBRA_TEST_LIGHTWALLETD --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} cargo test --locked --release --features enable-sentry --test acceptance -- lightwalletd_integration --nocapture
|
docker run -e ZEBRA_TEST_LIGHTWALLETD --name zebrad-tests -t ${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA_SHORT }} cargo test --locked --release --features enable-sentry --test acceptance -- lightwalletd_integration --nocapture
|
||||||
env:
|
env:
|
||||||
ZEBRA_TEST_LIGHTWALLETD: '1'
|
ZEBRA_TEST_LIGHTWALLETD: '1'
|
||||||
|
|
||||||
|
@ -311,7 +233,6 @@ jobs:
|
||||||
--container-arg="--manifest-path" \
|
--container-arg="--manifest-path" \
|
||||||
--container-arg="zebrad/Cargo.toml" \
|
--container-arg="zebrad/Cargo.toml" \
|
||||||
--container-arg="sync_to_mandatory_checkpoint_${{ env.NETWORK }}" \
|
--container-arg="sync_to_mandatory_checkpoint_${{ env.NETWORK }}" \
|
||||||
--container-env=ZEBRA_SKIP_IPV6_TESTS=1 \
|
|
||||||
--machine-type ${{ env.MACHINE_TYPE }} \
|
--machine-type ${{ env.MACHINE_TYPE }} \
|
||||||
--scopes cloud-platform \
|
--scopes cloud-platform \
|
||||||
--metadata=google-monitoring-enabled=true,google-logging-enabled=true \
|
--metadata=google-monitoring-enabled=true,google-logging-enabled=true \
|
||||||
|
@ -480,7 +401,6 @@ jobs:
|
||||||
--container-arg="--manifest-path" \
|
--container-arg="--manifest-path" \
|
||||||
--container-arg="zebrad/Cargo.toml" \
|
--container-arg="zebrad/Cargo.toml" \
|
||||||
--container-arg="sync_past_mandatory_checkpoint_${{ env.NETWORK }}" \
|
--container-arg="sync_past_mandatory_checkpoint_${{ env.NETWORK }}" \
|
||||||
--container-env=ZEBRA_SKIP_IPV6_TESTS=1 \
|
|
||||||
--machine-type ${{ env.MACHINE_TYPE }} \
|
--machine-type ${{ env.MACHINE_TYPE }} \
|
||||||
--scopes cloud-platform \
|
--scopes cloud-platform \
|
||||||
--metadata=google-monitoring-enabled=true,google-logging-enabled=true \
|
--metadata=google-monitoring-enabled=true,google-logging-enabled=true \
|
||||||
|
|
|
@ -21,9 +21,7 @@ on:
|
||||||
- '.github/workflows/zcash-lightwalletd.yml'
|
- '.github/workflows/zcash-lightwalletd.yml'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PROJECT_ID: zealous-zebra
|
|
||||||
GAR_BASE: us-docker.pkg.dev/zealous-zebra/zebra
|
GAR_BASE: us-docker.pkg.dev/zealous-zebra/zebra
|
||||||
GCR_BASE: gcr.io/zealous-zebra
|
|
||||||
IMAGE_NAME: lightwalletd
|
IMAGE_NAME: lightwalletd
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
|
@ -13,99 +13,16 @@ on:
|
||||||
# workflow definitions
|
# workflow definitions
|
||||||
- 'docker/zcash-params/Dockerfile'
|
- 'docker/zcash-params/Dockerfile'
|
||||||
- '.github/workflows/zcash-params.yml'
|
- '.github/workflows/zcash-params.yml'
|
||||||
|
- '.github/workflows/docker-image-build.yml'
|
||||||
env:
|
|
||||||
CARGO_INCREMENTAL: '1'
|
|
||||||
PROJECT_ID: zealous-zebra
|
|
||||||
GAR_BASE: us-docker.pkg.dev/zealous-zebra/zebra
|
|
||||||
GCR_BASE: gcr.io/zealous-zebra
|
|
||||||
IMAGE_NAME: zcash-params
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build images
|
uses: ./.github/workflows/docker-image-build.yml
|
||||||
# TODO: remove timeout until we have an average build time
|
with:
|
||||||
# timeout-minutes: 180
|
dockerfile_path: ./docker/zcash-params/Dockerfile
|
||||||
runs-on: ubuntu-latest
|
dockerfile_target: builder
|
||||||
permissions:
|
image_name: zcash-params
|
||||||
contents: 'read'
|
rust_backtrace: full
|
||||||
id-token: 'write'
|
rust_lib_backtrace: full
|
||||||
|
colorbt_show_hidden: '1'
|
||||||
steps:
|
rust_log: info
|
||||||
- uses: actions/checkout@v3.0.2
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Inject slug/short variables
|
|
||||||
uses: rlespinasse/github-slug-action@v4
|
|
||||||
with:
|
|
||||||
short-length: 7
|
|
||||||
|
|
||||||
# Automatic tag management and OCI Image Format Specification for labels
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v3.7.0
|
|
||||||
with:
|
|
||||||
# list of Docker images to use as base name for tags
|
|
||||||
images: |
|
|
||||||
${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}
|
|
||||||
# generate Docker tags based on the following events/attributes
|
|
||||||
tags: |
|
|
||||||
type=schedule
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=pr
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
type=sha
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
id: qemu
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
with:
|
|
||||||
image: tonistiigi/binfmt:latest
|
|
||||||
platforms: all
|
|
||||||
|
|
||||||
# Setup Docker Buildx to allow use of docker cache layers from GH
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
# Setup gcloud CLI
|
|
||||||
- name: Authenticate to Google Cloud
|
|
||||||
id: auth
|
|
||||||
uses: google-github-actions/auth@v0.7.1
|
|
||||||
with:
|
|
||||||
workload_identity_provider: 'projects/143793276228/locations/global/workloadIdentityPools/github-actions/providers/github-oidc'
|
|
||||||
service_account: 'github-service-account@zealous-zebra.iam.gserviceaccount.com'
|
|
||||||
token_format: 'access_token'
|
|
||||||
|
|
||||||
- name: Login to Google Artifact Registry
|
|
||||||
uses: docker/login-action@v1.14.1
|
|
||||||
with:
|
|
||||||
registry: us-docker.pkg.dev
|
|
||||||
username: oauth2accesstoken
|
|
||||||
password: ${{ steps.auth.outputs.access_token }}
|
|
||||||
|
|
||||||
# Build and push image to Google Artifact Registry
|
|
||||||
- name: Build & push
|
|
||||||
id: docker_build
|
|
||||||
uses: docker/build-push-action@v2.10.0
|
|
||||||
with:
|
|
||||||
target: builder
|
|
||||||
context: .
|
|
||||||
file: ./docker/zcash-params/Dockerfile
|
|
||||||
# TODO: building crates is taking too long with arm64 and it's timing out on GHA
|
|
||||||
# platforms: |
|
|
||||||
# linux/amd64
|
|
||||||
# linux/arm64
|
|
||||||
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
build-args: |
|
|
||||||
SHORT_SHA=${{ env.GITHUB_SHA_SHORT }}
|
|
||||||
ZEBRA_SKIP_IPV6_TESTS="1"
|
|
||||||
SENTRY_DSN=${{ secrets.SENTRY_ENDPOINT }}
|
|
||||||
push: true
|
|
||||||
cache-from: type=registry,ref=${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:buildcache
|
|
||||||
cache-to: type=registry,ref=${{ env.GAR_BASE }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
|
|
||||||
|
|
Loading…
Reference in New Issue