Skip to content

Commit

Permalink
ci: split the prover and integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dtebbs committed Jan 29, 2021
1 parent 64c91a7 commit 8d693e5
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 12 deletions.
59 changes: 51 additions & 8 deletions .github/workflows/onpullrequest-build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,50 @@ jobs:
git submodule sync
echo "::set-output name=commits::"`git submodule status depends/libsodium | grep -oe '[0-9a-fA-F]\+' | head -c 8`-`git submodule status depends/libsnark | grep -oe '[0-9a-fA-F]\+' | head -c 8`
build-linux-full:
# Run the prover testing python scripts
prover-tests-linux:
runs-on: ubuntu-20.04
needs: [onpr-build-grpc, onpr-submodules]
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- uses: actions/setup-node@v1
with:
node-version: 10
- name: Cache grpc
uses: actions/cache@v2
with:
key: grpc-1.31.x-${{ runner.os }}-test
path: depends/grpc
- name: Cache ccache
uses: actions/cache@v2
with:
key: prover-tests-ccache-${{ needs.onpr-submodules.outputs.commits }}-${{ runner.os }}-test
path: ~/.ccache
- name: Cache pip
uses: actions/cache@v2
with:
path: |
~/.cache/pip
~/Library/Caches/pip
key: prover-tests-pip-${{ hashFiles('**/setup.py') }}-${{ runner.os }}
- name: Cache npm
uses: actions/cache@v2
with:
path: |
~/.npm
depends/ganache-cli/node_modules
key: prover-tests-npm-${{ hashFiles('**/package-lock.json') }}-${{ runner.os }}
- name: Install dependencies
run: |
scripts/install_grpc /usr v1.31.x depends/grpc
sudo apt install -y ccache
- name: Execute
run: CI_CONFIG=Release CI_CURVE=ALT_BN128 CI_PROVER_TESTS=1 scripts/ci build

# Run all unit tests and integration tests
integration-tests-linux:
runs-on: ubuntu-20.04
needs: [onpr-build-grpc, onpr-submodules]
strategy:
Expand All @@ -55,25 +98,25 @@ jobs:
with:
key: grpc-1.31.x-${{ runner.os }}-test
path: depends/grpc
# - name: Cache ccache
# uses: actions/cache@v2
# with:
# key: submodules-${{ needs.onpr-submodules.outputs.commits }}-${{ runner.os }}-${{ matrix.curve }}
# path: ~/.ccache
- name: Cache ccache
uses: actions/cache@v2
with:
key: integration-tests-ccache-${{ needs.onpr-submodules.outputs.commits }}-${{ matrix.curve }}-${{ runner.os }}-test
path: ~/.ccache
- name: Cache pip
uses: actions/cache@v2
with:
path: |
~/.cache/pip
~/Library/Caches/pip
key: build-linux-full-pip-${{ hashFiles('**/setup.py') }}-${{ runner.os }}
key: integration-tests-pip-${{ hashFiles('**/setup.py') }}-${{ runner.os }}
- name: Cache npm
uses: actions/cache@v2
with:
path: |
~/.npm
depends/ganache-cli/node_modules
key: build-linux-full-npm-${{ hashFiles('**/package-lock.json') }}-${{ runner.os }}
key: integration-tests-npm-${{ hashFiles('**/package-lock.json') }}-${{ runner.os }}
- name: Install dependencies
run: |
scripts/install_grpc /usr v1.31.x depends/grpc
Expand Down
30 changes: 26 additions & 4 deletions scripts/ci
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function mpc_tests() {
scripts/test_mpc_server_phase2
}

function integration_tests() {
function prover_tests() {

# Native code is built. Setup client and ganache.
_setup_ganache
Expand All @@ -233,13 +233,30 @@ function integration_tests() {
_start_ganache
_start_prover_server

# Enter client env and run client test script
# Enter client env and run prover test scripts
. client/env/bin/activate

./scripts/test_zeth_cli
python -m test_commands.test_ether_mixing GROTH16
python -m test_commands.test_erc_token_mixing GROTH16
deactivate

# Stop servers
_stop_prover_server
_stop_ganache
}

function integration_tests() {

# Native code is built. Setup client and ganache.
_setup_ganache
_setup_client

# Start servers
_start_ganache
_start_prover_server

# Enter client env and run client test script
. client/env/bin/activate
./scripts/test_zeth_cli
deactivate

# Stop servers
Expand Down Expand Up @@ -294,6 +311,10 @@ function build() {
mpc_tests
fi

if [ "${CI_PROVER_TESTS}" == "1" ] ; then
prover_tests
fi

if [ "${CI_INTEGRATION_TESTS}" == "1" ] ; then
integration_tests
fi
Expand Down Expand Up @@ -354,6 +375,7 @@ echo CI_CHECK_FORMAT=${CI_CHECK_FORMAT}
echo CI_EVENT_NAME=${CI_EVENT_NAME}
echo CI_FULL_TEST=${CI_FULL_TESTS}
echo CI_MPC_TESTS=${CI_MPC_TESTS}
echo CI_PROVER_TESTS=${CI_PROVER_TESTS}
echo CI_INTEGRATION_TESTS=${CI_INTEGRATION_TESTS}

if [ "${CI_CHECK_FORMAT}" == "1" ] ; then
Expand Down

0 comments on commit 8d693e5

Please sign in to comment.