Fix saving on Windows OS (#459)

beta
cgewecke 5 years ago committed by GitHub
parent 4567465e84
commit ce77d3b190
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 36
      .circleci/config.yml
  2. 14
      plugins/resources/plugin.utils.js
  3. 1
      plugins/truffle.plugin.js
  4. 43
      scripts/run-buidler.sh
  5. 13
      scripts/run-metacoin.sh
  6. 39
      scripts/run-moloch.sh

@ -1,4 +1,7 @@
version: 2.0
version: 2.1
orbs:
win: circleci/windows@2.2.0
# Necessary for running in machine mode,
# which is necessary to execute the E2E scripts
@ -44,19 +47,6 @@ jobs:
name: Upload coverage
command: |
bash <(curl -s https://codecov.io/bash)
# This works but takes a while....
e2e-colony:
docker:
- image: circleci/node:10.12-stretch
working_directory: ~/colonyNetwork
steps:
- checkout
- run:
name: ColonyNetwork E2E
command: |
./scripts/run-colony.sh
e2e-zeppelin:
machine: true
steps:
@ -75,24 +65,24 @@ jobs:
name: MetaCoin E2E
command: |
./scripts/run-metacoin.sh
e2e-buidler:
machine: true
e2e-metacoin-windows:
executor: win/default
steps:
- checkout
- <<: *step_install_nvm
- run: dotnet tool install --global PowerShell
- run:
name: Buidler E2E
name: Windows Metacoin E2E
command: |
./scripts/run-buidler.sh
e2e-moloch:
bash ./scripts/run-metacoin.sh
e2e-buidler:
machine: true
steps:
- checkout
- <<: *step_install_nvm
- run:
name: Moloch E2E
name: Buidler E2E
command: |
./scripts/run-moloch.sh
./scripts/run-buidler.sh
workflows:
version: 2
build:
@ -100,5 +90,5 @@ workflows:
- unit-test
- e2e-zeppelin
- e2e-metacoin
- e2e-metacoin-windows
- e2e-buidler
- e2e-moloch

@ -67,7 +67,10 @@ function setupTempFolders(config, tempContractsDir, tempArtifactsDir){
function save(targets, originalDir, tempDir){
let _path;
for (target of targets) {
_path = target.canonicalPath.replace(originalDir, tempDir);
_path = path.normalize(target.canonicalPath)
.replace(originalDir, tempDir);
fs.outputFileSync(_path, target.source);
}
}
@ -128,11 +131,8 @@ function checkContext(config, tempContractsDir, tempArtifactsDir){
// =============================
function assembleFiles(config, skipFiles=[]){
let targets;
let skipFolders;
let skipped = [];
targets = shell.ls(`${config.contractsDir}/**/*.sol`);
const targetsPath = path.join(config.contractsDir, '**', '*.sol');
const targets = shell.ls(targetsPath);
skipFiles = assembleSkipped(config, targets, skipFiles);
@ -174,7 +174,7 @@ function assembleTargets(config, targets=[], skipFiles=[]){
*/
function assembleSkipped(config, targets, skipFiles=[]){
// Make paths absolute
skipFiles = skipFiles.map(contract => `${config.contractsDir}/${contract}`);
skipFiles = skipFiles.map(contract => path.join(config.contractsDir, contract));
// Enumerate files in skipped folders
const skipFolders = skipFiles.filter(item => path.extname(item) !== '.sol')

@ -2,7 +2,6 @@ const API = require('./../lib/api');
const utils = require('./resources/plugin.utils');
const truffleUtils = require('./resources/truffle.utils');
const PluginUI = require('./resources/truffle.ui');
const pkg = require('./../package.json');
const death = require('death');
const path = require('path');

@ -6,6 +6,13 @@
set -o errexit
function verifyCoverageExists {
if [ ! -d "coverage" ]; then
echo "ERROR: no coverage folder was created."
exit 1
fi
}
# Get rid of any caches
sudo rm -rf node_modules
echo "NVM CURRENT >>>>>" && nvm current
@ -27,7 +34,7 @@ echo "Simple buidler/buidler-trufflev5 "
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ""
# Install buidler e2e test
# Install buidler-e2e
git clone https://github.com/sc-forks/buidler-e2e.git
cd buidler-e2e
npm install
@ -38,12 +45,9 @@ cat package.json
npx buidler coverage
# Test that coverage/ was generated
if [ ! -d "coverage" ]; then
echo "ERROR: no coverage folder was created for buidler-trufflev5."
exit 1
fi
verifyCoverageExists
# Install buidler-ethers
echo ""
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo "Simple buidler/buidler-ethers "
@ -60,8 +64,25 @@ cat package.json
npx buidler coverage
# Test that coverage/ was generated
if [ ! -d "coverage" ]; then
echo "ERROR: no coverage folder was created for buidler-ethers."
exit 1
fi
verifyCoverageExists
echo ""
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo "Complex: MolochDao/moloch "
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ""
# Install sc-forks/moloch
cd ..
git clone https://github.com/sc-forks/moloch.git
cd moloch
npm install
npm uninstall --save-dev solidity-coverage
# Install and run solidity-coverage @ PR
# Should run on network 'localhost'
npm install --save-dev $PR_PATH
npm run coverage
verifyCoverageExists

@ -8,7 +8,7 @@
set -o errexit
# Get rid of any caches
sudo rm -rf node_modules
rm -rf node_modules
echo "NVM CURRENT >>>>>" && nvm current
# Use PR env variables (for forks) or fallback on local if PR not available
@ -17,14 +17,14 @@ SED_REGEX="s/git@github.com:/https:\/\/github.com\//"
if [[ -v CIRCLE_PR_REPONAME ]]; then
PR_PATH="https://github.com/$CIRCLE_PR_USERNAME/$CIRCLE_PR_REPONAME#$CIRCLE_SHA1"
else
PR_PATH=$(echo "$CIRCLE_REPOSITORY_URL#$CIRCLE_SHA1" | sudo sed "$SED_REGEX")
PR_PATH=$(echo "$CIRCLE_REPOSITORY_URL#$CIRCLE_SHA1" | sed "$SED_REGEX")
fi
echo "PR_PATH >>>>> $PR_PATH"
# Install truffle and metacoin box
npm install -g truffle
npm install -g yarn
npm install -g truffle
mkdir metacoin
cd metacoin
@ -38,6 +38,13 @@ cat truffle-config.js
# Install and run solidity-coverage @ PR
npm init --yes
yarn add $PR_PATH --dev
yarn add truffle --dev
# require("truffle") not working on global install in Circle's Windows env
if [ "$CIRCLE_JOB" == "e2e-metacoin-windows" ]; then
yarn add truffle --dev
fi
npx truffle run coverage
# Test that coverage/ was generated

@ -1,39 +0,0 @@
#!/usr/bin/env bash
#
# E2E CI: installs PR candidate on sc-forks/buidler-e2e (a simple example,
# similar to Metacoin) and runs coverage
#
set -o errexit
# Get rid of any caches
sudo rm -rf node_modules
echo "NVM CURRENT >>>>>" && nvm current
# Use PR env variables (for forks) or fallback on local if PR not available
SED_REGEX="s/git@github.com:/https:\/\/github.com\//"
if [[ -v CIRCLE_PR_REPONAME ]]; then
PR_PATH="https://github.com/$CIRCLE_PR_USERNAME/$CIRCLE_PR_REPONAME#$CIRCLE_SHA1"
else
PR_PATH=$(echo "$CIRCLE_REPOSITORY_URL#$CIRCLE_SHA1" | sudo sed "$SED_REGEX")
fi
echo "PR_PATH >>>>> $PR_PATH"
# Install buidler e2e test
git clone https://github.com/sc-forks/moloch.git
cd moloch
npm install
npm uninstall --save-dev solidity-coverage
# Install and run solidity-coverage @ PR
# Should run on network 'localhost'
npm install --save-dev $PR_PATH
npm run coverage
# Test that coverage/ was generated
if [ ! -d "coverage" ]; then
echo "ERROR: no coverage folder was created."
exit 1
fi
Loading…
Cancel
Save