diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..85651c4 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,31 @@ +# 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 install -g truffle + - run: truffle test + 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 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: {