diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 00000000..b2d44459 --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,64 @@ +name: Run the python tests for rholang actions + +on: [ push, pull_request ] + +jobs: + checkout: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6.13] + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: install-grpcio + run: | + pip3 install -U grpcio-tools + - name: Install PyRchain + run: | + git clone https://github.com/rchain/pyrchain.git + cd pyrchain + pip3 install -e .[dev] + - name: update protobufs and generated files + run: | + cd pyrchain + ./update-protobufs + ./update-generated || exit 0 + env: + PYTHONPATH: $GITHUB_WORKSPACE + - name: Install openjdk11 + run: | + sudo apt install openjdk-11-jre-headless + - name: Get rnode + run: | + wget https://github.com/rchain/rchain/releases/download/v0.10.2/rnode_0.10.2_all.deb + - name: install rnode + run: | + sudo dpkg -i rnode_0.10.2_all.deb + - name: genesis + run: | + bootstrap/bootstrap + - name: rgov deployment + run: | + bootstrap/deploy-all + - name: Run RGOV rnode + run: | + bootstrap/run-rnode + - name: Test with pytest + run: | + ls -a . + ls -da * + ls -a * + echo $GITHUB_WORKSPACE + export PYTHONPATH=~ + export PYTHONPATH=$PYTHONPATH:$GITHUB_WORKSPACE + export PYTHONPATH=$PYTHONPATH:~/.local/lib/python3.6/site-packages + export PYTHONPATH=$PYTHONPATH:$GITHUB_WORKSPACE/pyrchain + export PYTHONPATH=$PYTHONPATH:/opt/hostedtoolcache/Python/3.6.13/x64/lib/python3.6/site-packages + echo $PYTHONPATH + ls testing + testing/unit_test/test_peekInbox.py + cd testing && pytest diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap index a0961127..386f5039 100755 --- a/bootstrap/bootstrap +++ b/bootstrap/bootstrap @@ -39,21 +39,36 @@ private_key=$(cat PrivateKeys/pk.bootstrap) mkdir -p ~/.rnode || exit 3 tar cf - genesis|(cd ~/.rnode; tar xvf -) || exit 3 -rnode run -s \ +rm -f /tmp/bootstrap.fifo +mkfifo /tmp/bootstrap.fifo + +stdbuf -oL -eL rnode run -s \ --validator-private-key "$private_key" \ --dev-mode \ -XX:MaxDirectMemorySize=100m -XX:MaxRAMPercentage=25 \ - > "$LOGFILE" 2>&1 & + > /tmp/bootstrap.fifo 2>&1 & PID=$! -# The previous command doesn't produce output -- but this one makes up for that -tail -f "$LOGFILE"|sed -e '/Making a transition to Running state./q' +while true;do + if read -r line < /tmp/bootstrap.fifo;then + if echo "$line"|grep 'Making a transition to Running state.';then + break + fi + echo "$ME: $line" + else + sleep 1 + fi +done | tee "$LOGFILE" + +rm -f /tmp/bootstrap.fifo echo "$ME: Stopping $ME rnode process" -sleep 3 && kill $PID && sleep 3 +sleep 3 && kill "$PID" + +wait "$PID" echo "$ME: Creating snapshot '$ME'" ./create-snapshot "$ME" -stty echo +stty echo || exit 0 diff --git a/bootstrap/deploy-all b/bootstrap/deploy-all index 1778ce47..0de2d68f 100755 --- a/bootstrap/deploy-all +++ b/bootstrap/deploy-all @@ -34,22 +34,34 @@ git clone https://github.com/rchain/rchain.git || (cd rchain && git pull) # Updating our local source should be an option -- look into the wisdom of this #git pull https://github.com/rchain-community/liquid-democracy.git -rnode run -s \ - --validator-private-key "$private_key" \ - --dev-mode \ - -XX:MaxDirectMemorySize=100m -XX:MaxRAMPercentage=25 \ - > "$LOGFILE" 2>&1 & +rm -f /tmp/deploy-all.fifo +mkfifo /tmp/deploy-all.fifo +stdbuf -oL -eL rnode run -s \ + --validator-private-key "$private_key" \ + --dev-mode \ + -XX:MaxDirectMemorySize=100m -XX:MaxRAMPercentage=25 \ + > /tmp/deploy-all.fifo 2>&1 & PID=$! -# The previous command doesn't produce output -- but this makes up for that -tail -F "$LOGFILE"|sed -e '/Making a transition to Running state./q' | sed "s/^/$ME: /" +while true;do + if read -r line < /tmp/deploy-all.fifo;then + if echo "$line"|grep 'Making a transition to Running state.';then + break + fi + echo "$ME: $line" + else + sleep 1 + fi +done | tee "$LOGFILE" + +cat < /tmp/deploy-all.fifo | tee -a "$LOGFILE" & deployFiles() { WAITPID="" while read -r t;do - $DEPLOY "$t" & + $DEPLOY "$t" # shellcheck disable=SC2030 WAITPID="$WAITPID $!" done |tee -a log/deployment.log 2>&1 @@ -122,6 +134,6 @@ rnode --grpc-port 40402 propose 2>&1 | tee -a log/deployment.log echo "$ME: Waiting for rnode to finalize (10s)" && sleep 10 && echo "$ME: Stopping deployment rnode" kill $PID && sleep 2 -echo "$ME: Creating rgov snapshot" +wait $PID && echo "$ME: Creating rgov snapshot" ./create-snapshot rgov -stty echo # for some reason, deploy screws up the terminal, so set it right +stty echo || exit 0 diff --git a/bootstrap/run-rnode b/bootstrap/run-rnode index 489c4dae..a7922cba 100755 --- a/bootstrap/run-rnode +++ b/bootstrap/run-rnode @@ -14,6 +14,13 @@ rnode run -s \ -XX:MaxDirectMemorySize=100m -XX:MaxRAMPercentage=25 \ > log/run-rnode.log 2>&1 & -tail -F log/run-rnode.log 2>/dev/null|sed -e '/Making a transition to Running state./q' +while true;do + if grep 'Making a transition to Running state.' log/run-rnode.log;then + break + else + sleep 1 + fi +done -stty echo +# exit 0 is required to make this work in github actions +stty echo || exit 0 diff --git a/src/MasterURI.localhost.json b/src/MasterURI.localhost.json deleted file mode 100644 index 8ee2df69..00000000 --- a/src/MasterURI.localhost.json +++ /dev/null @@ -1,3 +0,0 @@ -{"localhostNETWORK": { "MasterURI": -"`rho:id:localhost`" -}}