refactor matrix #2
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
name: Build Core images | ||
on: | ||
workflow_call: | ||
secrets: | ||
DOCKERHUB_USER: | ||
description: "DOCKERHUB_USER" | ||
required: true | ||
DOCKERHUB_TOKEN: | ||
description: "DOCKERHUB_TOKEN" | ||
required: true | ||
inputs: | ||
image_tag: | ||
description: "Tag of a built image to deploy" | ||
type: string | ||
required: true | ||
image_tag_suffix: | ||
description: "Optional suffix to override tag name generation" | ||
type: string | ||
required: false | ||
action: | ||
description: "Action with docker image" | ||
type: string | ||
default: "push" | ||
required: false | ||
jobs: | ||
build-images: | ||
name: Build and Push Docker Images | ||
env: | ||
image_tag: ${{ inputs.image_tag }} | ||
IMAGE_TAG_SUFFIX: ${{ inputs.image_tag_suffix }} | ||
runs-on: ${{ contains(matrix.platforms, 'arm') ? 'matterlabs-ci-runner-arm' : 'matterlabs-ci-runner' }} | ||
strategy: | ||
matrix: | ||
components: | ||
- server-v2 | ||
- external-node | ||
- contract-verifier | ||
- cross-external-nodes-checker | ||
- snapshots-creator | ||
platforms: | ||
- linux/amd64 | ||
include: | ||
- components: external-node | ||
platforms: linux/arm64 | ||
steps: | ||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 | ||
with: | ||
submodules: "recursive" | ||
- name: setup-env | ||
run: | | ||
echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV | ||
echo CI=1 >> $GITHUB_ENV | ||
echo $(pwd)/bin >> $GITHUB_PATH | ||
echo CI=1 >> .env | ||
echo IN_DOCKER=1 >> .env | ||
- name: Download contracts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: contracts | ||
path: ./contracts/ | ||
- name: start-services | ||
run: | | ||
echo "IMAGE_TAG_SUFFIX=${{ env.IMAGE_TAG_SUFFIX }}" >> .env | ||
mkdir -p ./volumes/postgres | ||
docker compose up -d zk postgres | ||
ci_run sccache --start-server | ||
- name: init | ||
run: | | ||
ci_run git config --global --add safe.directory /usr/src/zksync | ||
ci_run git config --global --add safe.directory /usr/src/zksync/sdk/binaryen | ||
ci_run git config --global --add safe.directory /usr/src/zksync/contracts/system-contracts | ||
ci_run git config --global --add safe.directory /usr/src/zksync/contracts | ||
ci_run zk || true | ||
ci_run yarn zk build | ||
ci_run curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key | ||
- name: login to Docker registries | ||
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) | ||
run: | | ||
ci_run docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }} | ||
ci_run gcloud auth configure-docker us-docker.pkg.dev,asia-docker.pkg.dev,europe-docker.pkg.dev -q | ||
- name: update-images | ||
env: | ||
DOCKER_ACTION: ${{ inputs.action }} | ||
COMPONENT: ${{ matrix.components }} | ||
PLATFORM: ${{ matrix.platforms }} | ||
run: | | ||
ci_run rustup default nightly-2023-08-21 | ||
ci_run zk docker $DOCKER_ACTION --platform=${PLATFORM} $COMPONENT | ||
- name: Show sccache stats | ||
if: always() | ||
run: | | ||
ci_run sccache --show-stats | ||
ci_run cat /tmp/sccache_log.txt | ||
create_manifest: | ||
name: Create release docker manifest | ||
runs-on: matterlabs-ci-runner | ||
strategy: | ||
matrix: | ||
component: | ||
- name: server-v2 | ||
platform: linux/amd64 | ||
- name: external-node | ||
platform: linux/amd64,linux/arm64 | ||
- name: contract-verifier | ||
platform: linux/amd64 | ||
- name: cross-external-nodes-checker | ||
platform: linux/amd64 | ||
- name: snapshots-creator | ||
platform: linux/amd64 | ||
env: | ||
image_tag: ${{ inputs.image_tag }} | ||
IMAGE_TAG_SUFFIX: ${{ inputs.image_tag_suffix }} | ||
steps: | ||
- name: Some steps for merge image per component using platforms comma-separated string | ||
run: echo "TODO" |