Skip to content

Commit

Permalink
Update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
popzxc committed Oct 28, 2020
1 parent f5143ab commit 87f3b21
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 19 deletions.
16 changes: 16 additions & 0 deletions bin/all_integration_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
cd $ZKSYNC_HOME
. .setup_env

zksync integration-test || exit 1
zksync api-test || exit 1

# zcli test
yarn --cwd infrastructure/zcli test || exit 1

# rust-sdk tesst
cargo test -p zksync --release -- --ignored --test-threads=1 || exit 1

# We have to kill the server before running data-restore
killall zksync_server
zksync data-restore || exit 1
14 changes: 14 additions & 0 deletions bin/cat_logs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

echo "Server logs:"
echo "============"
cat $ZKSYNC_HOME/server.log
echo ""

echo "Prover logs:"
echo "============"
cat $ZKSYNC_HOME/dummy_prover.log
echo ""

# If we're calling this script, previous command failed and we want to exit with an error code
exit 1
28 changes: 11 additions & 17 deletions docker/integration-test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
FROM matterlabs/geth:latest as geth
FROM debian:buster-slim
FROM matterlabs/ci:latest

WORKDIR /usr/ci-run
WORKDIR /usr/src/zksync

# Install required dependencies
RUN apt-get update; apt-get install -y bash git nodejs npm postgresql openssl libssl-dev gcc g++ curl libpq-dev pkg-config software-properties-common
RUN npm install -g yarn

# Install Rust and required cargo packages
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
RUN cargo install diesel_cli --no-default-features --features postgres
# Install required cargo packages
RUN cargo install --version=0.1.0-beta.1 sqlx-cli

# Postgresql: Enable trust authentication to allow any connections.
RUN mkdir -p /etc/postgresql/11/main
RUN echo "host all all 0.0.0.0/0 trust" > /etc/postgresql/11/main/pg_hba.conf

# Copy geth files
RUN apt-get install -y ca-certificates
RUN mkdir -p /seed/keystore
RUN mkdir -p /var/lib/geth/data
COPY --from=geth /seed/* /seed/
Expand All @@ -33,6 +19,14 @@ RUN tar -xzf geth-linux-amd64-1.9.22-c71a7e26.tar.gz && cp ./geth-linux-amd64-1.
# Copy the setup script
COPY entrypoint.sh /usr/local/bin/

# Install and run postgresql by default
RUN dnf install postgresql-server -y
RUN systemctl enable postgresql

# Postgresql: Enable trust authentication to allow any connections.
RUN mkdir -p /etc/postgresql/11/main
RUN echo "host all all 0.0.0.0/0 trust" > /var/lib/pgsql/data/pg_hba.conf

# Setup the environment
ENV ZKSYNC_HOME=/usr/src/zksync
ENV PATH="${ZKSYNC_HOME}/bin:${PATH}"
12 changes: 10 additions & 2 deletions docker/integration-test/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
nohup /usr/local/bin/geth-entry.sh &>/dev/null &

# Initialize database
service postgresql restart

postgresql-setup --initdb --unit postgresql
zksync db-setup

# Build deps for contracts
pushd $ZKSYNC_HOME/contracts > /dev/null
yarn
popd > /dev/null

# Deploy contracts (they must be already compiled, as we mounted prepared directory)
zksync deploy-erc20 dev
# `deploy-contracts` command from makefile triggers contracts rebuild which we don't want.
Expand All @@ -18,6 +22,10 @@ popd > /dev/null
# Run server genesis
zksync genesis

# Redeploy contracts after genesis
zksync redeploy
zksync db-insert-contract

# Ensure that all the required binaries are compiled
pushd $ZKSYNC_HOME > /dev/null
f cargo build --bin zksync_server --release
Expand Down

0 comments on commit 87f3b21

Please sign in to comment.