Zombie Builder #120
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Copyright Quadrivium LLC | |
# All Rights Reserved | |
# SPDX-License-Identifier: Apache-2.0 | |
# | |
name : Zombie Builder | |
on: | |
# schedule: | |
# - cron: '0 2 * * 0' # Update zombie builder image each Sunday night | |
workflow_dispatch: | |
inputs: | |
polkadot_image_rebuild: | |
description: 'Rebuild the polkadot builder image' | |
required: false | |
default: 'false' | |
type: 'boolean' | |
env: | |
DOCKER_REGISTRY_PATH: ${{ secrets.GCP_REGISTRY }}/${{ secrets.GCP_PROJECT }}/kagome-dev/ | |
FORCE_REBUILD: false | |
GITHUB_HUNTER_USERNAME: ${{ secrets.HUNTER_USERNAME }} | |
GITHUB_HUNTER_TOKEN: ${{ secrets.HUNTER_TOKEN }} | |
BUILD_DIR: build | |
KAGOME_IN_DOCKER: 1 | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
# Change all container: values to this variable once this feature is available | |
# https://github.jparrowsec.cnmunity/t/how-to-set-and-access-a-workflow-variable/17335/6 | |
CACHE_VERSION: v001 | |
CACHE_PATHS: | | |
/tmp/cargo/registry | |
/tmp/cargo/git | |
jobs: | |
# get_polkadot_binary_image: | |
# runs-on: ubuntu-latest | |
# timeout-minutes: 120 | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v4 | |
# | |
# - id: 'auth' | |
# uses: 'google-github-actions/auth@v2' | |
# with: | |
# credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} | |
# | |
# - name: 'Set up Cloud SDK' | |
# uses: 'google-github-actions/setup-gcloud@v2' | |
# | |
# - name: "Configure Docker for GCR" | |
# run: | | |
# echo ${GOOGLE_APPLICATION_CREDENTIALS} | |
# gcloud auth configure-docker | |
# build_and_push_zombie_builder: | |
# runs-on: [ actions-runner-controller ] | |
# timeout-minutes: 120 | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: build zombie-builder | |
# working-directory: ./zombienet/docker | |
# run: make builder_latest | |
# - uses: azure/docker-login@v2 | |
# with: | |
# login-server: https://index.docker.io/v1/ | |
# username: ${{ secrets.DOCKER_USERNAME }} | |
# password: ${{ secrets.DOCKER_TOKEN }} | |
# - name: Push zombie-builder docker image | |
# working-directory: ./zombienet/docker | |
# run: make builder_push | |
build_polkadot_builder: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name : "Authenticate with Google Cloud" | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} | |
- name: "Set up Cloud SDK" | |
uses: 'google-github-actions/setup-gcloud@v2' | |
- name: "Configure Docker for GCR" | |
run: | | |
gcloud auth configure-docker --quiet | |
gcloud auth configure-docker ${{ secrets.GCP_REGISTRY }} --quiet | |
- name: "Get Polkadot and Zombienet versions" | |
working-directory: ./zombienet/docker | |
run: make get_versions | |
- name: "Check if image tag exists" | |
id: check-tag | |
working-directory: ./zombienet/docker | |
run: | | |
POLKADOT_VERSION=$(grep 'polkadot_format_version:' polkadot-sdk-versions.txt | cut -d ' ' -f 2) | |
POLKADOT_BUILDER_IMAGE=${DOCKER_REGISTRY_PATH}polkadot_builder:${POLKADOT_VERSION} | |
TAG_EXISTS=$(docker manifest inspect ${POLKADOT_BUILDER_IMAGE} > /dev/null 2>&1 && echo "true" || echo "false") | |
echo "exists=$TAG_EXISTS" >> $GITHUB_ENV | |
echo "polkadot_builder_image=$POLKADOT_BUILDER_IMAGE" >> GITHUB_OUTPUT | |
- name: "Build Polkadot Builder" | |
working-directory: ./zombienet/docker | |
if: env.exists == 'false' || github.event.inputs.polkadot_image_rebuild == 'true' | |
run: make polkadot_builder \ | |
DOCKER_REGISTRY_PATH=${DOCKER_REGISTRY_PATH} | |
- name: "Push Polkadot Builder" | |
working-directory: ./zombienet/docker | |
if: env.exists == 'false' || github.event.inputs.polkadot_image_rebuild == 'true' | |
run: make polkadot_builder_push \ | |
DOCKER_REGISTRY_PATH=${DOCKER_REGISTRY_PATH} | |
building_binaries: | |
runs-on: [ actions-runner-controller ] | |
needs: [build_polkadot_builder] | |
timeout-minutes: 120 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ env.CACHE_PATHS }} | |
key: ${{ runner.os }}-rust-${{ env.CACHE_VERSION }} | |
- name: "Authenticate with Google Cloud" | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} | |
- name: "Set up Cloud SDK" | |
uses: 'google-github-actions/setup-gcloud@v2' | |
- name: "Configure Docker for GCR" | |
run: | | |
gcloud auth configure-docker --quiet | |
gcloud auth configure-docker ${{ secrets.GCP_REGISTRY }} --quiet | |
- name: "Get Polkadot and Zombienet versions" | |
working-directory: ./zombienet/docker | |
run: make get_versions | |
- name: "Build target" | |
working-directory: ./zombienet/docker | |
run: make polkadot_binary \ | |
DOCKER_REGISTRY_PATH=${DOCKER_REGISTRY_PATH} \ | |
SCCACHE_GCS_BUCKET=${{ secrets.SCCACHE_GCS_BUCKET }} \ | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: polkadot_binary | |
path: /tmp/polkadot_binary | |
# building_binary: | |
# runs-on: [ actions-runner-controller ] | |
# timeout-minutes: 120 | |
# container: | |
# image: ${{ needs.build.outputs.polkadot_builder_image }} | |
# steps: | |
## - run: rustup toolchain install stable --profile minimal | |
## | |
## - name: Configure sccache env var and set build profile to ephemeral build | |
## run: | | |
## echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV | |
## echo “SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV | |
## | |
## - name: Run sccache-cache | |
## uses: mozilla-actions/[email protected] | |
# | |
# - name: Build target | |
# run: | | |
# cargo update \ | |
# -p test-parachain-adder-collator \ | |
# -p polkadot-test-malus \ | |
# -p test-parachain-undying-collator && \ | |
# cargo build --profile testnet \ | |
# -p test-parachain-adder-collator \ | |
# -p polkadot-test-malus \ | |
# -p test-parachain-undying-collator | |
# | |
# - name: upload artifact | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: malus | |
# path: /tmp/polkadot_binary/malus | |
# | |
# - name: upload artifact | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: undying-collator | |
# path: /tmp/polkadot_binary/undying-collator | |
# | |
# - name: upload artifact | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: adder-collator | |
# path: /tmp/polkadot_binary/adder-collator |