From 9992a4268744bc1b066f4b18ac89a72806759a4e Mon Sep 17 00:00:00 2001 From: cgewecke Date: Sun, 24 Nov 2019 15:41:23 -0800 Subject: [PATCH 1/3] Add moloch E2E test --- scripts/run-moloch.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 scripts/run-moloch.sh diff --git a/scripts/run-moloch.sh b/scripts/run-moloch.sh new file mode 100755 index 00000000..e988dcfd --- /dev/null +++ b/scripts/run-moloch.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# +# E2E CI: installs PR candidate on sc-forks/buidler-e2e (a simple example, +# similar to Metacoin) and runs coverage +# + +set -o errexit + +# Get rid of any caches +sudo rm -rf node_modules +echo "NVM CURRENT >>>>>" && nvm current + +# Use PR env variables (for forks) or fallback on local if PR not available +SED_REGEX="s/git@github.com:/https:\/\/github.com\//" + +if [[ -v CIRCLE_PR_REPONAME ]]; then + PR_PATH="https://github.com/$CIRCLE_PR_USERNAME/$CIRCLE_PR_REPONAME#$CIRCLE_SHA1" +else + PR_PATH=$(echo "$CIRCLE_REPOSITORY_URL#$CIRCLE_SHA1" | sudo sed "$SED_REGEX") +fi + +echo "PR_PATH >>>>> $PR_PATH" + +# Install buidler e2e test +git clone https://github.com/sc-forks/moloch.git#buidler-upgrade-coverage +cd moloch +npm install +npm uninstall --save-dev solidity-coverage + +# Install and run solidity-coverage @ PR +npm install --save-dev $PR_PATH +npm run coverage + +# Test that coverage/ was generated +if [ ! -d "coverage" ]; then + echo "ERROR: no coverage folder was created." + exit 1 +fi From 8c27c81b24594d1fb30c070b1c4bdaff56454d56 Mon Sep 17 00:00:00 2001 From: cgewecke Date: Sun, 24 Nov 2019 15:51:06 -0800 Subject: [PATCH 2/3] Add job to circle.ci --- .circleci/config.yml | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ec2d2fb4..11eb785d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,7 @@ version: 2.0 -# Necessary for running in machine mode, which is necessary to execute the -# Zeppelin and MetaCoin E2E scripts + +# Necessary for running in machine mode, +# which is necessary to execute the E2E scripts step_install_nvm: &step_install_nvm run: name: "Install nvm for machine" @@ -12,6 +13,7 @@ step_install_nvm: &step_install_nvm nvm alias default v8.15.0 echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV + jobs: unit-test: machine: true @@ -82,6 +84,15 @@ jobs: name: Buidler E2E command: | ./scripts/run-buidler.sh + e2e-moloch: + machine: true + steps: + - checkout + - <<: *step_install_nvm + - run: + name: Moloch E2E + command: | + ./scripts/run-moloch.sh workflows: version: 2 build: @@ -90,16 +101,4 @@ workflows: - e2e-zeppelin - e2e-metacoin - e2e-buidler - # TODO: re-enable. - # At the moment we're using forks so this is pointless - #nightly: - # triggers: - # - schedule: - # cron: "0 1 * * *" # 1am UTC - # filters: - # branches: - # only: - # - master - # jobs: - #- e2e-zeppelin - #- e2e-colony + - e2e-moloch From fa2d647cdbebc49b6b26b928ac65db10fa71b852 Mon Sep 17 00:00:00 2001 From: cgewecke Date: Sun, 24 Nov 2019 15:56:44 -0800 Subject: [PATCH 3/3] Use default branch of fork --- scripts/run-moloch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/run-moloch.sh b/scripts/run-moloch.sh index e988dcfd..4c1191ee 100755 --- a/scripts/run-moloch.sh +++ b/scripts/run-moloch.sh @@ -22,7 +22,7 @@ fi echo "PR_PATH >>>>> $PR_PATH" # Install buidler e2e test -git clone https://github.com/sc-forks/moloch.git#buidler-upgrade-coverage +git clone https://github.com/sc-forks/moloch.git cd moloch npm install npm uninstall --save-dev solidity-coverage