Skip to content

Commit

Permalink
Build llvm_runner image also for ARM64 (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
hatemosphere authored Oct 18, 2023
1 parent ae7969c commit 68f7c5b
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 80 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/build_llvm_runner.yml

This file was deleted.

76 changes: 76 additions & 0 deletions .github/workflows/handle_llvm_runner_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Handle LLVM_runner docker image

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
check_changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
image_to_build: ${{ steps.determine_changes.outputs.image_to_build }}
steps:
- id: determine_changes
uses: tj-actions/changed-files@v39
with:
files_yaml: |
llvm_runner:
- "images/llvm_runner/Dockerfile"
llvm_runner_jammy:
- "images/llvm_runner/jammy.Dockerfile"
both:
- ".github/workflows/build_llvm_runner.yml"
- id: set_output
run: |
if [ "${{ steps.determine_changes.outputs.llvm_runner_any_changed }}" == "true" ]; then
echo "image_to_build=llvm_runner" >> "$GITHUB_OUTPUT"
elif [ "${{ steps.determine_changes.outputs.llvm_runner_jammy_any_changed }}" == "true" ]; then
echo "image_to_build=llvm_runner_jammy" >> "$GITHUB_OUTPUT"
elif [ "${{ steps.determine_changes.outputs.both_any_changed }}" == "true" ]; then
echo "image_to_build=both" >> "$GITHUB_OUTPUT"
else
echo "image_to_build=none" >> "$GITHUB_OUTPUT"
fi
handle_image:
needs: check_changes
if: needs.check_changes.outputs.image_to_build != 'none'
runs-on: [matterlabs-ci-runner]
strategy:
matrix:
image_name: [llvm_runner, llvm_runner_jammy]
fail-fast: false
steps:
- uses: actions/checkout@v4

- name: Set outputs
id: set_output
run: echo "name=sha_short::$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and optionally push Docker image
if: matrix.image_name == needs.check_changes.outputs.image_to_build || needs.check_changes.outputs.image_to_build == 'both'
uses: docker/build-push-action@v5
with:
push: ${{ github.event_name == 'push' }}
tags: |
matterlabs/${{ matrix.image_name }}:${{ steps.set_output.outputs.sha_short }}
matterlabs/${{ matrix.image_name }}:latest
file: images/llvm_runner/${{ matrix.image_name == 'llvm_runner_jammy' && 'jammy.' || '' }}Dockerfile
platforms: linux/amd64,linux/arm64
55 changes: 0 additions & 55 deletions .github/workflows/publishing_llvm_runner.yml

This file was deleted.

49 changes: 49 additions & 0 deletions images/llvm_runner/jammy.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM ubuntu:22.04

WORKDIR /usr/src/zksync

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install --yes --no-install-recommends \
bash git openssl curl libssl-dev sudo ssh-client \
cmake gcc g++ ninja-build \
libpq-dev pkg-config \
software-properties-common jq \
openssh-client git \
build-essential \
libncurses5 xz-utils wget gnupg musl-tools && \
rm -rf /var/lib/apt/lists/*

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
CARGO_NET_GIT_FETCH_WITH_CLI=true \
PATH=/usr/local/cargo/bin:$PATH
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y

RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - && \
apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" && \
apt-get --yes update && \
apt-get --yes install cmake clang-15 lld-15

RUN add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && \
apt-get --yes install python3.12 python3.12-dev python3.12-distutils

# Required to build solidity fork
RUN apt-get update && apt-get -y install -y \
libboost-dev \
libboost-filesystem-dev \
libboost-test-dev \
libboost-system-dev \
libboost-program-options-dev \
libcvc4-dev \
libcln-dev \
libboost-regex-dev \
libboost-thread-dev \
libboost-random-dev

ENV PATH=/usr/lib/llvm-15/bin:$PATH \
LD_LIBRARY_PATH=/usr/lib/llvm-15/lib:$LD_LIBRARY_PATH \
LLVM_VERSION=15 \
CI_RUNNING=true

0 comments on commit 68f7c5b

Please sign in to comment.