Skip to content

Commit

Permalink
Merge pull request #71 from valory-xyz/devops
Browse files Browse the repository at this point in the history
refactor: have a script to run all the scripts from a single npm command
  • Loading branch information
DavidMinarsch authored Apr 19, 2022
2 parents 14f83ff + 86d184b commit ffae35e
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 15 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ jobs:

# Compile the code
- name: Compile, adjust uniswap library hash and recompile again
run: |
./scripts/uni-adjust/adjust-point.sh
./node_modules/.bin/hardhat compile
./scripts/uni-adjust/adjust-pair.sh
./node_modules/.bin/hardhat compile
run: npm run compile

# Run tests and deploy script(s)
- name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ ADD . /code

ENV NODE_OPTIONS=--openssl-legacy-provider
RUN yarn
RUN npx hardhat compile
RUN npm run compile

CMD [ "npx", "hardhat", "node", "--hostname", "0.0.0.0" ]
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"compile": "./scripts/uni-adjust/adjust-point.sh && ./node_modules/.bin/hardhat compile && ./scripts/uni-adjust/adjust-pair.sh && ./node_modules/.bin/hardhat compile"
},
"repository": {
"type": "git",
Expand Down
2 changes: 0 additions & 2 deletions scripts/uni-adjust/adjust-pair.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ FILE="node_modules/@uniswap/v2-periphery/contracts/libraries/UniswapV2Library.so
x=$(npx hardhat run scripts/uni-adjust/adjust.js)
case "$(uname -s)" in
Darwin)
echo 'Mac OS X'
sed -i.bu "s/96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f/$x/g" $FILE
;;

Linux)
echo 'Linux'
sed -i "s/96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f/$x/g" $FILE
;;

Expand Down
6 changes: 0 additions & 6 deletions scripts/uni-adjust/adjust-point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
FILE="./node_modules/@uniswap/lib/contracts/libraries/BitMath.sol"
case "$(uname -s)" in
Darwin)
echo 'Mac OS X'
sed -i.bu "s/uint128(-1)/type(uint128).max/g" $FILE
sed -i.bu "s/uint64(-1)/type(uint64).max/g" $FILE
sed -i.bu "s/uint32(-1)/type(uint32).max/g" $FILE
Expand All @@ -11,7 +10,6 @@ case "$(uname -s)" in
;;

Linux)
echo 'Linux'
sed -i "s/uint128(-1)/type(uint128).max/g" $FILE
sed -i "s/uint64(-1)/type(uint64).max/g" $FILE
sed -i "s/uint32(-1)/type(uint32).max/g" $FILE
Expand All @@ -28,7 +26,6 @@ FILE="./node_modules/@uniswap/lib/contracts/libraries/FixedPoint.sol"
rm -rf $FILE
case "$(uname -s)" in
Darwin)
echo 'Mac OS X'
cat << 'EOF' > ./node_modules/@uniswap/lib/contracts/libraries/FixedPoint.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.4.0;
Expand Down Expand Up @@ -185,7 +182,6 @@ library FixedPoint {
EOF
;;
Linux)
echo 'Linux'
cat << EOF > ./node_modules/@uniswap/lib/contracts/libraries/FixedPoint.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.4.0;
Expand Down Expand Up @@ -351,7 +347,6 @@ FILE="./node_modules/@uniswap/lib/contracts/libraries/FullMath.sol"
rm -rf $FILE
case "$(uname -s)" in
Darwin)
echo 'Mac OS X'
cat << 'EOF' >> ./node_modules/@uniswap/lib/contracts/libraries/FullMath.sol
// SPDX-License-Identifier: CC-BY-4.0
pragma solidity >=0.4.0;
Expand Down Expand Up @@ -413,7 +408,6 @@ EOF
;;

Linux)
echo 'Linux'
cat << 'EOF' >> ./node_modules/@uniswap/lib/contracts/libraries/FullMath.sol
// SPDX-License-Identifier: CC-BY-4.0
pragma solidity >=0.4.0;
Expand Down

0 comments on commit ffae35e

Please sign in to comment.