Skip to content

Commit

Permalink
Set up a CI server for the LLVM back-end. #CPR-227
Browse files Browse the repository at this point in the history
  • Loading branch information
warsmit committed Oct 26, 2021
1 parent 8e783ed commit afbcea2
Show file tree
Hide file tree
Showing 11 changed files with 195 additions and 93 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/clang-tests.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Clang Tests

on:
push:
branches:
- 'release/**'
paths:
- 'clang/**'
- 'llvm/**'
- '.github/workflows/clang-tests.yml'
pull_request:
paths:
- 'clang/**'
- 'llvm/**'
- '.github/workflows/clang-tests.yml'
on: workflow_dispatch
# push:
# branches:
# - 'release/**'
# paths:
# - 'clang/**'
# - 'llvm/**'
# - '.github/workflows/clang-tests.yml'
# pull_request:
# paths:
# - 'clang/**'
# - 'llvm/**'
# - '.github/workflows/clang-tests.yml'

jobs:
build_clang:
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/libclang-abi-tests.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: libclang ABI Tests

on:
push:
branches:
- 'release/**'
paths:
- 'clang/**'
- '.github/workflows/libclang-abi-tests.yml'
pull_request:
paths:
- 'clang/**'
- '.github/workflows/libclang-abi-tests.yml'
on: workflow_dispatch
# push:
# branches:
# - 'release/**'
# paths:
# - 'clang/**'
# - '.github/workflows/libclang-abi-tests.yml'
# pull_request:
# paths:
# - 'clang/**'
# - '.github/workflows/libclang-abi-tests.yml'

jobs:
abi-dump-setup:
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/libclc-tests.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: libclc Tests

on:
push:
branches:
- 'release/**'
paths:
- 'clang/**'
- 'llvm/**'
- 'libclc/**'
- '.github/workflows/libclc-tests.yml'
pull_request:
paths:
- 'clang/**'
- 'llvm/**'
- 'libclc/**'
- '.github/workflows/libclc-tests.yml'
on: workflow_dispatch
# push:
# branches:
# - 'release/**'
# paths:
# - 'clang/**'
# - 'llvm/**'
# - 'libclc/**'
# - '.github/workflows/libclc-tests.yml'
# pull_request:
# paths:
# - 'clang/**'
# - 'llvm/**'
# - 'libclc/**'
# - '.github/workflows/libclc-tests.yml'

jobs:
build_libclc:
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/lld-tests.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: LLD Tests

on:
push:
branches:
- 'release/**'
paths:
- 'lld/**'
- 'llvm/**'
- '.github/workflows/lld-tests.yml'
pull_request:
paths:
- 'lld/**'
- 'llvm/**'
- '.github/workflows/lld-tests.yml'
on: workflow_dispatch
# push:
# branches:
# - 'release/**'
# paths:
# - 'lld/**'
# - 'llvm/**'
# - '.github/workflows/lld-tests.yml'
# pull_request:
# paths:
# - 'lld/**'
# - 'llvm/**'
# - '.github/workflows/lld-tests.yml'

jobs:
build_lld:
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/lldb-tests.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: lldb Tests

on:
push:
branches:
- 'release/**'
paths:
- 'clang/**'
- 'llvm/**'
- 'lldb/**'
- '.github/workflows/lldb-tests.yml'
pull_request:
paths:
- 'clang/**'
- 'llvm/**'
- 'lldb/**'
- '.github/workflows/lldb-tests.yml'
on: workflow_dispatch
# push:
# branches:
# - 'release/**'
# paths:
# - 'clang/**'
# - 'llvm/**'
# - 'lldb/**'
# - '.github/workflows/lldb-tests.yml'
# pull_request:
# paths:
# - 'clang/**'
# - 'llvm/**'
# - 'lldb/**'
# - '.github/workflows/lldb-tests.yml'

jobs:
build_lldb:
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/llvm-back-end.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: LLVM testing

on:
workflow_dispatch:
pull_request:

jobs:
llvm_testing:
runs-on: [self-hosted, CI-worker]
steps:
- uses: AutoModality/action-clean@v1.1.0
- uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SSH_PK_BOT }}
- name: prepare run
run: |
echo "COMPOSE_FILE=${{github.workspace}}/compiler-llvm/infra/docker-compose.yml" >> $GITHUB_ENV
echo "COMPOSE_PROJECT_NAME=llvm_testing" >> $GITHUB_ENV
echo "DOCKER_CMD=docker-compose exec -T zk" >> $GITHUB_ENV
- name: Checkout https://github.com/matter-labs/compiler-tester
uses: actions/checkout@v2
with:
repository: matter-labs/compiler-tester
submodules: recursive
token: ${{ secrets.COMPILER_TESTER_ACCESS_TOKEN }}
path: 'compiler-tester'

- name: Checkout https://github.com/matter-labs/compiler-llvm
uses: actions/checkout@v2
with:
path: compiler-llvm

- name: start-services
run: |
docker-compose pull
docker-compose up -d zk
env:
SSH_PRIVATE_KEY: ${{secrets.SSH_PK_BOT}}

- name: Tuning a docker. Setting a ssh key.
run: |
${DOCKER_CMD} sh -c 'mkdir -pv /root/.ssh'
${DOCKER_CMD} sh -c 'echo "${SSH_PRIVATE_KEY}" > /root/.ssh/id_rsa'
${DOCKER_CMD} sh -c 'chmod 400 /root/.ssh/id_rsa'
${DOCKER_CMD} sh -c 'touch /root/.ssh/known_hosts'
${DOCKER_CMD} sh -c 'ssh-keyscan github.com >> /root/.ssh/known_hosts'
${DOCKER_CMD} sh -c 'env'
- name: Building the LLVM framework
run: |
chmod +x compiler-llvm/build.sh
# LLVM_VERSION is workaround. It should move to docker.
${DOCKER_CMD} sh -c "cd compiler-llvm && LLVM_VERSION=13 ./build.sh release ci"
- name: Building and running the compiler tester
run: ${DOCKER_CMD} sh -c "cd compiler-tester && ./run.sh"

- name: Clearing workspace. Removing used and trash images
if: always()
run: |
# Removing trash images. This command isn't remove pulled work image.
docker image prune -f --all
docker-compose down --rmi local -v
22 changes: 11 additions & 11 deletions .github/workflows/llvm-tests.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: LLVM Tests

on:
push:
branches:
- 'release/**'
paths:
- 'llvm/**'
- '.github/workflows/llvm-tests.yml'
pull_request:
paths:
- 'llvm/**'
- '.github/workflows/llvm-tests.yml'
on: workflow_dispatch
# push:
# branches:
# - 'release/**'
# paths:
# - 'llvm/**'
# - '.github/workflows/llvm-tests.yml'
# pull_request:
# paths:
# - 'llvm/**'
# - '.github/workflows/llvm-tests.yml'

jobs:
build_llvm:
Expand Down
36 changes: 21 additions & 15 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ case "${1}" in
esac

if [[ "$OSTYPE" == "darwin"* ]]; then
brew update
brew install cmake
if [[ ! -v "${CI_RUNNING}" ]]; then
brew update
brew install cmake
fi

cmake \
-S 'llvm' \
Expand All @@ -41,10 +43,12 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
cd "build-${DIRECTORY_SUFFIX}/"
make -j "$(sysctl -n hw.logicalcpu)"
elif [[ -f '/etc/arch-release' ]]; then
sudo pacman --sync --refresh --sysupgrade --noconfirm \
cmake \
clang \
lld
if [[ ! -v "${CI_RUNNING}" ]]; then
sudo pacman --sync --refresh --sysupgrade --noconfirm \
cmake \
clang \
lld
fi

cmake \
-S 'llvm' \
Expand All @@ -68,31 +72,33 @@ elif [[ -f '/etc/arch-release' ]]; then
cd "build-${DIRECTORY_SUFFIX}/"
make -j "$(nproc)"
elif [[ "$OSTYPE" == "linux-gnu" ]]; then
sudo apt --yes update
sudo apt --yes install \
cmake \
clang-11 \
lld-11
if [[ ! -v "${CI_RUNNING}" ]]; then
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - && \
sudo apt-add-repository "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-13 main" && \
sudo apt-get --yes update && \
sudo apt-get --yes install cmake clang-13 lld-13
export LLVM_VERSION='13'
fi

cmake \
-S 'llvm' \
-B "build-${DIRECTORY_SUFFIX}/" \
-G 'Unix Makefiles' \
-DCMAKE_INSTALL_PREFIX="${HOME}/opt/llvm-${DIRECTORY_SUFFIX}/" \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DCMAKE_C_COMPILER='clang-11' \
-DCMAKE_CXX_COMPILER='clang++-11' \
-DCMAKE_C_COMPILER="clang-${LLVM_VERSION}" \
-DCMAKE_CXX_COMPILER="clang++-${LLVM_VERSION}" \
-DLLVM_TARGETS_TO_BUILD='X86' \
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD='SyncVM' \
-DLLVM_OPTIMIZED_TABLEGEN='On' \
-DLLVM_USE_LINKER='lld-11' \
-DLLVM_USE_LINKER="lld-${LLVM_VERSION}" \
-DLLVM_BUILD_DOCS='Off' \
-DLLVM_INCLUDE_DOCS='Off' \
-DLLVM_ENABLE_DOXYGEN='Off' \
-DLLVM_ENABLE_SPHINX='Off' \
-DLLVM_ENABLE_OCAMLDOC='Off' \
-DLLVM_ENABLE_BINDINGS='Off'

cd "build-${DIRECTORY_SUFFIX}/"
make -j "$(nproc)"
fi
Expand Down
1 change: 1 addition & 0 deletions infra/compiler-llvm
Submodule compiler-llvm added at d68c8e
10 changes: 10 additions & 0 deletions infra/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3.2'
services:
zk:
image: "matterlabs/llvm_runner:latest"
working_dir: /usr/src/zksync
command: "tail -f /dev/null"
volumes:
- ${GITHUB_WORKSPACE}:/usr/src/zksync
environment:
- SSH_PRIVATE_KEY=${SSH_PRIVATE_KEY}
21 changes: 21 additions & 0 deletions infra/test.tx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: '3.2'
services:
zk:
# used docker - https://github.com/matter-labs/compiler-infra/blob/main/images/llvm_runner/Dockerfile
image: "matterlabs/llvm_runner:latest"
# image: "warsmit/test_ci:test"
volumes:
# - ${GITHUB_WORKSPACE}:/usr/src/test
- ${GITHUB_WORKSPACE}:/usr/src/zksync
# - /usr/src/cache:/usr/src/cache
# - /usr/src/keys:/usr/src/keys
- ~/.ssh:/root/.ssh
# - ${SSH_AUTH_SOCK}:/ssh-agent
# - ~/.ssh/known_hosts:/root/.ssh/known_hosts
working_dir: /usr/src/test
environment:
- IN_DOCKER=true
# - CACHE_DIR=/usr/src/cache
# - SCCACHE_CACHE_SIZE=50g
- CI=1
# - SSH_AUTH_SOCK=/ssh-agent

0 comments on commit afbcea2

Please sign in to comment.