Skip to content

Commit 22c85f8

Browse files
authored
Merge pull request #334 from sc-forks/test/industrial-ci
Add E2E CI tests
2 parents d71c962 + 9580231 commit 22c85f8

File tree

3 files changed

+126
-25
lines changed

3 files changed

+126
-25
lines changed

.circleci/config.yml

Lines changed: 59 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,61 @@
11
version: 2.0
22
jobs:
3-
build:
4-
docker:
5-
- image: circleci/node:8.15.0
6-
steps:
7-
- checkout
8-
- run:
9-
name: Delete any old node_modules
10-
command: |
11-
rm -rf node_modules/
12-
- run:
13-
name: Install dependencies
14-
command: |
15-
yarn
16-
- run:
17-
name: Get submodules
18-
command: |
19-
git submodule update --init
20-
- run:
21-
name: Run tests
22-
command: |
23-
npm run test-cov
24-
- run:
25-
name: Upload coverage
26-
command: |
27-
bash <(curl -s https://codecov.io/bash)
3+
unit-test:
4+
docker:
5+
- image: circleci/node:8.15.0
6+
steps:
7+
- checkout
8+
- run:
9+
name: Delete any old node_modules
10+
command: |
11+
rm -rf node_modules/
12+
- run:
13+
name: Install dependencies
14+
command: |
15+
yarn
16+
- run:
17+
name: Get submodules
18+
command: |
19+
git submodule update --init
20+
- run:
21+
name: Run tests
22+
command: |
23+
npm run test-cov
24+
- run:
25+
name: Upload coverage
26+
command: |
27+
bash <(curl -s https://codecov.io/bash)
28+
29+
# This works but takes a while....
30+
# e2e-colony:
31+
# docker:
32+
# - image: circleci/node:10.12-stretch
33+
# working_directory: ~/colonyNetwork
34+
# branches:
35+
# only:
36+
# - master
37+
# - next
38+
# steps:
39+
# - checkout
40+
# - run:
41+
# name: ColonyNetwork E2E
42+
# command: |
43+
# ./scripts/run-colony.sh
44+
45+
e2e-zeppelin:
46+
docker:
47+
- image: circleci/node:10.12-stretch
48+
steps:
49+
- checkout
50+
- run:
51+
name: OpenZeppelin E2E
52+
command: |
53+
sudo URL=$CIRCLE_REPOSITORY_URL BRANCH=$CIRCLE_BRANCH ./scripts/run-zeppelin.sh
54+
55+
workflows:
56+
version: 2
57+
build:
58+
jobs:
59+
- unit-test
60+
- e2e-zeppelin
61+
#- e2e-colony

scripts/run-colony.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
#
3+
# E2E CI: installs PR candidate on colonyNetwork and runs coverage
4+
#
5+
6+
set -o errexit
7+
8+
# Get path to PR branch
9+
PR_PATH=$(echo "$CIRCLE_REPOSITORY_URL#$CIRCLE_BRANCH" | sed 's/git@github.com:/https:\/\/github.com\//')
10+
echo "Installing $PR_PATH"
11+
12+
# Setup
13+
sudo npm install -g yarn
14+
git clone https://github.com/JoinColony/colonyNetwork.git
15+
cd colonyNetwork || exit
16+
17+
# Swap installed coverage for PR branch version
18+
sudo yarn
19+
sudo yarn remove -W solidity-coverage --dev
20+
sudo yarn add -W "$PR_PATH" --dev
21+
22+
git submodule update --init
23+
sed -i 's/docker: true,/ /g' truffle.js
24+
sudo yarn run provision:token:contracts
25+
sudo yarn run test:contracts:coverage
26+
27+
# Trick to 'allowFailure' on CIRCLE
28+
set -o errexit

scripts/run-zeppelin.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
#
3+
# E2E CI: installs PR candidate on openzeppelin-solidity and runs coverage
4+
#
5+
6+
set -o errexit
7+
# Get path to PR branch
8+
PR_PATH=$(echo "$URL#$BRANCH" | sed 's/git@github.com:/https:\/\/github.com\//')
9+
echo "Installing $PR_PATH"
10+
11+
sudo git clone https://github.com/OpenZeppelin/openzeppelin-solidity.git
12+
cd openzeppelin-solidity || exit
13+
14+
# EDITS
15+
# Use testrpc-sc ...
16+
# sed -i 's/ganache-cli-coverage/testrpc-sc/g' scripts/test.sh
17+
# sed -i 's/--emitFreeLogs true/ /g' scripts/test.sh
18+
19+
# Do not ping coveralls
20+
sed -i 's/cat coverage\/lcov.info | npx coveralls/echo "No coveralls"/g' scripts/test.sh
21+
22+
# Doesn't install inside docker (thanks Circle!)
23+
echo "Uninstalling solidity-docgen"
24+
sudo npm uninstall --save-dev solidity-docgen
25+
26+
# Swap installed coverage for PR branch version
27+
echo "Running: npm install"
28+
sudo npm install
29+
30+
echo "Running npm uninstall solidity-coverage"
31+
sudo npm uninstall --save-dev solidity-coverage
32+
33+
echo "Running npm install PR_PATH"
34+
sudo npm install --save-dev "$PR_PATH"
35+
36+
sudo npm run coverage
37+
38+
# Trick to 'allowFailure' on CIRCLE
39+
set -o errexit

0 commit comments

Comments
 (0)