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 Sep 30, 2021
1 parent 4db271f commit 830a5f7
Show file tree
Hide file tree
Showing 9 changed files with 259 additions and 101 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
114 changes: 114 additions & 0 deletions .github/workflows/llvm-back-end.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: LLVM back-end testing

on:
pull_request:
paths:
- '.github/workflows/llvm-back-end.yml'
- 'build.sh'

jobs:
build_and_test_llvm_back_end:
name: test
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 }}
- run: ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
- name: Checkout https://github.com/matter-labs/compiler-tester
uses: actions/checkout@v2
with:
repository: matter-labs/compiler-tester
#ref: main
ref: ms-update-cargo-config
submodules: recursive
token: ${{ secrets.COMPILER_TESTER_ACCESS_TOKEN }}
path: 'compiler-tester'
ssh-known-hosts: 'github.com'
# ssh-key: ${{ secrets.SSH_KEY }}

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

- name: prepare
shell: bash
run: |
echo "DOCKER_RUNNER=docker-compose -f ${{github.workspace}}/compiler-llvm/infra/docker-compose-runner.yml" >> $GITHUB_ENV
echo "DOCKER_RUN=docker-compose -f ${{github.workspace}}/compiler-llvm/infra/docker-compose-runner.yml exec -T zk" >> $GITHUB_ENV
- name: start-services
run: |
${DOCKER_RUNNER} down
${DOCKER_RUNNER} pull
${DOCKER_RUNNER} up --build -d zk
${DOCKER_RUNNER} exec -T zk sccache --start-server
# - run: ${DOCKER_RUN} sh -c "ssh-keyscan -t rsa github.com >> /root/.ssh/known_hosts" || true
#
# - run: ${DOCKER_RUN} sh -c "ssh-add /ssh-agent/id_rsa" || true
# - run: ${DOCKER_RUN} sh -c "ssh-agent" || true
# - run: ${DOCKER_RUN} sh -c "ssh-add -L" || true
- run: ${DOCKER_RUN} sh -c 'eval "$(ssh-agent -s)"' || true
- run: ${DOCKER_RUN} sh -c "ssh-add -L" || true
- run: ${DOCKER_RUN} sh -c "ssh -T git@github.com" || true


- run: ssh -T git@github.com || true




#DEBUG
# - run: ${DOCKER_RUN} pwd || true
# - run: ${DOCKER_RUN} --project-directory='/usr/src/zksync/compiler-llvm' pwd || true
# - run: ${DOCKER_RUN} --project-directory='./compiler-llvm' pwd || true
# - run: ${DOCKER_RUN} --project-directory=compiler-llvm pwd || true
# - run: ${DOCKER_RUN} -w /usr/src/zksync/compiler-llvm/ pwd || true
# - run: ${DOCKER_RUN} -w ${WORKSPACE}/compiler-llvm/ pwd || true

# - run: ${DOCKER_RUN} sh -c "apt-get --yes install wget sudo"

# - name: Building the LLVM framework
# run: |
# chmod +x compiler-llvm/build.sh
# ${DOCKER_RUN} sh -c "cd compiler-llvm && ./build.sh release"

- name: Downloading the Solidity compiler binaries
run: |
mkdir solc
wget 'https://github.com/ethereum/solc-bin/raw/gh-pages/linux-amd64/solc-linux-amd64-v0.8.0%2Bcommit.c7dfd78e' --output-document "solc/solc-0.8.0"
wget 'https://github.com/ethereum/solc-bin/raw/gh-pages/linux-amd64/solc-linux-amd64-v0.8.1%2Bcommit.df193b15' --output-document "solc/solc-0.8.1"
wget 'https://github.com/ethereum/solc-bin/raw/gh-pages/linux-amd64/solc-linux-amd64-v0.8.2%2Bcommit.661d1103' --output-document "solc/solc-0.8.2"
wget 'https://github.com/ethereum/solc-bin/raw/gh-pages/linux-amd64/solc-linux-amd64-v0.8.3%2Bcommit.8d00100c' --output-document "solc/solc-0.8.3"
wget 'https://github.com/ethereum/solc-bin/raw/gh-pages/linux-amd64/solc-linux-amd64-v0.8.4%2Bcommit.c7e474f2' --output-document "solc/solc-0.8.4"
wget 'https://github.com/ethereum/solc-bin/raw/gh-pages/linux-amd64/solc-linux-amd64-v0.8.5%2Bcommit.a4f2e591' --output-document "solc/solc-0.8.5"
wget 'https://github.com/ethereum/solc-bin/raw/gh-pages/linux-amd64/solc-linux-amd64-v0.8.6%2Bcommit.11564f7e' --output-document "solc/solc-0.8.6"
wget 'https://github.com/ethereum/solc-bin/raw/gh-pages/linux-amd64/solc-linux-amd64-v0.8.7%2Bcommit.e28d00a7' --output-document "solc/solc-0.8.7"
${DOCKER_RUN} mkdir -pv ${HOME}/opt/solc
${DOCKER_RUN} cp -R solc ${HOME}/opt
#DEBUG
# - run: ${DOCKER_RUN} sh -c PATH="${HOME}/opt/solc/:${PATH}" || true
# - run: ${DOCKER_RUN} sh -c export PATH="${PATH}:${HOME}/opt/solc/" || true
# - run: ${DOCKER_RUN} PATH="${HOME}/opt/solc/:${PATH}" || true
# - run: ${DOCKER_RUN} echo ${PATH}
# - run: ${DOCKER_RUN} env

#DEBUG
# - run: ${DOCKER_RUN} sh -c "mkdir ~/.ssh && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts"
#


#DEBUG
# - run: ${DOCKER_RUN} sh -c "ssh -vT git@github.com" || true

- name: Building and running the compiler tester
run: |
${DOCKER_RUN} env
${DOCKER_RUN} sh -c "cd compiler-tester && ./run.sh"
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
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
69 changes: 46 additions & 23 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -Cex

HOST="${2:-self}"

# Target build: 'debug' | 'release'
case "${1}" in
debug)
Expand Down Expand Up @@ -68,31 +70,52 @@ 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 \
if [[ $HOST == "ci" ]]; then
cd ${LLVM_BINARY_DIR}
cmake \
clang-11 \
lld-11

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' \
-DLLVM_TARGETS_TO_BUILD='X86' \
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD='SyncVM' \
-DLLVM_OPTIMIZED_TABLEGEN='On' \
-DLLVM_USE_LINKER='lld-11' \
-DLLVM_BUILD_DOCS='Off' \
-DLLVM_INCLUDE_DOCS='Off' \
-DLLVM_ENABLE_DOXYGEN='Off' \
-DLLVM_ENABLE_SPHINX='Off' \
-DLLVM_ENABLE_OCAMLDOC='Off' \
-DLLVM_ENABLE_BINDINGS='Off'
-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-${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-${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'
else
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-11 main"
sudo apt-get --yes update
sudo apt-get --yes install \
cmake clang-11 lld-11

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' \
-DLLVM_TARGETS_TO_BUILD='X86' \
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD='SyncVM' \
-DLLVM_OPTIMIZED_TABLEGEN='On' \
-DLLVM_USE_LINKER='lld-11' \
-DLLVM_BUILD_DOCS='Off' \
-DLLVM_INCLUDE_DOCS='Off' \
-DLLVM_ENABLE_DOXYGEN='Off' \
-DLLVM_ENABLE_SPHINX='Off' \
-DLLVM_ENABLE_OCAMLDOC='Off' \
-DLLVM_ENABLE_BINDINGS='Off'
fi
cd "build-${DIRECTORY_SUFFIX}/"
make -j "$(nproc)"
fi
Expand Down
Loading

0 comments on commit 830a5f7

Please sign in to comment.