From 5b6e1560b3d869408deba38c542c343d1f04b096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 27 Nov 2020 18:11:18 +0100 Subject: [PATCH 1/9] Enable Colony, Gnosis and OpenZeppelin external tests in the main CI workflow --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6a7a03a61..f554c134b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1123,6 +1123,9 @@ workflows: - t_ems_compile_ext_gnosis: *workflow_emscripten - t_ems_compile_ext_zeppelin: *workflow_emscripten - t_ems_compile_ext_ens: *workflow_emscripten + - t_ems_test_ext_colony: *workflow_emscripten + - t_ems_test_ext_gnosis: *workflow_emscripten + - t_ems_test_ext_zeppelin: *workflow_emscripten # Windows build and tests - b_win: *workflow_trigger_on_tags From f737f66196f0bcc957b5b3f2a289d90d18ef2b72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 27 Nov 2020 18:27:37 +0100 Subject: [PATCH 2/9] Temporarily disable gitter notifications for external tests --- .circleci/config.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f554c134b..a448550b6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -846,8 +846,9 @@ jobs: name: External GnosisSafe tests command: | test/externalTests/gnosis.sh /tmp/workspace/soljson.js || test/externalTests/gnosis.sh /tmp/workspace/soljson.js - - run: *gitter_notify_failure - - run: *gitter_notify_success + # TODO: Re-enable notifications once this is running nightly rather than as a PR check + #- run: *gitter_notify_failure + #- run: *gitter_notify_success t_ems_compile_ext_zeppelin: docker: @@ -877,8 +878,9 @@ jobs: name: External Zeppelin tests command: | test/externalTests/zeppelin.sh /tmp/workspace/soljson.js || test/externalTests/zeppelin.sh /tmp/workspace/soljson.js - - run: *gitter_notify_failure - - run: *gitter_notify_success + # TODO: Re-enable notifications once this is running nightly rather than as a PR check + #- run: *gitter_notify_failure + #- run: *gitter_notify_success t_ems_compile_ext_colony: docker: @@ -916,8 +918,9 @@ jobs: name: External ColonyNetworks tests command: | test/externalTests/colony.sh /tmp/workspace/soljson.js || test/externalTests/colony.sh /tmp/workspace/soljson.js - - run: *gitter_notify_failure - - run: *gitter_notify_success + # TODO: Re-enable notifications once this is running nightly rather than as a PR check + #- run: *gitter_notify_failure + #- run: *gitter_notify_success t_ems_compile_ext_ens: docker: From 45c506a4ffae6ada0d315c2957cb7e864b61ffaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 1 Dec 2020 23:53:00 +0100 Subject: [PATCH 3/9] Stop running external tests twice in CI --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a448550b6..39a6cac34 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -845,7 +845,7 @@ jobs: - run: name: External GnosisSafe tests command: | - test/externalTests/gnosis.sh /tmp/workspace/soljson.js || test/externalTests/gnosis.sh /tmp/workspace/soljson.js + test/externalTests/gnosis.sh /tmp/workspace/soljson.js # TODO: Re-enable notifications once this is running nightly rather than as a PR check #- run: *gitter_notify_failure #- run: *gitter_notify_success @@ -877,7 +877,7 @@ jobs: - run: name: External Zeppelin tests command: | - test/externalTests/zeppelin.sh /tmp/workspace/soljson.js || test/externalTests/zeppelin.sh /tmp/workspace/soljson.js + test/externalTests/zeppelin.sh /tmp/workspace/soljson.js # TODO: Re-enable notifications once this is running nightly rather than as a PR check #- run: *gitter_notify_failure #- run: *gitter_notify_success @@ -917,7 +917,7 @@ jobs: - run: name: External ColonyNetworks tests command: | - test/externalTests/colony.sh /tmp/workspace/soljson.js || test/externalTests/colony.sh /tmp/workspace/soljson.js + test/externalTests/colony.sh /tmp/workspace/soljson.js # TODO: Re-enable notifications once this is running nightly rather than as a PR check #- run: *gitter_notify_failure #- run: *gitter_notify_success From e05241adfc6b8a9f1eedd6517f6cfe811bfa49b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 27 Nov 2020 18:12:08 +0100 Subject: [PATCH 4/9] Update Colony, Gnosis and OpenZeppelin external tests to run on updated 0.7.x branches from solidity-external-tests --- .circleci/config.yml | 4 ++-- test/externalTests/colony.sh | 4 ++-- test/externalTests/common.sh | 7 ------- test/externalTests/ens.sh | 3 +++ test/externalTests/gnosis.sh | 11 +++++------ test/externalTests/zeppelin.sh | 2 +- 6 files changed, 13 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 39a6cac34..fae54b292 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -884,7 +884,7 @@ jobs: t_ems_compile_ext_colony: docker: - - image: circleci/node:10 + - image: circleci/node:12 environment: TERM: xterm steps: @@ -903,7 +903,7 @@ jobs: t_ems_test_ext_colony: docker: - - image: circleci/node:10 + - image: circleci/node:12 environment: TERM: xterm steps: diff --git a/test/externalTests/colony.sh b/test/externalTests/colony.sh index b5a58af1b..87d96b463 100755 --- a/test/externalTests/colony.sh +++ b/test/externalTests/colony.sh @@ -33,12 +33,12 @@ function colony_test OPTIMIZER_LEVEL=3 CONFIG="truffle.js" - truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/colonyNetwork.git develop_070 + truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/colonyNetwork.git develop_070_new run_install "$SOLJSON" install_fn cd lib rm -Rf dappsys - git clone https://github.com/solidity-external-tests/dappsys-monolithic.git -b master_060 dappsys + git clone https://github.com/solidity-external-tests/dappsys-monolithic.git -b master_070 dappsys cd .. truffle_run_test "$SOLJSON" compile_fn test_fn diff --git a/test/externalTests/common.sh b/test/externalTests/common.sh index a0321afac..37c3f8109 100644 --- a/test/externalTests/common.sh +++ b/test/externalTests/common.sh @@ -109,13 +109,6 @@ function replace_version_pragmas find . test -name '*.sol' -type f -print0 | xargs -0 sed -i -E -e 's/pragma solidity [^;]+;/pragma solidity >=0.0;/' } -function replace_libsolc_call -{ - # Change "compileStandard" to "compile" (needed for pre-5.x Truffle) - printLog "Replacing libsolc compile call in Truffle..." - sed -i s/solc.compileStandard/solc.compile/ "node_modules/truffle/build/cli.bundled.js" -} - function find_truffle_config { local config_file="truffle.js" diff --git a/test/externalTests/ens.sh b/test/externalTests/ens.sh index 480d59eab..907411b6d 100755 --- a/test/externalTests/ens.sh +++ b/test/externalTests/ens.sh @@ -38,6 +38,9 @@ function ens_test # Use latest Truffle. Older versions crash on the output from 0.8.0. force_truffle_version ^5.1.55 + # Remove the lock file (if it exists) to prevent it from overriding our changes in package.json + rm -f package-lock.json + run_install "$SOLJSON" install_fn truffle_run_test "$SOLJSON" compile_fn test_fn diff --git a/test/externalTests/gnosis.sh b/test/externalTests/gnosis.sh index 92c18016f..7ea76c067 100755 --- a/test/externalTests/gnosis.sh +++ b/test/externalTests/gnosis.sh @@ -31,17 +31,16 @@ function test_fn { npm test; } function gnosis_safe_test { OPTIMIZER_LEVEL=1 - CONFIG="truffle.js" + CONFIG="truffle-config.js" - truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/safe-contracts.git development_070 + truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/safe-contracts.git development_070_new - force_truffle_version ^5.0.42 - sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_070|g' package.json + sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_070_new|g' package.json + + # Remove the lock file (if it exists) to prevent it from overriding our changes in package.json rm -f package-lock.json - rm -rf node_modules/ run_install "$SOLJSON" install_fn - replace_libsolc_call truffle_run_test "$SOLJSON" compile_fn test_fn } diff --git a/test/externalTests/zeppelin.sh b/test/externalTests/zeppelin.sh index 9862585d3..05a240c2a 100755 --- a/test/externalTests/zeppelin.sh +++ b/test/externalTests/zeppelin.sh @@ -33,7 +33,7 @@ function zeppelin_test OPTIMIZER_LEVEL=1 CONFIG="truffle-config.js" - truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/openzeppelin-contracts.git upgrade-0.7.0 + truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/openzeppelin-contracts.git master_070 run_install "$SOLJSON" install_fn truffle_run_test "$SOLJSON" compile_fn test_fn From 70a2fc58b0d998bcf87eabe506e7763f6449df23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 1 Dec 2020 19:59:54 +0100 Subject: [PATCH 5/9] Add jobs and scripts running external tests for Gnosis v2 --- .circleci/config.yml | 34 +++++++++++++++++++++++ test/externalTests.sh | 1 + test/externalTests/gnosis-v2.sh | 49 +++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100755 test/externalTests/gnosis-v2.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index fae54b292..31aa09100 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -850,6 +850,38 @@ jobs: #- run: *gitter_notify_failure #- run: *gitter_notify_success + t_ems_compile_ext_gnosis_v2: + docker: + - image: circleci/node:10 + environment: + TERM: xterm + steps: + - checkout + - attach_workspace: + at: /tmp/workspace + - run: + name: External GnosisSafe v2 compilation + command: | + export COMPILE_ONLY=1 + test/externalTests/gnosis-v2.sh /tmp/workspace/soljson.js + + t_ems_test_ext_gnosis_v2: + docker: + - image: circleci/node:10 + environment: + TERM: xterm + steps: + - checkout + - attach_workspace: + at: /tmp/workspace + - run: + name: External GnosisSafe v2 tests + command: | + test/externalTests/gnosis-v2.sh /tmp/workspace/soljson.js + # TODO: Re-enable notifications once this is running nightly rather than as a PR check + #- run: *gitter_notify_failure + #- run: *gitter_notify_success + t_ems_compile_ext_zeppelin: docker: - image: circleci/node:10 @@ -1124,10 +1156,12 @@ workflows: - t_ems_solcjs: *workflow_emscripten - t_ems_compile_ext_colony: *workflow_emscripten - t_ems_compile_ext_gnosis: *workflow_emscripten + - t_ems_compile_ext_gnosis_v2: *workflow_emscripten - t_ems_compile_ext_zeppelin: *workflow_emscripten - t_ems_compile_ext_ens: *workflow_emscripten - t_ems_test_ext_colony: *workflow_emscripten - t_ems_test_ext_gnosis: *workflow_emscripten + - t_ems_test_ext_gnosis_v2: *workflow_emscripten - t_ems_test_ext_zeppelin: *workflow_emscripten # Windows build and tests diff --git a/test/externalTests.sh b/test/externalTests.sh index e53f9925a..28af6f835 100755 --- a/test/externalTests.sh +++ b/test/externalTests.sh @@ -44,6 +44,7 @@ printTask "Running external tests..." "$REPO_ROOT/externalTests/zeppelin.sh" "$SOLJSON" "$REPO_ROOT/externalTests/gnosis.sh" "$SOLJSON" +"$REPO_ROOT/externalTests/gnosis-v2.sh" "$SOLJSON" "$REPO_ROOT/externalTests/colony.sh" "$SOLJSON" "$REPO_ROOT/externalTests/ens.sh" "$SOLJSON" diff --git a/test/externalTests/gnosis-v2.sh b/test/externalTests/gnosis-v2.sh new file mode 100755 index 000000000..6f3563ca3 --- /dev/null +++ b/test/externalTests/gnosis-v2.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +# ------------------------------------------------------------------------------ +# This file is part of solidity. +# +# solidity is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# solidity is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with solidity. If not, see +# +# (c) 2020 solidity contributors. +#------------------------------------------------------------------------------ +source scripts/common.sh +source test/externalTests/common.sh + +verify_input "$1" +SOLJSON="$1" + +function install_fn { npm install --package-lock; } +function compile_fn { npx truffle compile; } +function test_fn { npm test; } + +function gnosis_safe_test +{ + OPTIMIZER_LEVEL=1 + CONFIG="truffle-config.js" + + truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/safe-contracts.git v2_070 + + sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_070_new|g' package.json + sed -i -E 's|"@gnosis.pm/util-contracts": "[^"]+"|"@gnosis.pm/util-contracts": "github:solidity-external-tests/util-contracts#solc-7"|g' package.json + + # Remove the lock file (if it exists) to prevent it from overriding our changes in package.json + rm -f package-lock.json + + run_install "$SOLJSON" install_fn + + truffle_run_test "$SOLJSON" compile_fn test_fn +} + +external_test Gnosis-Safe gnosis_safe_test From 0c5d3c0cdfbe7e9f794f59efb67ab4fca4c91597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 2 Dec 2020 01:39:07 +0100 Subject: [PATCH 6/9] Add a job for executing external tests for ENS --- .circleci/config.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 31aa09100..30452f5ae 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -973,6 +973,27 @@ jobs: export COMPILE_ONLY=1 test/externalTests/ens.sh /tmp/workspace/soljson.js + t_ems_test_ext_ens: + docker: + - image: circleci/node:10 + environment: + TERM: xterm + steps: + - checkout + - attach_workspace: + at: /tmp/workspace + - run: + name: Install test dependencies + command: | + sudo apt-get -qy install lsof + - run: + name: External Ens compilation + command: | + test/externalTests/ens.sh /tmp/workspace/soljson.js + # TODO: Re-enable notifications once this is running nightly rather than as a PR check + #- run: *gitter_notify_failure + #- run: *gitter_notify_success + b_win: &b_win executor: name: win/default @@ -1163,6 +1184,7 @@ workflows: - t_ems_test_ext_gnosis: *workflow_emscripten - t_ems_test_ext_gnosis_v2: *workflow_emscripten - t_ems_test_ext_zeppelin: *workflow_emscripten + - t_ems_test_ext_ens: *workflow_emscripten # Windows build and tests - b_win: *workflow_trigger_on_tags From c7b95e385f563c0df1d963069152942250983a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 1 Dec 2020 21:20:22 +0100 Subject: [PATCH 7/9] external tests: Update solc-js dependencies after forcefully replacing it - Otherwise it fails if the external project uses a version that is too old and does not have some newly added dependencies --- test/externalTests/common.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/externalTests/common.sh b/test/externalTests/common.sh index 37c3f8109..a9f7bf2c8 100644 --- a/test/externalTests/common.sh +++ b/test/externalTests/common.sh @@ -135,6 +135,9 @@ function force_solc_truffle_modules rm -rf solc git clone --depth 1 -b master https://github.com/ethereum/solc-js.git solc cp "$1" solc/soljson.js + + cd solc + npm install fi ) done From 9d1e0270cde9f7e32c213ca2efb874db4de10196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 4 Dec 2020 14:20:55 +0100 Subject: [PATCH 8/9] Bump node.js version to 12 or 14 on external test jobs where possible --- .circleci/config.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 30452f5ae..1c6e19728 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -820,7 +820,7 @@ jobs: t_ems_compile_ext_gnosis: docker: - - image: circleci/node:10 + - image: circleci/node:14 environment: TERM: xterm steps: @@ -835,7 +835,8 @@ jobs: t_ems_test_ext_gnosis: docker: - - image: circleci/node:10 + # NOTE: Tests do not start on node.js 14 ("ganache-cli exited early with code 1"). + - image: circleci/node:12 environment: TERM: xterm steps: @@ -852,7 +853,7 @@ jobs: t_ems_compile_ext_gnosis_v2: docker: - - image: circleci/node:10 + - image: circleci/node:14 environment: TERM: xterm steps: @@ -867,7 +868,8 @@ jobs: t_ems_test_ext_gnosis_v2: docker: - - image: circleci/node:10 + # NOTE: Tests do not start on node.js 14 ("ganache-cli exited early with code 1"). + - image: circleci/node:12 environment: TERM: xterm steps: @@ -884,7 +886,7 @@ jobs: t_ems_compile_ext_zeppelin: docker: - - image: circleci/node:10 + - image: circleci/node:14 environment: TERM: xterm steps: @@ -899,7 +901,7 @@ jobs: t_ems_test_ext_zeppelin: docker: - - image: circleci/node:10 + - image: circleci/node:14 environment: TERM: xterm steps: @@ -916,7 +918,7 @@ jobs: t_ems_compile_ext_colony: docker: - - image: circleci/node:12 + - image: circleci/node:14 environment: TERM: xterm steps: @@ -935,7 +937,7 @@ jobs: t_ems_test_ext_colony: docker: - - image: circleci/node:12 + - image: circleci/node:14 environment: TERM: xterm steps: @@ -956,6 +958,7 @@ jobs: t_ems_compile_ext_ens: docker: + # NOTE: One of the dependencies (fsevents) fails to build its native extension on node.js 12+. - image: circleci/node:10 environment: TERM: xterm @@ -975,6 +978,7 @@ jobs: t_ems_test_ext_ens: docker: + # NOTE: One of the dependencies (fsevents) fails to build its native extension on node.js 12+. - image: circleci/node:10 environment: TERM: xterm From 1f55e9213b63cc695ae14bcfe21693d7242bf7dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 4 Dec 2020 18:42:27 +0100 Subject: [PATCH 9/9] Disable flaky Gnosis v1 tests --- .circleci/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1c6e19728..83022f919 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1185,7 +1185,9 @@ workflows: - t_ems_compile_ext_zeppelin: *workflow_emscripten - t_ems_compile_ext_ens: *workflow_emscripten - t_ems_test_ext_colony: *workflow_emscripten - - t_ems_test_ext_gnosis: *workflow_emscripten + # FIXME: Gnosis tests are pretty flaky right now. They often fail on CircleCI due to random ProviderError + # and there are also other less frequent problems. See https://github.com/gnosis/safe-contracts/issues/216. + #- t_ems_test_ext_gnosis: *workflow_emscripten - t_ems_test_ext_gnosis_v2: *workflow_emscripten - t_ems_test_ext_zeppelin: *workflow_emscripten - t_ems_test_ext_ens: *workflow_emscripten