From 28294d431ad468954bb8928eed8c4efac3ef2164 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Mon, 21 Mar 2022 11:37:47 +0100 Subject: [PATCH] [contracts] Tests now also work in Windows --- .github/workflows/ci.yml | 7 +++++++ dagger.nimble | 16 +++------------- dagger/contracts/deployment.nim | 3 ++- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 655eb9df..a7528760 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -174,6 +174,13 @@ jobs: fi make -j$ncpu ARCH_OVERRIDE=$PLATFORM CI_CACHE=NimBinaries QUICK_AND_DIRTY_COMPILER=1 update + - name: Start Ethereum Node with Dagger contracts + shell: bash + working-directory: nim-dagger/vendor/dagger-contracts + run: | + npm install + npm start & + - name: Run nim-dagger tests shell: bash working-directory: nim-dagger diff --git a/dagger.nimble b/dagger.nimble index 1a087dd5..a9dfd908 100644 --- a/dagger.nimble +++ b/dagger.nimble @@ -34,22 +34,12 @@ proc test(name: string, srcDir = "tests/", params = "-d:chronicles_log_level=DEB buildBinary name, srcDir, params exec "build/" & name -task testContracts, "Build, deploy and test contracts": - exec "cd vendor/dagger-contracts && npm install" - - # start node - exec "cd vendor/dagger-contracts && npm start &" - - # run contract tests using deployed contracts - try: - test "testContracts", "tests/", "-d:chronicles_log_level=WARN" - finally: - # kill simulator processes - exec "ps -ef | grep hardhat | grep -v grep | awk '{ print $2 }' | xargs kill" - task testDagger, "Build & run Dagger tests": test "testDagger", params = "-d:chronicles_log_level=WARN" +task testContracts, "Build & run Dagger Contract tests": + test "testContracts", "tests/", "-d:chronicles_log_level=WARN" + task test, "Run all tests": testDaggerTask() testContractsTask() diff --git a/dagger/contracts/deployment.nim b/dagger/contracts/deployment.nim index a6ddacc7..bfe9c833 100644 --- a/dagger/contracts/deployment.nim +++ b/dagger/contracts/deployment.nim @@ -1,11 +1,12 @@ import std/json +import std/os import pkg/ethers import pkg/questionable type Deployment* = object json: JsonNode -const defaultFile = "vendor/dagger-contracts/deployment-localhost.json" +const defaultFile = "vendor" / "dagger-contracts" / "deployment-localhost.json" ## Reads deployment information from a json file. It expects a file that has ## been exported with Hardhat deploy.