From fb7bae0d46ee527ed83b23c4ebae91d28dca2a0d Mon Sep 17 00:00:00 2001 From: Otto G Date: Tue, 11 Feb 2020 09:19:13 +0100 Subject: [PATCH] refactor: reduce projects script overload for deployments --- apps/projects/package.json | 6 +-- apps/projects/truffle-config.js | 2 +- apps/projects/utils/coverage-prep.sh | 13 ------ apps/projects/utils/ganache-cli.sh | 68 ---------------------------- apps/projects/utils/test.sh | 13 ------ 5 files changed, 3 insertions(+), 99 deletions(-) delete mode 100755 apps/projects/utils/coverage-prep.sh delete mode 100755 apps/projects/utils/ganache-cli.sh delete mode 100755 apps/projects/utils/test.sh diff --git a/apps/projects/package.json b/apps/projects/package.json index 5f44080c3..a59564478 100644 --- a/apps/projects/package.json +++ b/apps/projects/package.json @@ -11,8 +11,7 @@ "copy-public-assets": "rsync -rtu ./public/ ./dist", "coverage": "cross-env SOLIDITY_COVERAGE=true npm run ganache-cli:test", "frontend": "npm run sync-assets && parcel app/index.html --port 3333", - "ganache-cli:test": "./utils/ganache-cli.sh", - "ganache-cli:test:orig": "../shared/test-helpers/ganache-cli.sh", + "ganache-cli:test": "sh ../../node_modules/@aragon/test-helpers/ganache-cli.sh", "lint": "solium --dir ./contracts", "precommit": "lint-staged", "prepublishOnly": "truffle compile", @@ -28,7 +27,7 @@ "start": "aragon run", "sync-assets": "copy-aragon-ui-assets -n aragon-ui ./dist && npm run copy-public-assets", "test:gas": "GAS_REPORTER=true npm test", - "test": "TRUFFLE_TEST=true npm run ganache-cli:test", + "test": "cross-env TRUFFLE_TEST=true npm run ganache-cli:test", "test:truffle": "./utils/test.sh" }, "dependencies": { @@ -64,7 +63,6 @@ "@babel/plugin-transform-runtime": "^7.6.0", "@babel/preset-env": "^7.4.5", "@babel/preset-react": "^7.0.0", - "@tps/test-helpers": "^0.0.1", "babel-eslint": "^10.0.1", "babel-plugin-styled-components": "^1.10.0", "cross-env": "^5.2.0", diff --git a/apps/projects/truffle-config.js b/apps/projects/truffle-config.js index 1a77c8c89..2968b8266 100644 --- a/apps/projects/truffle-config.js +++ b/apps/projects/truffle-config.js @@ -1 +1 @@ -module.exports = require('@tps/test-helpers/truffle-config') +module.exports = require('@aragon/os/truffle-config') diff --git a/apps/projects/utils/coverage-prep.sh b/apps/projects/utils/coverage-prep.sh deleted file mode 100755 index ddce26c6b..000000000 --- a/apps/projects/utils/coverage-prep.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -sleep 5 -IFS=$'\n' -cd ../../shared/integrations/StandardBounties -BOUNT_ADDR=($(./node_modules/.bin/truffle migrate --network coverage | grep "^0x[[:alnum:]]\{40\}")) -echo "Bounties Addresses: ${BOUNT_ADDR[*]}" -BOUNT_ADDR=($(./node_modules/.bin/truffle migrate --network coverage | grep "^0x[[:alnum:]]\{40\}")) -echo "Alternate Bounties Addresses: ${BOUNT_ADDR[*]}" -#./node_modules/.bin/truffle version -#./node_modules/.bin/truffle migrate --network coverage -cd ../../../apps/projects -unset IFS -#BOUNT_ADDR=${BOUNT_ADDR[*]} truffle test --network rpc diff --git a/apps/projects/utils/ganache-cli.sh b/apps/projects/utils/ganache-cli.sh deleted file mode 100755 index 0da9a7a76..000000000 --- a/apps/projects/utils/ganache-cli.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env bash - -# Exit script as soon as a command fails. -set -o errexit - -if [ "$SOLIDITY_COVERAGE" = true ]; then - testrpc_port=8555 -else - testrpc_port=8545 -fi - -testrpc_running() { - nc -z localhost "$testrpc_port" -} - -start_testrpc() { - if [ "$SOLIDITY_COVERAGE" = true ]; then - testrpc-sc -i 16 --gasLimit 0xfffffffffff --port "$testrpc_port" -m \ - 'fat super pupil virus rather alpha man surface drive increase trap winter' > /dev/null & - elif [ "$TRUFFLE_TEST" = true ]; then - ganache-cli -i 15 --gasLimit 50000000 --port "$testrpc_port" -m \ - 'fat super pupil virus rather alpha man surface drive increase trap winter' > /dev/null & - elif [ "$START_KIT" = true ]; then - aragon devchain --port "$testrpc_port" & - elif [ "$RESTART_KIT" = true ] || [ "$CYPRESS" = true ]; then - rm -rf ~/.ipfs - aragon devchain --reset --port "$testrpc_port" & - fi - - testrpc_pid=$! -} - -if testrpc_running; then - echo "Killing testrpc instance at port $testrpc_port" - kill -9 "$(lsof -i:"$testrpc_port" -sTCP:LISTEN -t)" -fi - -echo "Starting our own testrpc instance at port $testrpc_port" -start_testrpc -sleep 5 - -# Exit error mode so the testrpc instance always gets killed -set +e -result=0 -if [ "$SOLIDITY_COVERAGE" = true ]; then - ./utils/coverage-prep.sh - solidity-coverage "$@" - result=$? -elif [ "$TRUFFLE_TEST" = true ]; then - ./utils/test.sh | grep -v 'Compiling' - result=$? -elif [ "$START_KIT" = true ] || [ "$RESTART_KIT" = true ]; then - npm run publish:apps && npm run start:kit - result=$? -elif [ "$DEV" = true ]; then - npm run publish:http && npm run start:kit - result=$? -elif [ "$CYPRESS" = true ]; then - npm run publish:apps && npm run start:kit &> /dev/null & - npm run cypress:run - result=$? - kill -9 "$(lsof -i:3000 -sTCP:LISTEN -t)" # kill parcel dev server - kill -9 "$(lsof -i:8080 -sTCP:LISTEN -t)" # kill IPFS daemon -fi - -kill -9 $testrpc_pid - -exit $result diff --git a/apps/projects/utils/test.sh b/apps/projects/utils/test.sh deleted file mode 100755 index c7db2fb73..000000000 --- a/apps/projects/utils/test.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -sleep 5 -IFS=$'\n' -cd ../../shared/integrations/StandardBounties -BOUNT_ADDR=($(./node_modules/.bin/truffle migrate --network development | grep "^0x[[:alnum:]]\{40\}")) -echo "Bounties Addresses: ${BOUNT_ADDR[*]}" -BOUNT_ADDR=($(./node_modules/.bin/truffle migrate --network development | grep "^0x[[:alnum:]]\{40\}")) -echo "Alternate Bounties Addresses: ${BOUNT_ADDR[*]}" -#./node_modules/.bin/truffle version -#./node_modules/.bin/truffle migrate --network development -cd ../../../apps/projects -unset IFS -BOUNT_ADDR=${BOUNT_ADDR[*]} truffle test --network rpc