Skip to content

Commit 404c73d

Browse files
authored
Add simple E2E for Buidler (#438)
1 parent d0f188f commit 404c73d

File tree

5 files changed

+56
-3
lines changed

5 files changed

+56
-3
lines changed

.circleci/config.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,23 @@ jobs:
7373
name: MetaCoin E2E
7474
command: |
7575
./scripts/run-metacoin.sh
76+
e2e-buidler:
77+
machine: true
78+
steps:
79+
- checkout
80+
- <<: *step_install_nvm
81+
- run:
82+
name: Buidler E2E
83+
command: |
84+
./scripts/run-buidler.sh
7685
workflows:
7786
version: 2
7887
build:
7988
jobs:
8089
- unit-test
8190
- e2e-zeppelin
8291
- e2e-metacoin
92+
- e2e-buidler
8393
# TODO: re-enable.
8494
# At the moment we're using forks so this is pointless
8595
#nightly:

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
"name": "solidity-coverage",
33
"version": "0.7.0-beta.2",
44
"description": "",
5-
"main": "index.js",
6-
"buidler": "dist/buidler.coverage.js",
5+
"main": "dist/buidler.plugin.js",
76
"bin": {
87
"solidity-coverage": "./dist/bin.js"
98
},

scripts/run-buidler.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
#
3+
# E2E CI: installs PR candidate on sc-forks/buidler-e2e (a simple example,
4+
# similar to Metacoin) and runs coverage
5+
#
6+
7+
set -o errexit
8+
9+
# Get rid of any caches
10+
sudo rm -rf node_modules
11+
echo "NVM CURRENT >>>>>" && nvm current
12+
13+
# Use PR env variables (for forks) or fallback on local if PR not available
14+
SED_REGEX="s/[email protected]:/https:\/\/github.com\//"
15+
16+
if [[ -v CIRCLE_PR_REPONAME ]]; then
17+
PR_PATH="https://github.com/$CIRCLE_PR_USERNAME/$CIRCLE_PR_REPONAME#$CIRCLE_SHA1"
18+
else
19+
PR_PATH=$(echo "$CIRCLE_REPOSITORY_URL#$CIRCLE_SHA1" | sudo sed "$SED_REGEX")
20+
fi
21+
22+
echo "PR_PATH >>>>> $PR_PATH"
23+
24+
# Install buidler e2e test
25+
git clone https://github.com/sc-forks/buidler-e2e.git
26+
cd buidler-e2e
27+
npm install
28+
29+
# Install and run solidity-coverage @ PR
30+
npm install --save-dev $PR_PATH
31+
npx buidler coverage
32+
33+
# Test that coverage/ was generated
34+
if [ ! -d "coverage" ]; then
35+
echo "ERROR: no coverage folder was created."
36+
exit 1
37+
fi

scripts/run-metacoin.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,10 @@ cat truffle-config.js
3939
npm init --yes
4040
yarn add $PR_PATH --dev
4141
npx truffle run coverage
42+
43+
# Test that coverage/ was generated
44+
if [ ! -d "coverage" ]; then
45+
echo "ERROR: no coverage folder was created."
46+
exit 1
47+
fi
48+

truffle-plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"commands": {
3-
"coverage": "dist/truffle.plugin.js"
3+
"coverage": "truffle.plugin.js"
44
}
55
}

0 commit comments

Comments
 (0)