Skip to content

Commit

Permalink
Ag 36 git tag (#17)
Browse files Browse the repository at this point in the history
* Ag 17 commitlint fix (#1)

* fix(@script): AG-17 changed script logic

changed script login the commit script

* fix(@script): AG-17 changed script

modified some logic in the script folder

* docs(@agora): modified readme

modified readme

* feat(@agora): AG-35 basic workflow (#3)

* feat(@agora): AG-35 basic workflow

basic GitHub Actions workflow implementation

* feat(@agora): AG-35 duplicated code

inserted duplicated code check in ci-cd

* docs(@agora): AG-35 updloaded image (#5)

uploaded image for functional analysis

* Ag 18 eoa implementation (#7)

* feat(@script): AG-18 EOA script implementation

implemented script in order to generate an EOA over different ethereum networks configured

* test(@script): AG-18 unit test configuration

unit test configuration for scripts using jest

* test(@agora): AG-18 configured test step in workflow

configured workflow to run script unit test

* test(@script): AG-18 configured commit script

configured pre-commit hook script to run unit test

* test(@script): AG-18 unit test implementation

implemented unit test for eoa script

* test(@script): AG-18 code coverage

unit test code coverage report implementation

* refactor(@script): AG-18 precommit hook

added check in pre-commit hook

* fix(@script): AG-18 fixed unit test threshold

fixed unit test code coverage threshold

* fix(@agora): AG-18 fixed package.json

fixed package json property not used

* fix(@agora): AG-18 fixed unit test

n

* fix(@agora): AG-18 fixed workflow

fixed workflow

* refactor(@script): AG-18 test code coverage threshold

test code coverage threshold

* docs(@agora): AG-18 updated readme

updated readme file

* Ag 19 DECsRegistry smart contract (#8)

* fix(@script): AG-19 removed comments

removed code comments

* docs(@docs): AG-19 updated sequence diagrams

updated the sequence diagrams images for the functional analysis

* docs(@docs): AG-19 updated smart contract classes

updated docs about the smart contracts classes

* feat(@contracts): AG-19 DEC contract implementation

implemented a first version of the DEC contract

* feat(@contracts): AG-19 added events to DEC sc

emitted event in the DEC smart contract implementation

* feat(@contracts): AG-19 implemented DEC contract

implemented DEC contract and related unit tests

* fix(@contracts): AG-19 removed event

removed event not used in DEC contract

* feat(@contracts): AG-19 DECs registry implementation

implemented the register of the DECs with the required methods

* test(@contracts): AG-19 defined test for DECsRegistry contract

defined test structure for the DECsRegistry smart contract

* test(@contracts): AG-19 implemented unit test

implemented unit tests for DECsRegistry smart contract

* feat(@contracts): AG-19 added events to smart contract

added events to the DECsRegistry smart contract

* Ag 20 election smart contract (#9)

* refactor(@agora): AG-20 switched test network

switched from legacy goerli test network to sepolia

* docs(@docs): AG-20 updated analysis diagrams

updated diagrams in the functional analysis

* feat(@contracts): AG-20 Election smart contract

implemented Election smart contract with unit tests

* feat(@contracts): AG-20 Elections smart contracts

implemeneted different smart contracts for different kind of elections

* docs(@docs): AG-20 addded diagrams files to docs

added diagrams file to the docs folder

* docs(@docs): AG-20 updated class diagrams

updated the smart contracts class diagrams

* Ag 20 election smart contract (#10)

* refactor(@agora): AG-20 switched test network

switched from legacy goerli test network to sepolia

* docs(@docs): AG-20 updated analysis diagrams

updated diagrams in the functional analysis

* feat(@contracts): AG-20 Election smart contract

implemented Election smart contract with unit tests

* feat(@contracts): AG-20 Elections smart contracts

implemeneted different smart contracts for different kind of elections

* docs(@docs): AG-20 addded diagrams files to docs

added diagrams file to the docs folder

* docs(@docs): AG-20 updated class diagrams

updated the smart contracts class diagrams

* fix(@agora): AG-20 updated version number

updated version number in package json

* Ag 25 deploy contracts (#13)

* feat(@agora): AG-25 configured evm compiler

configured the evm compiler in the hardhat configuration file

* refactor(@contracts): AG-25 refactored DECs Registry contract

refactored DECs registry contract

* refactor(@contracts): AG-25 refactored DEC contract

refactored DEC smart contract

* feat(@contracts): AG-25 added name property to DECs Registry

added name property to DECs Registry smart contract

* feat(@contracts): ignition modules implementation

implemented the ignition modules for contracts deploy

* fix(@contracts): AG-25 added folder to gitignore

added foldet to gitignore

* fix(@contracts): AG-25 ignored files

added files to gitignore

* Ag 26 register election script (#14)

* docs(@docs): modified main flow diagram

modified the representation of the entire process in the functional analysis

* docs(@docs): AG-26 typo fix

typo fix in the README file

* feat(@scripts): AG-26 implemented the deploy for the Election smart contract

implemented the ignition module for the deploy of the Election smart contract

* feat(@script): AG-26 municipality election deploy

created the ignition module for the deploy of a municipality election

* feat(@contracts): AG-26 defined methods for municipality election contract

defined properties and methods for the municipality election smart contract

* feat(@contracts): AG-26 election contract modifier implementation

implemented a modifier in the municipality election smart contract

* feat(@contracts): AG-26 municipality election method implementation

implemented the registerParty method in the municipality election smart contract

* refactor(@contracts): AG_26 modified contracts methods

modified the sign of the methods of all the smart contracts

* feat(@contracts): AG-26 municipality election smart contract

implemented the municipality election smart contract

* refactor(@contracts): AG-26 refactored municipality election contract

refactored municipality election smart contract to make it more gas efficient

* feat(@contracts): AG-26 added getter to municipality election contract

added a getter function to the municipality election getter contract

* refactor(@contracts): AG-26 formatted smart contract

formatted smart contract file

* feat(@contracts): AG-26 get coalition in municipality election

implemented a get coalition in the municipality election contract

* refactor(@contracts): AG-26 refactored municipality election contract

refactored municipality election contract

* refactor(@contracts): AG-26 Municipality contract unit test

unit tests implementation for municipality election smart contract

* feat(contracts): AG-26 refactored Municipality Election

modified Municipality Election smart contract deploy

* feat(@contracts): AG-26 Ignition module implementation

ignition module implementation

* style(@contracts): AG-26 contract refactor

refactored formatting of a smart contract

* feat(@contracts): AG-26 MunicipalityElection smart contract deploy script

implementation of the ignition module for the deploy of the MunicipalityElection smart dd contract

* feat(@contracts): AG-26 Create election script definition

defined create-election script that register the data into a given election contract

* feat(@scripts): AG-26 create election script partial implementation

partially implemented the script for the MunicipalityElection smart contract

* feat(@scripts): AG-26 Implemented the create-election script

implemented the create election script

* feat(@script): AG-26 unit test implementation

implemented unit test for create election script

* refactor(@script): improved script

improved script

* Ag 37 actions api layer (#16)

* feat(@ci): AG-37 defined ci module

defined a ci module for the workflows api layer

* feat(@ci): AG-37 ci api integration

integrated ci apis into github actions workflow

* fix(@ci): AG-37 fixed command path

fixed ci command path

* fix(ci): AG-37 fixed ci module logic

fixed ci module logic

* docs(@docs): updated README

updated README

* feat(@ci): AG-36 git tag task in ci

implemented release tagging in main workflow
  • Loading branch information
g3k0 authored Apr 7, 2024
1 parent dadbfb4 commit 21dee2f
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 8 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,22 @@ jobs:
node-version: 20.x

- name: Install dependencies
run: npm install
run: node ci --function installDeps

- name: Run linter
run: npm run lint
run: node ci --function lint

- name: Run duplications check
run: npm run duplicated
run: node ci --function checksDuplications

- name: Run smart contracts unit tests
run: npm run test-contracts
run: node ci --function smartContractsUnitTest

- name: Run scripts unit tests
run: npm run test-scripts
run: node ci --function scriptsUnitTest

- name: Tag the release with the version
run: node ci --function tagRelease
if: |
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
(github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main' && github.event.action == 'closed' && github.event.pull_request.merged)
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ To setup the application follow these steps:

## How to commit

The `main` and the `develop` branches are protected. It is required to open and review pull requests in order to merge the code.

Since the development of this project is planned, if you are considering to open a Pull Request please contact first the maintainer of the code at:

`nova.web3.collective@gmail.com`

To commit:

1. `git add <files list>`
2. `npm run commit`

Expand Down
38 changes: 38 additions & 0 deletions ci/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const execSync = require("child_process").execSync;
const fs = require("fs");

const execSyncOptions = { stdio: "inherit" };

const functions = {
installDeps: function () {
return execSync("npm install", execSyncOptions);
},
lint: function () {
return execSync("npm run lint", execSyncOptions);
},
checksDuplications: function () {
return execSync("npm run duplicated", execSyncOptions);
},
smartContractsUnitTest: function () {
return execSync("npm run test-contracts", execSyncOptions);
},
scriptsUnitTest: function () {
return execSync("npm run test-scripts", execSyncOptions);
},
tagRelease: function () {
const packageJson = JSON.parse(fs.readFileSync("package.json", "utf8"));
const version = packageJson.version;

const tags = execSync("git tag", { encoding: "utf8" }).split("\n");

if (tags.includes(`v${version}`)) {
console.error(`Error: The tag for the version ${version} already exists`);
return;
}
execSync(`git tag -a v${version} -m "Version ${version}"`, execSyncOptions);
execSync("git push origin --tags", execSyncOptions);
},
};

module.exports = functions;
36 changes: 36 additions & 0 deletions ci/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/**
* This script implements logic delegated from the GitHub Actions workflows.
* The workflow invokes the API interface using the CLI with the following command:
*
* node ci --function functionOne --params '{"param1": "value1", "param2": "value2"}'
*/
const functions = require("./functions");

// process command line arguments
const args = process.argv.slice(2);

// checks the arguments
if (args.length < 2 || args[0] !== "--function") {
console.error(
'Correct usage: node ci --function <functionName> --params \'{"param1": "value1", "param2": "value2"}\'',
);
process.exit(1);
}

const functionName = args[1];

let params;
if (args[3]) {
params = JSON.parse(args[3]);
}

// Execute the function invoked
try {
functions[functionName](params);
} catch (e) {
console.error(
"Error: the function invoked does not exists or there is an error in the function",
);
console.error(e);
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "agora",
"version": "0.3.0",
"version": "0.4.0",
"description": "A confidentiality-first electronic voting system",
"author": {
"name": "nova collective",
Expand Down

0 comments on commit 21dee2f

Please sign in to comment.