Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Merge 3187fa7 into 3966d6c
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmagier committed Jan 26, 2020
2 parents 3966d6c + 3187fa7 commit e7eb59e
Show file tree
Hide file tree
Showing 15 changed files with 124 additions and 47 deletions.
58 changes: 47 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
dist: xenial
sudo: required
os: linux
language: node_js

# configure Travis to run on-push builds only on PR-recipient branches
Expand All @@ -9,41 +8,78 @@ branches:
- master
- develop
- next

# other targets
- truffle-db

before_install:
- npm install -g yarn
install:
- yarn bootstrap
- truffle obtain --solc=0.5.16

script: yarn ci


matrix:
jobs:
fast_finish: true
include:
- node_js: 8
env: FABRICEVM=true
install:
- yarn bootstrap
- truffle obtain --solc=0.5.16
# WINDOWS -- BEGINNING --
- node_js: 10
os: windows
env:
# Use YARN_GPG=no so Travis doesn't freeze after finished build
- YARN_GPG=no WINDOWS=true
before_install:
- powershell Set-ExecutionPolicy -ExecutionPolicy unrestricted
# We hav to use powershell to install geth on windows environment. Git Bash doesn't have package manager.
- powershell ./scripts/install_geth.ps1
- npm install -g yarn
install:
- yarn bootstrap
# WINDOWS -- END --
# WINDOWS -- BEGINNING --
- node_js: 10
os: windows
env:
# Use YARN_GPG=no so Travis doesn't freeze after finished build. Run test with GETH
- YARN_GPG=no WINDOWS=true GETH=true
before_install:
- powershell Set-ExecutionPolicy -ExecutionPolicy unrestricted
# We hav to use powershell to install geth on windows environment. Git Bash doesn't have package manager.
- powershell ./scripts/install_geth.ps1
- npm install -g yarn
install:
- yarn bootstrap
# WINDOWS -- END --
- node_js: 8
env: COVERAGE=true
install:
- yarn bootstrap
- truffle obtain --solc=0.5.16
- if: |
branch = develop AND \
type = push
node_js: 10
env: COLONY=true
install:
- yarn bootstrap
- truffle obtain --solc=0.5.16
allow_failures:
- node_js: 8
env: COVERAGE=true
- os: windows
- env: COVERAGE=true

install:
- yarn bootstrap
- truffle obtain --solc=0.5.8

cache:
directories:
- node_modules
- $(npm config get prefix)/lib/node_modules # globally installed stuff (i.e. lerna)
- ~/.config/truffle/compilers

script:
- yarn ci

notifications:
slack:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"publish-dist-tag": "./scripts/publish-dist-tag.sh",
"prepare-release": "./scripts/prepare-release.sh",
"test": "lerna run test --stream --concurrency=1 -- --colors",
"ci": "./scripts/ci.sh",
"ci": "bash ./scripts/ci.sh",
"geth": "./scripts/geth.sh",
"solc-bump": "node ./scripts/solc-bump.js",
"update": "lernaupdate"
Expand Down
2 changes: 1 addition & 1 deletion packages/blockchain-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"scripts": {
"build": "tsc",
"prepare": "yarn build",
"test": "mocha --exit -r ts-node/register test/**/*.test.ts"
"test": "mocha --exit -r ts-node/register \"test/**/*.test.ts\""
},
"types": "./typings/index.d.ts",
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/code-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"scripts": {
"build": "tsc",
"prepare": "yarn build",
"test": "mocha --exit -r ts-node/register test/**/*.test.ts"
"test": "mocha --exit -r ts-node/register \"test/**/*.test.ts\""
},
"types": "./typings/index.d.ts",
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/compile-solidity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
]
},
"scripts": {
"test": "./scripts/test.sh"
"test": "bash ./scripts/test.sh"
},
"repository": "https://github.com/trufflesuite/truffle/tree/master/packages/compile-solidity",
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions packages/compile-solidity/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
set -o errexit

if [ "$CI" = true ]; then
mocha ./test/** ./test/**/* --timeout 10000 $@
mocha ./test --recursive --timeout 10000 $@
else
rm -rf ./node_modules/.cache/truffle
mocha ./test/** ./test/**/* --invert --grep native --timeout 10000 $@
mocha ./test --recursive --invert --grep native --timeout 10000 $@
fi
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"build": "tsc",
"prepare": "yarn build",
"test": "yarn build && mocha --exit -r ts-node/register test/**/*.test.ts"
"test": "yarn build && mocha --exit -r ts-node/register \"test/**/*.test.ts\""
},
"repository": "https://github.com/trufflesuite/truffle/tree/master/packages/config",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"compile": "sh -c \"mkdir -p ./dist\" && browserify ./index.js -o ./dist/truffle-contract.js && uglifyjs ./dist/truffle-contract.js -o ./dist/truffle-contract.min.js",
"prepare": "yarn compile",
"publish:next": "node ../truffle/scripts/prereleaseVersion.js next next",
"test": "./scripts/test.sh",
"test": "bash ./scripts/test.sh",
"test:debug": "$(yarn bin)/mocha --inspect-brk",
"test:trace": "$(yarn bin)/mocha --trace-warnings"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/hdwallet-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"scripts": {
"build": "tsc",
"prepare": "yarn build",
"test": "yarn build && mocha --exit -r ts-node/register test/**/*.test.ts"
"test": "yarn build && mocha --exit -r ts-node/register \"test/**/*.test.ts\""
},
"types": "dist/index.d.ts",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/interface-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"scripts": {
"build": "tsc",
"prepare": "yarn build",
"test": "mocha --exit -r ts-node/register test/**/*.test.ts",
"test": "mocha \"test/**/*.test.ts\" --exit -r ts-node/register ",
"watch": "tsc -w"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/migrate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"version": "3.1.6",
"main": "index.js",
"scripts": {
"test": "mocha ./test/* ./test/**/*"
"test": "mocha ./test --recursive"
},
"dependencies": {
"@truffle/config": "^1.2.12",
Expand Down
2 changes: 1 addition & 1 deletion packages/truffle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"publish:external-compiler": "node ./scripts/prereleaseVersion.js external-compiler external-compiler",
"publish:next": "node ./scripts/prereleaseVersion.js next next",
"publish:user-level-mnemonic": "node ./scripts/prereleaseVersion.js user-level-mnemonic user-level-mnemonic",
"test": "./scripts/test.sh",
"test": "bash ./scripts/test.sh",
"test:raw": "NO_BUILD=true mocha"
},
"dependencies": {
Expand Down
5 changes: 4 additions & 1 deletion packages/truffle/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

set -o errexit

if [ "$GETH" == true ]; then

if [ "$WINDOWS" == true ] && [ "$GETH" = false ]; then
mocha --no-warnings --timeout 7000 --grep @geth --invert --colors $@
elif [ "$GETH" == true ]; then
mocha --timeout 50000 --grep '@ganache|@standalone' --invert --colors $@
elif [ "$QUORUM" == true ]; then
mocha --timeout 50000 --grep @quorum --colors $@
Expand Down
73 changes: 50 additions & 23 deletions scripts/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,69 @@
# Exit script as soon as a command fails.
set -o errexit

GETH_OPTIONS="--rpc \
--rpcaddr 0.0.0.0 \
--rpcport 8545 \
--rpccorsdomain '*' \
--ws \
--wsaddr 0.0.0.0 \
--wsorigins '*' \
--nodiscover \
--dev \
--dev.period 0 \
--allow-insecure-unlock \
--miner.gastarget 7000000 \
--nousb \
--verbosity 1 \
--override.istanbul 0 \
js ./scripts/geth-accounts.js"

#We don't redirect to /dev/null because verbosity is set to 1. This will show errors, but nothing else.
run_geth() {
docker run \
if [ "$WINDOWS" = true ]; then
export PATH=$PATH:"/C/Program Files/Geth"
geth $GETH_OPTIONS > /dev/null &
GETH_PID=$!
else
sudo apt install -y jq
docker pull ethereum/client-go:latest
docker run \
-v /$PWD/scripts:/scripts \
-d \
-p 8545:8545 \
-p 8546:8546 \
-p 30303:30303 \
ethereum/client-go:latest \
--rpc \
--rpcaddr '0.0.0.0' \
--rpcport 8545 \
--rpccorsdomain '*' \
--ws \
--wsaddr '0.0.0.0' \
--wsorigins '*' \
--nodiscover \
--dev \
--dev.period 0 \
--allow-insecure-unlock \
--targetgaslimit '7000000' \
--override.istanbul '0' \
js ./scripts/geth-accounts.js \
> /dev/null &
$GETH_OPTIONS > /dev/null
fi
}

if [ "$INTEGRATION" = true ]; then

sudo apt install -y jq
if [ "$WINDOWS" = true ]; then
if [ "$GETH" = true ]; then
# Do not quit if first test fails because we still have to run other test and then KILL!!! Geth.
set +o errexit
run_geth
sleep 30
lerna run --scope truffle test --stream -- --exit
EXIT_CODE=$?
lerna run --scope @truffle/contract test --stream -- --exit
EXIT_CODE=$(($EXIT_CODE|$?))
kill -9 $GETH_PID
exit $EXIT_CODE
else
lerna run --scope truffle test --stream -- --exit
lerna run --scope @truffle/contract test --stream -- --exit
fi
ps auxf

elif [ "$INTEGRATION" = true ]; then

sudo apt install -y jq
lerna run --scope truffle test --stream

elif [ "$GETH" = true ]; then

sudo apt install -y jq
docker pull ethereum/client-go:latest
run_geth
run_geth &
sleep 30
lerna run --scope truffle test --stream -- --exit
lerna run --scope @truffle/contract test --stream -- --exit
Expand Down Expand Up @@ -119,5 +147,4 @@ elif [ "$COVERAGE" = true ]; then
cd ../../ && nyc lerna run --ignore debugger test && \
cat ./packages/debugger/coverage/lcov.info >> ./coverage/lcov.info && \
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js

fi
11 changes: 11 additions & 0 deletions scripts/install_geth.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

# Download and install last Geth version for windows.
# There is no Geth Docker version for windows.
# This must be powershell script because git bash does not have package manager and cannot install anything.
Write-Output "Download geth..."
Invoke-WebRequest https://gethstore.blob.core.windows.net/builds/geth-windows-amd64-1.9.9-01744997.exe -OutFile geth-windows-amd64-1.9.9-01744997.exe
Write-Output "Install geth... Wait 30 seconds"
Start-Process -FilePath geth-windows-amd64-1.9.9-01744997.exe -ArgumentList "/S"
sleep 30


0 comments on commit e7eb59e

Please sign in to comment.