Skip to content

Commit

Permalink
chore(ci): add support for verdaccio in travis
Browse files Browse the repository at this point in the history
  • Loading branch information
RyuuGan committed Jun 20, 2020
1 parent 663bb8a commit 8027378
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 11 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,21 @@ language: node_js
node_js:
- "node"
- "10"

before_script:
- npm i -g verdaccio@4.6.2
- verdaccio &
- sleep 1
- npx npm-cli-adduser@1.1.4 --registry $NPM_REGISTRY_URL --username $NPM_USERNAME --password $NPM_PASSWORD --email $NPM_EMAIL --scope $NPM_SCOPE

script:
- npm test
- npm run lint
- npm run build
- npm publish --dry-run
- npm whoami --registry $NPM_REGISTRY_URL
- |
sed -i -r "s/\"name\": \"sol-merger\"/\"name\": \"@$NPM_SCOPE\/sol-merger\"/" package.json
- npm publish --registry $NPM_REGISTRY_URL
- npm i -g "@$NPM_SCOPE/sol-merger@latest" --registry $NPM_REGISTRY_URL
- bash ./test-cli.sh
57 changes: 57 additions & 0 deletions test-cli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
WITHOUT_COMMENTS=(
compiled/DefaultParamentersInheritance.sol
compiled/DoubleNamedImports.sol
compiled/MultiImports.sol
compiled/NamedImportOnlySelectedFailContract.sol
)

SKIPPED=(
compiled/EmptyFile.sol
compiled/LocalImportsWithSPDX.sol
)

compareFile() {
local file="$1";
echo "Comparing file: $file"
cmp -s $file test/$file;
if [ $? -ne 0 ]
then
exit 1
fi
}

# Compare files with comments

rm -rf compiled
sol-merger "test/contracts/*.sol" compiled

echo "Default compilation (with comments)"

FILES=($(ls compiled/*.sol))
for file in "${FILES[@]}"
do
if [[ " ${WITHOUT_COMMENTS[@]} " =~ " $file " ]]; then
continue
fi
if [[ " ${SKIPPED[@]} " =~ " $file " ]]; then
continue
fi
compareFile $file
done

# Remove SPDX Plugin
echo "Compilation with plugins"
rm -rf compiled
sol-merger --export-plugin ./dist/lib/plugins/SPDXLicenseRemovePlugin.js "test/contracts/*.sol" compiled

compareFile compiled/LocalImportsWithSPDX.sol

# Remove Comments
echo "Compilation with --remove-comments option"
rm -rf compiled
sol-merger --remove-comments "test/contracts/*.sol" compiled

for file in "${WITHOUT_COMMENTS[@]}"
do
compareFile $file
done
2 changes: 1 addition & 1 deletion test/compiled/DefaultParamentersInheritance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -559,4 +559,4 @@ contract ERC777Test is ERC777(
""
);
}
}
}
2 changes: 1 addition & 1 deletion test/compiled/DoubleNamedImports.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ contract MyAwesomeToken is ERC20Basic {
return balances[_owner];
}

}
}
2 changes: 1 addition & 1 deletion test/compiled/GlobalRenamedImports.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ contract MyOwned is GlobalRenamed$Ownable {
string public constant name = "My Owned";

function MyOwned() {}
}
}
2 changes: 1 addition & 1 deletion test/compiled/LocalImports.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ contract MyOwned is Ownable {
string public constant name = "My Owned";

function MyOwned() {}
}
}
2 changes: 1 addition & 1 deletion test/compiled/LocalImportsWithComments.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ contract MyOwned is Ownable {
* Super important description here
*/
function MyOwned() {}
}
}
2 changes: 1 addition & 1 deletion test/compiled/LocalImportsWithSPDX.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ contract MyOwned is Ownable {
string public constant name = "My Owned";

function MyOwned() {}
}
}
2 changes: 1 addition & 1 deletion test/compiled/MultiImports.sol
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,4 @@ contract MyToken is StandardToken {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
}
}
2 changes: 1 addition & 1 deletion test/compiled/NamedImportOnlySelectedFailContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ contract MyAwesomeToken is BasicToken {
return totalSupply_;
}

}
}
2 changes: 1 addition & 1 deletion test/compiled/NamedImports.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ contract MyOwned is Ownable {
string public constant name = "My Owned";

function MyOwned() {}
}
}
2 changes: 1 addition & 1 deletion test/compiled/RenamedImports.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ contract MyOwned is RenamedOwnable {
string public constant name = "My Owned";

function MyOwned() {}
}
}
2 changes: 1 addition & 1 deletion test/compiled/Struct.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ contract Ballot {
address delegate;
uint vote;
}
}
}

0 comments on commit 8027378

Please sign in to comment.