Skip to content

Commit

Permalink
feat: make e2e work on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszjasiuk committed Jul 24, 2023
1 parent 3a60d2c commit a419fd1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
1 change: 0 additions & 1 deletion e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Package containing extension and web interface e2e tests.
- WIP :)

## Other stuff
- **So far only downloads namada linux binaries**
- **So far only works for namada 0.19** - you can change version in `./setup-namada.sh`
- **So far downloads MASP params every time we load extension**
- **Namada binaries, wasm checksums and wasms are cached** - they will dl again only if namada version changes
Expand Down
18 changes: 14 additions & 4 deletions e2e/setup-namada.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ VERSION="v0.19.0"
CURRENT_VERSION=""
NAMADA_DIR=".namada"
NAMADA_BASE_DIR=".namada/basedir"
OS="Linux"

if [[ $OSTYPE == "darwin"* ]]; then
OS="Darwin"
fi

# Read current version
CURRENT_VERSION_PATH="${NAMADA_DIR}/.version"
Expand All @@ -17,7 +22,7 @@ fi

if [ "$CURRENT_VERSION" != "$VERSION" ]; then
# Download Namada binaries
FILENAME="namada-${VERSION}-Linux-x86_64.tar.gz"
FILENAME="namada-${VERSION}-${OS}-x86_64.tar.gz"
curl --location --remote-header-name --remote-name https://github.com/anoma/namada/releases/download/${VERSION}/${FILENAME}
mkdir $NAMADA_DIR
tar -xzf ${FILENAME} --directory $NAMADA_DIR --strip-components 1
Expand All @@ -37,7 +42,7 @@ if [ "$CURRENT_VERSION" != "$VERSION" ]; then

while read -r line;
do
WASM=$(echo "$line" | sed -E "s/\".+\":\s\"//g" | sed -E "s/\".*//g");
WASM=$(echo "$line" | sed -E "s/\".+\":[[:space:]]\"//g" | sed -E "s/\".*//g");
curl "${S3}/${WASM}" --output "${NAMADA_DIR}/wasm/${WASM}"

done < "$CHECKSUMS"
Expand Down Expand Up @@ -71,5 +76,10 @@ cp -f ${NAMADA_DIR}/wasm/*.wasm ${NAMADA_BASE_DIR}/${CHAIN_ID}/setup/validator-0
cp -f ${NAMADA_DIR}/wasm/*.wasm ${NAMADA_BASE_DIR}/${CHAIN_ID}/wasm/

# Override envs - so we do not have to rebuild extension and app
find ../apps/extension/build/chrome -type f -exec sed -i -E "s/dev-test\..{21}/$CHAIN_ID/g" {} +
find ../apps/namada-interface/build -type f -exec sed -i -E "s/dev-test\..{21}/$CHAIN_ID/g" {} +
if [[ $OS == "Darwin" ]]; then
LC_ALL=C find ../apps/extension/build/chrome -type f -name "*.js" -exec sed -i "" -E "s/dev-test\..{21}/$CHAIN_ID/g" {} +
LC_ALL=C find ../apps/namada-interface/build -type f -name "*.js" -exec sed -i "" -E "s/dev-test\..{21}/$CHAIN_ID/g" {} +
else
find ../apps/extension/build/chrome -type f -name "*.js" -exec sed -i -E "s/dev-test\..{21}/$CHAIN_ID/g" {} +
find ../apps/namada-interface/build -type f -name "*.js" -exec sed -i -E "s/dev-test\..{21}/$CHAIN_ID/g" {} +
fi

0 comments on commit a419fd1

Please sign in to comment.