Quellcode durchsuchen

algo/make: add Makefile and test script (#1153)

* algo/make: add Makefile and test script

* algo/make: add cleanup of sandbox

* algo/make: add python3 requirements

* algo/make: fix path

* algo/make: change pyteal version

* algo/make: propagate errors

* algo/make: add verbosity

* algo/make: fix script

* algo/make: $? check is bad

* algo/make: try using github runner with python 3.10

* algo/make: need to use the correct requirements file

* algo/make: some tests aren't running

* algo/make: attempt to fix tests

* algo/make: get workflow to work

* algo/make: fix runner

* algo/make: try to find the correct python version

* algo/make: more changes

* algo/make: move code around

* algo/make: all python test

* algo/make: remove tabs

* algo/make: combine lines

* algo/make: back to using Makefile in action

* algo/make: change path

* algo/make: test error

* algo/make: fix error example
Paul Noel vor 3 Jahren
Ursprung
Commit
e2687e7c36

+ 14 - 4
.github/workflows/build.yml

@@ -42,16 +42,26 @@ jobs:
       - uses: actions/checkout@v2
       - uses: actions/setup-go@v2
         with:
-          go-version: '1.17.5'
+          go-version: "1.17.5"
       - run: make node
 
+  algorand:
+    runs-on: ubuntu-20.04
+    steps:
+      - uses: actions/checkout@v3
+      - uses: actions/setup-python@v3
+        with:
+          python-version: "3.10"
+      - run: pip install -r algorand/requirements.txt
+      - run: cd algorand && make test
+
   ethereum:
     runs-on: ubuntu-20.04
     steps:
       - uses: actions/checkout@v2
       - uses: actions/setup-node@v2
         with:
-          node-version: '16'
+          node-version: "16"
       - run: cd ethereum && make test
 
   terra:
@@ -60,7 +70,7 @@ jobs:
       - uses: actions/checkout@v2
       - uses: actions/setup-node@v2
         with:
-          node-version: '16'
+          node-version: "16"
       - run: cd terra && make test
 
   # Run linters, Go tests and other outside-of-Tilt things.
@@ -74,7 +84,7 @@ jobs:
       - uses: actions/checkout@v2
       - uses: actions/setup-go@v2
         with:
-          go-version: '1.17.5'
+          go-version: "1.17.5"
       - run: make generate && ./lint.sh
       # The go-ethereum and celo-blockchain packages both implement secp256k1 using the exact same header, but that causes duplicate symbols.
       - run: cd node && go test -v -ldflags '-extldflags "-Wl,--allow-multiple-definition" ' ./...

+ 4 - 0
algorand/Makefile

@@ -0,0 +1,4 @@
+.PHONY: test
+
+test:
+	./runPythonUnitTests.sh

+ 1 - 0
algorand/requirements.txt

@@ -14,6 +14,7 @@ pydantic==1.9.0
 PyNaCl==1.5.0
 pyparsing==3.0.6
 pyteal==v0.11.1
+#pyteal==v0.10.0
 py-algorand-sdk==1.10.0b1
 pytest==6.2.5
 pytest-depends==1.0.1

+ 25 - 0
algorand/runPythonUnitTests.sh

@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+#python3 -m pip install -r requirements.txt
+if [ ! -d _sandbox ]; then
+  echo We need to create it...
+  git clone https://github.com/algorand/sandbox.git _sandbox
+fi
+if [ "`grep enable-all-parameters _sandbox/images/indexer/start.sh | wc -l`" == "0" ]; then
+  echo the indexer is incorrectly configured
+  sed -i -e 's/dev-mode/dev-mode --enable-all-parameters/'  _sandbox/images/indexer/start.sh
+  echo delete all the existing docker images
+fi
+./sandbox clean
+./sandbox up -v dev
+echo running the tests...
+cd test
+python3 test.py
+rv=$?
+echo rv = $rv
+if [ $rv -ne 0 ]; then
+	echo tests in test.py failed
+	exit 1
+fi
+echo bringing the sandbox down...
+cd ..
+./sandbox down

+ 1 - 1
algorand/test/test.py

@@ -533,7 +533,7 @@ class AlgoTest(PortalCore):
 
         if self.foundation == None:
             print("We dont have a account?  ")
-            sys.exit(0)
+            sys.exit(1)
 
         foundation = self.foundation