diff --git a/.github/workflows/build-core-template.yml b/.github/workflows/build-core-template.yml index c900c398510..178b96988e9 100644 --- a/.github/workflows/build-core-template.yml +++ b/.github/workflows/build-core-template.yml @@ -25,20 +25,15 @@ on: jobs: build-images: - name: Build and Push Docker Images - runs-on: ${{fromJson(matrix.runner)}} + name: Build and Push amd64 Docker Images + runs-on: matterlabs-ci-runner strategy: matrix: - include: - - component: server-v2 - runner: '["matterlabs-ci-runner"]' - - component: contract-verifier - runner: '["matterlabs-ci-runner"]' - - component: cross-external-nodes-checker - runner: '["matterlabs-ci-runner"]' - - component: external-node - runner: '["matterlabs-ci-runner", "matterlabs-ci-runner-arm"]' - fail-fast: false + component: + - server-v2 + - contract-verifier + - cross-external-nodes-checker + - external-node env: image_tag: ${{ inputs.image_tag }} IMAGE_TAG_SUFFIX: ${{ inputs.image_tag_suffix }} @@ -46,7 +41,68 @@ jobs: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c 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 --no-deps -d zk + 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: 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 -q + + - name: update-images + env: + DOCKER_ACTION: ${{ inputs.action }} + COMPONENT: ${{ matrix.component }} + run: | + ci_run zk docker $DOCKER_ACTION $COMPONENT --platforms "linux/amd64" -- --public + + - name: Show sccache stats + if: always() + run: | + ci_run sccache --show-stats + ci_run cat /tmp/sccache_log.txt + + build-images-arm: + name: Build and Push arm64 Docker Images + runs-on: matterlabs-ci-runner-arm + strategy: + matrix: + component: + - external-node + env: + image_tag: ${{ inputs.image_tag }} + IMAGE_TAG_SUFFIX: ${{ inputs.image_tag_suffix }} + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + with: + submodules: "recursive" - name: setup-env run: | echo ZKSYNC_HOME=$(pwd) >> $GITHUB_ENV @@ -87,12 +143,7 @@ jobs: DOCKER_ACTION: ${{ inputs.action }} COMPONENT: ${{ matrix.component }} run: | - if [[ "${{ fromJson(matrix.runner) }}" == "matterlabs-ci-runner-arm" ]]; then - PLATFORMS="linux/arm64,linux/arm64/v8" - else - PLATFORMS="linux/amd64" - fi - ci_run zk docker $DOCKER_ACTION $COMPONENT --platforms "$PLATFORMS" -- --public + ci_run zk docker $DOCKER_ACTION $COMPONENT --platforms "linux/arm64,linux/arm64/v8" -- --public - name: Show sccache stats if: always() diff --git a/docker/zk-environment/Dockerfile b/docker/zk-environment/Dockerfile index 64ed0bf7a86..50a5cb50a0a 100644 --- a/docker/zk-environment/Dockerfile +++ b/docker/zk-environment/Dockerfile @@ -218,7 +218,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ ENV LIBRARY_PATH /usr/local/cuda/lib64/stubs - FROM base as rust-nightly RUN rustup install nightly-2023-07-21 && \