Skip to content

Commit

Permalink
Problem: pystarport don't have standalone repository (fix #555) (#580)
Browse files Browse the repository at this point in the history
Solution: separate pystarport repo
  • Loading branch information
leejw51crypto authored Jun 22, 2021
1 parent 743b5e4 commit ea92405
Show file tree
Hide file tree
Showing 26 changed files with 919 additions and 3,041 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ nix-integration-test-upgrade: check-network
nix run -f ./default.nix run-integration-tests -c run-integration-tests "pytest -v -m upgrade"

nix-integration-test-ledger: check-network
nix run -f ./default.nix run-integration-tests -c run-integration-tests "pytest -v -m ledger"
nix run -f ./default.nix run-integration-tests-zemu -c run-integration-tests "pytest -v -m ledger"

nix-integration-test-slow: check-network
nix run -f ./default.nix run-integration-tests -c run-integration-tests "pytest -v -m slow"
Expand Down
21 changes: 21 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ rec {
inherit (pkgs) hermes cosmovisor;

chain-maind = build-chain-maind { };

pystarport = import ./pystarport { inherit pkgs; chaind = "${chain-maind}/bin/chain-maind"; };

chain-maind-testnet = build-chain-maind { network = "testnet"; };
Expand Down Expand Up @@ -133,6 +134,8 @@ rec {
set -e
export PATH=${ci-env}/bin:$PATH
export TESTS=${tests_src}/integration_tests
export PYTHONPATH=$PWD/pystarport/proto_python/:$PYTHONPATH
export CHAIN_MAIND="${chain-maind}/bin/chain-maind"
# check argument exists, then use it, otherwise use default
if [ -z $1 ]
then
Expand All @@ -142,6 +145,24 @@ rec {
fi
'';

run-integration-tests-zemu = pkgs.writeShellScriptBin "run-integration-tests" ''
set -e
export PATH=${ci-env}/bin:$PATH
export TESTS=${tests_src}/integration_tests
export PYTHONPATH=$PWD/pystarport/proto_python/:$PYTHONPATH
export CHAIN_MAIND="${chain-maind-zemu}/bin/chain-maind"
echo "CHAIN_MAIND="$CHAIN_MAIND
# check argument exists, then use it, otherwise use default
if [ -z $1 ]
then
pytest -v -m 'not upgrade and not ledger and not slow and not ibc and not byzantine and not gov and not grpc' $TESTS
else
$1 $TESTS
fi
'';



ci-shell = pkgs.mkShell {
buildInputs = [
ci-env
Expand Down
286 changes: 137 additions & 149 deletions integration_tests/poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration_tests/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protobuf = "^3.13.0"
grpcio = "^1.33.2"
PyYAML = "^5.3.1"
python-dateutil = "^2.8.1"
pystarport = {path = "../pystarport"}
pystarport = "^0.2.1"
chainlibpy = "^1.0.0"

[tool.poetry.dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,5 @@ def test_statesync(cluster):
cluster.supervisor.startProcess(f"{cluster.chain_id}-node{i}")

# discovery_time is set to 5 seconds, add extra seconds for processing
wait_for_block(cluster.cosmos_cli(i), 5)
wait_for_block(cluster.cosmos_cli(i), 10)
print("succesfully syncing")
3 changes: 1 addition & 2 deletions makeproto.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#!/bin/bash
cd ./pystarport/pystarport
nix-shell . --run ""
nix-shell proto.nix --run ""
3 changes: 2 additions & 1 deletion pystarport/pystarport/default.nix → proto.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs ? import ../../nix { }, commit ? "" }:
{ pkgs ? import ./nix { }, commit ? "" }:
with pkgs;
pkgs.mkShell {
buildInputs = [
Expand All @@ -8,5 +8,6 @@ pkgs.mkShell {
git
];
shellHook = ''
cd ./pystarport
./convert.sh '';
}
4 changes: 0 additions & 4 deletions pystarport/.gitignore

This file was deleted.

14 changes: 0 additions & 14 deletions pystarport/LICENSE

This file was deleted.

230 changes: 0 additions & 230 deletions pystarport/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion pystarport/pystarport/convert.sh → pystarport/convert.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
OUTPUT=./proto_python
COSMOS=../../third_party/cosmos-sdk
COSMOS=../third_party/cosmos-sdk
TENDERMINT=./tendermint
TMP=$(whereis grpc_python_plugin)
PLUGIN="$(cut -d' ' -f2 <<<"$TMP")"
Expand Down
8 changes: 1 addition & 7 deletions pystarport/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{ pkgs ? import <nixpkgs> { }
, chaind ? "chain-maind"
}:
pkgs.poetry2nix.mkPoetryApplication {
projectDir = ./.;
preBuild = ''
sed -i -e 's@CHAIN = "" # edit by nix-build@CHAIN = "${chaind}"@' pystarport/app.py
'';
}
pkgs.poetry2nix.mkPoetryEnv { projectDir = ./.; }
Loading

0 comments on commit ea92405

Please sign in to comment.