Skip to content

Commit

Permalink
Remove serum-dex dependency from integration tests (serum-community#30)
Browse files Browse the repository at this point in the history
* Update integration script

* Remove serum dex dependency in integration workflow

* Udpate script and workflow
  • Loading branch information
michaelhly authored Sep 14, 2020
1 parent 2b9698c commit 47b298e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 34 deletions.
22 changes: 2 additions & 20 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,8 @@ jobs:
- name: Install pipenv
uses: dschep/install-pipenv-action@v1

- name: Checkout serum-dex
uses: actions/checkout@v2
with:
repository: serum-community/serum-dex
path: serum-dex

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Install libudev-dev
run: sudo apt-get install libudev-dev

- name: Install test dependencies
run: pipenv install --skip-lock pytest

- name: Install Solana tool suite and run integration tests
run: |
curl -sSf https://raw.githubusercontent.com/solana-labs/solana/v1.3.9/install/solana-install-init.sh | sh -s - v1.3.9
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
solana-keygen new -o ~/.config/solana/id.json --no-passphrase --silent
scripts/run_int_tests.sh
- name: Run integration tests
run: scripts/run_int_tests.sh
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ log/*
# other temps files
.DS_Store
.tmp/*
serum-dex

# integration test artifacts
crank.log
tests/crank.log
serum_dex.so
crank

# sphinx stuff
_build
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'
services:
localnet:
image: "michaelhly/serum_dex_localnet:edge"
image: "solanalabs/solana:stable"
ports:
- "8899:8899"
- "8900:8900"
Expand Down
30 changes: 18 additions & 12 deletions scripts/run_int_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,33 @@ if [[ $OSTYPE == "linux-gnu"* ]]; then
elif [[ $OSTYPE == "darwin"* ]]; then
os_type="darwin"
else
echo $OSTYPE is not supported
echo "$OSTYPE is not supported."
exit 1
fi

if [ ! -d "serum-dex" ]; then
git clone https://github.com/serum-community/serum-dex.git
fi

cd serum-dex
docker-compose up -d
if ! hash solana 2>/dev/null; then
echo Installing Solana tool suite...
curl -sSf https://raw.githubusercontent.com/solana-labs/solana/v1.3.9/install/solana-install-init.sh | sh -s - v1.3.9
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
echo Generating keypair...
solana-keygen new -o ~/.config/solana/id.json --no-passphrase --silent
fi
solana config set --url "http://localhost:8899"
curl -s -L "https://github.com/serum-community/serum-dex/releases/download/refs%2Fheads%2Fmaster/serum_dex-$os_type.so" > serum_dex.so
sleep 1
solana airdrop 10000
DEX_PROGRAM_ID="$(solana deploy --use-deprecated-loader serum_dex.so | jq .programId -r)"
echo DEX_PROGRAM_ID: $DEX_PROGRAM_ID
cd crank
cargo run -- l pyserum-setup ~/.config/solana/id.json $DEX_PROGRAM_ID
curl -s -L "https://github.com/serum-community/serum-dex/releases/download/refs%2Fheads%2Fmaster/crank-$os_type" > crank
chmod +x crank
./crank l pyserum-setup ~/.config/solana/id.json $DEX_PROGRAM_ID
echo "dex_program_id: $DEX_PROGRAM_ID" >> crank.log
cp crank.log ../../tests
cd ../..
mv crank.log tests/crank.log
cat tests/crank.log
pipenv run pytest -vv -m integration
rm -rf tests/crank.log
docker kill serum-dex_localnet_1
if [[ $KEEP_ARTIFACTS == "" ]]; then
echo Deleting artifacts...
rm -rf tests/crank.log crank serum_dex.so
fi
docker-compose down

0 comments on commit 47b298e

Please sign in to comment.