Skip to content

Commit ce77d3b

Browse files
authored
Fix saving on Windows OS (#459)
1 parent 4567465 commit ce77d3b

File tree

6 files changed

+62
-84
lines changed

6 files changed

+62
-84
lines changed

.circleci/config.yml

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
version: 2.0
1+
version: 2.1
2+
3+
orbs:
4+
win: circleci/[email protected]
25

36
# Necessary for running in machine mode,
47
# which is necessary to execute the E2E scripts
@@ -44,19 +47,6 @@ jobs:
4447
name: Upload coverage
4548
command: |
4649
bash <(curl -s https://codecov.io/bash)
47-
48-
# This works but takes a while....
49-
e2e-colony:
50-
docker:
51-
- image: circleci/node:10.12-stretch
52-
working_directory: ~/colonyNetwork
53-
steps:
54-
- checkout
55-
- run:
56-
name: ColonyNetwork E2E
57-
command: |
58-
./scripts/run-colony.sh
59-
6050
e2e-zeppelin:
6151
machine: true
6252
steps:
@@ -75,30 +65,30 @@ jobs:
7565
name: MetaCoin E2E
7666
command: |
7767
./scripts/run-metacoin.sh
78-
e2e-buidler:
79-
machine: true
68+
e2e-metacoin-windows:
69+
executor: win/default
8070
steps:
8171
- checkout
82-
- <<: *step_install_nvm
72+
- run: dotnet tool install --global PowerShell
8373
- run:
84-
name: Buidler E2E
74+
name: Windows Metacoin E2E
8575
command: |
86-
./scripts/run-buidler.sh
87-
e2e-moloch:
76+
bash ./scripts/run-metacoin.sh
77+
e2e-buidler:
8878
machine: true
8979
steps:
9080
- checkout
9181
- <<: *step_install_nvm
9282
- run:
93-
name: Moloch E2E
83+
name: Buidler E2E
9484
command: |
95-
./scripts/run-moloch.sh
85+
./scripts/run-buidler.sh
9686
workflows:
9787
version: 2
9888
build:
9989
jobs:
10090
- unit-test
10191
- e2e-zeppelin
10292
- e2e-metacoin
93+
- e2e-metacoin-windows
10394
- e2e-buidler
104-
- e2e-moloch

plugins/resources/plugin.utils.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ function setupTempFolders(config, tempContractsDir, tempArtifactsDir){
6767
function save(targets, originalDir, tempDir){
6868
let _path;
6969
for (target of targets) {
70-
_path = target.canonicalPath.replace(originalDir, tempDir);
70+
71+
_path = path.normalize(target.canonicalPath)
72+
.replace(originalDir, tempDir);
73+
7174
fs.outputFileSync(_path, target.source);
7275
}
7376
}
@@ -128,11 +131,8 @@ function checkContext(config, tempContractsDir, tempArtifactsDir){
128131
// =============================
129132

130133
function assembleFiles(config, skipFiles=[]){
131-
let targets;
132-
let skipFolders;
133-
let skipped = [];
134-
135-
targets = shell.ls(`${config.contractsDir}/**/*.sol`);
134+
const targetsPath = path.join(config.contractsDir, '**', '*.sol');
135+
const targets = shell.ls(targetsPath);
136136

137137
skipFiles = assembleSkipped(config, targets, skipFiles);
138138

@@ -174,7 +174,7 @@ function assembleTargets(config, targets=[], skipFiles=[]){
174174
*/
175175
function assembleSkipped(config, targets, skipFiles=[]){
176176
// Make paths absolute
177-
skipFiles = skipFiles.map(contract => `${config.contractsDir}/${contract}`);
177+
skipFiles = skipFiles.map(contract => path.join(config.contractsDir, contract));
178178

179179
// Enumerate files in skipped folders
180180
const skipFolders = skipFiles.filter(item => path.extname(item) !== '.sol')

plugins/truffle.plugin.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ const API = require('./../lib/api');
22
const utils = require('./resources/plugin.utils');
33
const truffleUtils = require('./resources/truffle.utils');
44
const PluginUI = require('./resources/truffle.ui');
5-
65
const pkg = require('./../package.json');
76
const death = require('death');
87
const path = require('path');

scripts/run-buidler.sh

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66

77
set -o errexit
88

9+
function verifyCoverageExists {
10+
if [ ! -d "coverage" ]; then
11+
echo "ERROR: no coverage folder was created."
12+
exit 1
13+
fi
14+
}
15+
916
# Get rid of any caches
1017
sudo rm -rf node_modules
1118
echo "NVM CURRENT >>>>>" && nvm current
@@ -27,7 +34,7 @@ echo "Simple buidler/buidler-trufflev5 "
2734
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
2835
echo ""
2936

30-
# Install buidler e2e test
37+
# Install buidler-e2e
3138
git clone https://github.com/sc-forks/buidler-e2e.git
3239
cd buidler-e2e
3340
npm install
@@ -38,12 +45,9 @@ cat package.json
3845

3946
npx buidler coverage
4047

41-
# Test that coverage/ was generated
42-
if [ ! -d "coverage" ]; then
43-
echo "ERROR: no coverage folder was created for buidler-trufflev5."
44-
exit 1
45-
fi
48+
verifyCoverageExists
4649

50+
# Install buidler-ethers
4751
echo ""
4852
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
4953
echo "Simple buidler/buidler-ethers "
@@ -60,8 +64,25 @@ cat package.json
6064

6165
npx buidler coverage
6266

63-
# Test that coverage/ was generated
64-
if [ ! -d "coverage" ]; then
65-
echo "ERROR: no coverage folder was created for buidler-ethers."
66-
exit 1
67-
fi
67+
verifyCoverageExists
68+
69+
echo ""
70+
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
71+
echo "Complex: MolochDao/moloch "
72+
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
73+
echo ""
74+
75+
# Install sc-forks/moloch
76+
cd ..
77+
git clone https://github.com/sc-forks/moloch.git
78+
cd moloch
79+
npm install
80+
npm uninstall --save-dev solidity-coverage
81+
82+
# Install and run solidity-coverage @ PR
83+
# Should run on network 'localhost'
84+
npm install --save-dev $PR_PATH
85+
npm run coverage
86+
87+
verifyCoverageExists
88+

scripts/run-metacoin.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
set -o errexit
99

1010
# Get rid of any caches
11-
sudo rm -rf node_modules
11+
rm -rf node_modules
1212
echo "NVM CURRENT >>>>>" && nvm current
1313

1414
# Use PR env variables (for forks) or fallback on local if PR not available
@@ -17,14 +17,14 @@ SED_REGEX="s/[email protected]:/https:\/\/github.com\//"
1717
if [[ -v CIRCLE_PR_REPONAME ]]; then
1818
PR_PATH="https://github.com/$CIRCLE_PR_USERNAME/$CIRCLE_PR_REPONAME#$CIRCLE_SHA1"
1919
else
20-
PR_PATH=$(echo "$CIRCLE_REPOSITORY_URL#$CIRCLE_SHA1" | sudo sed "$SED_REGEX")
20+
PR_PATH=$(echo "$CIRCLE_REPOSITORY_URL#$CIRCLE_SHA1" | sed "$SED_REGEX")
2121
fi
2222

2323
echo "PR_PATH >>>>> $PR_PATH"
2424

2525
# Install truffle and metacoin box
26-
npm install -g truffle
2726
npm install -g yarn
27+
npm install -g truffle
2828

2929
mkdir metacoin
3030
cd metacoin
@@ -38,6 +38,13 @@ cat truffle-config.js
3838
# Install and run solidity-coverage @ PR
3939
npm init --yes
4040
yarn add $PR_PATH --dev
41+
yarn add truffle --dev
42+
43+
# require("truffle") not working on global install in Circle's Windows env
44+
if [ "$CIRCLE_JOB" == "e2e-metacoin-windows" ]; then
45+
yarn add truffle --dev
46+
fi
47+
4148
npx truffle run coverage
4249

4350
# Test that coverage/ was generated

scripts/run-moloch.sh

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)