From a6f18e59b1d51e40cd264c4746879ccea080890e Mon Sep 17 00:00:00 2001 From: Mark Chang <43993825+CyCTW@users.noreply.github.com> Date: Sat, 2 Apr 2022 20:43:18 +0800 Subject: [PATCH 1/4] Create node.js.yml --- .github/workflows/node.js.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..7694094 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,32 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Node.js CI + +on: + push: + branches: [ ropsten ] + pull_request: + branches: [ ropsten ] + +jobs: + build: + name: Truffle test + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x, 14.x, 16.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm install -g truffle + - run: truffle test + From 0035ff25e41add84cc7bb92add10caec8e7d7fc7 Mon Sep 17 00:00:00 2001 From: Mark Chang <43993825+CyCTW@users.noreply.github.com> Date: Sat, 2 Apr 2022 20:45:06 +0800 Subject: [PATCH 2/4] Update node.js.yml --- .github/workflows/node.js.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 7694094..85651c4 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -26,7 +26,6 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' - - run: npm ci - run: npm install -g truffle - run: truffle test From 405b876473f17dac09acc2cc6b315831032bca40 Mon Sep 17 00:00:00 2001 From: Mark Chang <43993825+CyCTW@users.noreply.github.com> Date: Sat, 2 Apr 2022 20:48:33 +0800 Subject: [PATCH 3/4] Update truffle-config.js --- truffle-config.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/truffle-config.js b/truffle-config.js index 033581a..c878b3b 100644 --- a/truffle-config.js +++ b/truffle-config.js @@ -1,6 +1,4 @@ const path = require("path"); -const { projectId, mnemonic } = require('./secrets.json'); -const HDWalletProvider = require('@truffle/hdwallet-provider'); module.exports = { // See @@ -9,14 +7,7 @@ module.exports = { networks: { develop: { port: 8545 - }, - ropsten: { - provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/${projectId}`), - network_id: 3, // Ropsten's id - confirmations: 2, // # of confs to wait between deployments. (default: 0) - timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50) - skipDryRun: true - }, + } }, compilers: { From b80145aa3d80e01c2d02829fe589555d2e51ae72 Mon Sep 17 00:00:00 2001 From: Mark Chang <43993825+CyCTW@users.noreply.github.com> Date: Sat, 2 Apr 2022 20:52:01 +0800 Subject: [PATCH 4/4] Delete TestImageLabel.sol --- test/TestImageLabel.sol | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 test/TestImageLabel.sol diff --git a/test/TestImageLabel.sol b/test/TestImageLabel.sol deleted file mode 100644 index b558c7b..0000000 --- a/test/TestImageLabel.sol +++ /dev/null @@ -1,40 +0,0 @@ -// Currently I can't find way to send ether to smart contract, so the test will fail. -/* -pragma solidity ^0.6.0; - -import "truffle/Assert.sol"; -import "truffle/DeployedAddresses.sol"; -import "../contracts/ImageLabel.sol"; - -contract TestImageLabel { - // The id of the pet that will be used for testing - string img_cid = "https://test"; - string classname = "monkey"; - uint public initialBalance = 1 ether; - - ImageLabel contract_ = new ImageLabel(); - - function testUploadRawImage() public { - - contract_.uploadRawImage(img_cid); - // contract_.send(initialBalance); - uint num_img = contract_.getNum(); - Assert.equal(num_img, 1, "num img not equal"); - } - - function testGetRandomImage() public { - // ImageLabel contract_ = new ImageLabel(); - - string memory cid = contract_.getRandomImage(); - Assert.equal(img_cid, cid, "cid not equal!"); - - } - - function testUploadLabeledImage() public { - contract_.uploadLabeledImage(img_cid, classname); - uint num_img = contract_.getNum(); - - Assert.equal(num_img, 0, "num img not equal"); - } -} -*/ \ No newline at end of file