Skip to content

Commit

Permalink
Adds CI workflows (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
yorik authored Sep 28, 2023
1 parent 002176c commit a980ac6
Show file tree
Hide file tree
Showing 10 changed files with 953 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/build-core-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
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: [matterlabs-ci-runner]
strategy:
matrix:
component:
- server-v2
- external-node
- contract-verifier
- cross-external-nodes-checker
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: start-services
run: |
echo "IMAGE_TAG_SUFFIX=${{ env.IMAGE_TAG_SUFFIX }}" >> .env
docker-compose -f docker-compose-runner.yml up -d zk geth 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/etc/system-contracts
ci_run git config --global --add safe.directory /usr/src/zksync/contracts
ci_run zk
ci_run zk clean --all
ci_run zk run yarn
ci_run cp etc/tokens/{test,localhost}.json
ci_run zk compiler all
ci_run zk contract build
ci_run zk f yarn run l2-contracts build
ci_run curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
- name: update-images
env:
DOCKER_ACTION: ${{ inputs.action }}
COMPONENT: ${{ matrix.component }}
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 -q
ci_run zk docker $DOCKER_ACTION $COMPONENT -- --public
- name: Show sccache stats
if: always()
run: |
ci_run sccache --show-stats
ci_run cat /tmp/sccache_log.txt
142 changes: 142 additions & 0 deletions .github/workflows/build-prover-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: Build Prover images
on:
workflow_call:
secrets:
DOCKERHUB_USER:
description: "DOCKERHUB_USER"
required: true
DOCKERHUB_TOKEN:
description: "DOCKERHUB_TOKEN"
required: true
inputs:
ERA_BELLMAN_CUDA_RELEASE:
description: "ERA_BELLMAN_CUDA_RELEASE"
type: string
required: true
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:
era-bellman-cuda:
name: Get era-bellman-cuda release URLs.
runs-on: [ubuntu-latest]
outputs:
source: ${{ steps.release.outputs.source }}
binary: ${{ steps.release.outputs.binary }}
steps:
- id: release
run: |
release=($(curl -v --silent https://api.github.com/repos/matter-labs/era-bellman-cuda/releases/tags/${{ inputs.ERA_BELLMAN_CUDA_RELEASE }} | jq -r ".name, .tarball_url, .assets[0].browser_download_url"))
echo "source=${release[1]}" >> "$GITHUB_OUTPUT"
echo "binary=${release[2]}" >> "$GITHUB_OUTPUT"
build-images:
name: Build and Push Docker Images
env:
image_tag: ${{ inputs.image_tag }}
IMAGE_TAG_SUFFIX: ${{ inputs.image_tag_suffix }}
runs-on: [matterlabs-ci-runner]
needs: [era-bellman-cuda]
strategy:
matrix:
component:
- witness-generator
- prover-v2
- circuit-synthesizer
- prover-fri
- prover-gpu-fri
- witness-vector-generator
- prover-fri-gateway
- proof-fri-compressor
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
submodules: "recursive"

- name: Prepare bellman-cuda directory
run: etc/scripts/prepare_era_bellman_cuda.sh ${{ needs.era-bellman-cuda.outputs.source }} ${{ needs.era-bellman-cuda.outputs.binary }}

- 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: start-services
run: |
echo "IMAGE_TAG_SUFFIX=${{ env.IMAGE_TAG_SUFFIX }}" >> .env
docker-compose -f docker-compose-runner.yml up -d zk geth 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/etc/system-contracts
ci_run git config --global --add safe.directory /usr/src/zksync/contracts
ci_run zk
ci_run zk clean --all
ci_run zk run yarn
ci_run cp etc/tokens/{test,localhost}.json
ci_run zk compiler all
ci_run zk contract build
ci_run zk f yarn run l2-contracts build
ci_run curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
- name: update-images
env:
DOCKER_ACTION: ${{ inputs.action }}
COMPONENT: ${{ matrix.component }}
RUST_NIGHTLY_COMPONENTS: |
(
"witness-generator"
"prover-v2"
"circuit-synthesizer"
"prover-fri"
"prover-gpu-fri"
"witness-vector-generator"
"prover-fri-gateway"
"proof-fri-compressor"
)
run: |
nightly_components=${{env.RUST_NIGHTLY_COMPONENTS}}
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 -q
if [[ " ${nightly_components[*]} " =~ " ${COMPONENT} " ]]; then
underscored_name=$(echo "$COMPONENT" | tr '-' '_')
# Hack: prover-v2 codebase located in prover directory instead of prover_v2
if [ "$underscored_name" == "prover_v2" ]; then
underscored_name="prover"
fi
# prover-gpu-fri codebase located in prover_fri directory instead of prover_gpu_fri
if [ "$underscored_name" == "prover_gpu_fri" ]; then
underscored_name="prover_fri"
fi
ci_run rustup default nightly-2023-07-21
ci_run echo [workspace] > Cargo.toml
ci_run echo members = [\"prover/${underscored_name}\"] >> Cargo.toml
ci_run cp prover/Cargo.lock Cargo.lock
ci_run zk docker $DOCKER_ACTION $COMPONENT
else
ci_run zk docker $DOCKER_ACTION $COMPONENT
fi
- name: Show sccache stats
if: always()
run: |
ci_run sccache --show-stats
ci_run cat /tmp/sccache_log.txt
18 changes: 18 additions & 0 deletions .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Check PR title
on:
pull_request_target:
types:
- opened
- reopened
- edited
- synchronize

jobs:
lint:
runs-on: ubuntu-latest
permissions:
statuses: write
steps:
- uses: aslafy-z/conventional-pr-title-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit a980ac6

Please sign in to comment.