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

feat: project upgrade #115

Merged
merged 4 commits into from
Feb 6, 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
49 changes: 49 additions & 0 deletions .commitlintrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import type { UserConfig } from '@commitlint/types';

const Configuration: UserConfig = {
/*
* Resolve and load @commitlint/config-conventional from node_modules.
* Referenced packages must be installed
*/
extends: ['@commitlint/config-conventional'],
/*
* Resolve and load conventional-changelog-atom from node_modules.
* Referenced packages must be installed
*/
// parserPreset: 'conventional-changelog-atom',
/*
* Resolve and load @commitlint/format from node_modules.
* Referenced package must be installed
*/
// formatter: '@commitlint/format',
/*
* Any rules defined here will override rules from @commitlint/config-conventional
*/
rules: {},
/*
* Functions that return true if commitlint should ignore the given message.
*/
// ignores: [(commit) => commit === ''],
/*
* Whether commitlint uses the default ignore rules.
*/
// defaultIgnores: true,
/*
* Custom URL to show upon failure
*/
helpUrl:
'https://github.com/conventional-changelog/commitlint/#what-is-commitlint',
/*
* Custom prompt configs
*/
// prompt: {
// messages: {},
// questions: {
// type: {
// description: 'please input type:',
// },
// },
// },
};

export default Configuration;
6 changes: 4 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
dist
types/truffle-contracts
artifacts
cache
coverage
dist
20 changes: 0 additions & 20 deletions .eslintrc

This file was deleted.

57 changes: 57 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
module.exports = {
extends: [
"eslint:recommended",
"plugin:mocha/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier",
],
env: {
browser: false,
es2021: true,
mocha: true,
node: true,
},
// root: true,
plugins: ["@typescript-eslint", "mocha"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
tsconfigRootDir: __dirname,
project: "./tsconfig.json",
},
rules: {
"lines-between-class-members": "error",
"padding-line-between-statements": [
"error",
{ blankLine: "always", prev: "*", next: "return" },
],
"prefer-const": [
"error",
{
destructuring: "any",
ignoreReadBeforeAssign: false,
},
],
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"@typescript-eslint/naming-convention": [
"error",
{
selector: ["variable", "function"],
format: ["camelCase"],
},
{
selector: ["variable"],
modifiers: ["const"],
format: ["camelCase", "UPPER_CASE"],
},
],
"mocha/no-skipped-tests": "warn",
"mocha/no-empty-description": "off",
"mocha/no-exclusive-tests": "error",
"@typescript-eslint/no-unsafe-member-access": "warn",
"eol-last": ["error", "always"]
},
};
12 changes: 6 additions & 6 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: 'CodeQL'

on:
push:
branches: ['master']
pull_request:
branches: ['master']
schedule:
- cron: '40 22 * * 6'
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: "40 22 * * 6"

jobs:
analyze:
Expand Down
78 changes: 28 additions & 50 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,31 @@
name: CI for RIF-Relay-Contract
on: [push]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '16.x'

- name: Install dependencies
run: npm install

- name: Check Linter bugs for Typescript
run: npm run lint:ts

- name: See bugs on solidity
run: npm run lint:sol

- name: Check Codestyles errors
run: npm run prettier

contract-test:
runs-on: ubuntu-latest
needs: [lint]

steps:
# Downloads a copy of the code in your repository before running CI tests
- name: Check out repository code
uses: actions/checkout@v3

- name: Download rif-relay node configuration
run: |
wget https://raw.githubusercontent.com/rsksmart/rif-relay/develop/docker/node.conf
wget https://raw.githubusercontent.com/rsksmart/rif-relay/develop/docker/logback.xml

- name: Run docker image
run: docker run -d -p 127.0.0.1:4444:4444 -p 127.0.0.1:4445:4445 --name enveloping-rskj -it -v $PWD/logback.xml:/etc/rsk/logback.xml -v $PWD/node.conf:/etc/rsk/node.conf rsksmart/rskj:IRIS-3 --regtest

- name: Install dependencies
run: npm install

# Performs a clean installation of all dependencies in the `package.json` file
# For more information, see https://docs.npmjs.com/cli/ci.html
- name: Run contract test with truffle
run: npm run test:truffle

# Performs a clean installation of all dependencies in the `package.json` file
# For more information, see https://docs.npmjs.com/cli/ci.html
- name: Run contract test with waffle
run: npm run test
lint_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "16.x"

- name: Install dependencies
run: npm install

- name: Check Codestyles errors
run: npm run ci:format

- name: Check Linter bugs for Typescript
run: npm run ci:lint

- name: Download rif-relay node configuration
run: |
wget https://raw.githubusercontent.com/rsksmart/rif-relay/main/docker/node.conf
wget https://raw.githubusercontent.com/rsksmart/rif-relay/main/docker/logback.xml

- name: Run docker image
run: docker run -d -p 127.0.0.1:4444:4444 -p 127.0.0.1:4445:4445 --name enveloping-rskj -it -v $PWD/logback.xml:/etc/rsk/logback.xml -v $PWD/node.conf:/etc/rsk/node.conf rsksmart/rskj:IRIS-3 --regtest

- name: Run tests
run: npm run ci:test
22 changes: 18 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
node_modules/
build/
dist/
.npmignore
package-lock.json
.eslintcache

node_modules
.env
coverage
coverage.json
typechain
typechain-types

#Hardhat files
cache
artifacts
/build
/dist
/contracts-exposed

.vscode
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit
15 changes: 5 additions & 10 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

if [ -d "$HOME/.nvm" ]; then
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
fi

npm run lint:ts
npm run lint:sol
npm run prettier:fix
npm run format
npm run lint
npx lint-staged
5 changes: 5 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run build
npm run test
20 changes: 20 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/.github
/.husky
/scripts
/typechain-types
/test
/utils
/tsconfig.json
/tsconfig.build.json
/index.ts
/hardhat.config.ts
/.commitlintrc.ts
/.eslintignore
/.eslintrc.cjs
/.npmignore
/.prettierignore
/.prettierrc
/.solhint.json
/.solhintignore
!dist
!artifacts
22 changes: 6 additions & 16 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
.gitignore
.prettierignore
package.json
package-lock.json
prettierrc.json5
Readme.md
tsconfig.json
.eslintignore
.eslintrc
node_modules
.solhint.json
.solhintignore
webpack.config.js
build
dist
types/truffle-contracts
pull_request_template.md
artifacts
cache
coverage*
gasReporterOutput.json
typechain-types
dist
28 changes: 20 additions & 8 deletions .prettierrc.json5
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
{
trailingComma: 'none',
tabWidth: 4,
semi: true,
singleQuote: true,
jsxSingleQuote: true,
bracketSpacing: true,
jsxBracketSameLine: true,
arrowParens: 'always'
"overrides": [
{
"files": "*.ts",
"options": {
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5"
}
},
{
"files": "*.sol",
"options": {
"trailingComma": "none",
"tabWidth": 4,
"semi": true,
"singleQuote": false
}
}
]
}
Loading