Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cli workflow + nvm file for Node.JS #193

Merged
merged 4 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Truffle CI

on:
push:
branches: [dev, master, main]
pull_request:
branches: [dev, master, main]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup NodeJS 16
uses: actions/setup-node@v3
with:
node-version: 16.17.0

- name: Show NodeJS version
run: npm --version

- name: Checkout submodules
run: git submodule update --init --recursive

- name: Install Project Dependencies
run: npm install

- name: Run Truffle Test
run: npx truffle test
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16.17.0
10 changes: 9 additions & 1 deletion doc/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The toolchain includes the following components, where the versions
are the latest ones that we tested:

- npm 8.19.2
- Truffle 5.8.3
- Truffle 5.9.3
- Solidity 0.8.17 (via solc-js)
- Node 16.17.0
- Web3.js 1.9.0
Expand All @@ -18,12 +18,20 @@ Although present in the dependencies, Hardhat is not included in the toolchain s

## Installation

- Clone the repository

Clone the git repository, with the option `--recurse-submodules` to fetch the submodules:

`git clone git@github.com:CMTA/CMTAT.git --recurse-submodules`

- Node.js version

We recommend to install the [Node Version Manager `nvm`](https://github.com/nvm-sh/nvm) to manage multiple versions of Node.js on your machine. You can then, for example, install the version 16.17.0 of Node.js with the following command: `nvm install 16.17.0`

The file [.nvmrc](../.nvmrc) at the root of the project set the Node.js version. `nvm use`will automatically use this version if no version is supplied on the command line.

- node modules

To install the node modules required by CMTAT, run the following command at the root of the project:

`npm install`
Expand Down
30 changes: 30 additions & 0 deletions migrations/1_deploy_contracts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require('dotenv').config()

const CMTAT_PROXY = artifacts.require("CMTAT_PROXY")
const { deployProxy } = require("@openzeppelin/truffle-upgrades")
const { Address } = require("ethereumjs-util")

module.exports = async function (deployer, _network, account) {
const admin = process.env.ADMIN_ADDRESS ? process.env.ADMIN_ADDRESS : account[0]
const flag = 0
const ZERO_ADDRESS = Address.zero().toString()
const proxyContract = await deployProxy(
CMTAT_PROXY,
[
admin,
"Test CMTA Token",
"TCMTAT",
"TCMTAT_ISIN",
"https://cmta.ch",
ZERO_ADDRESS,
"TCMTAT_info",
flag,
],
{
deployer,
constructorArgs: [ZERO_ADDRESS]
}
);
await CMTAT_PROXY.deployed()
console.log("Proxy deployed at: ", proxyContract.address)
}
Loading