Skip to content

Commit

Permalink
Commit hooks (#1982)
Browse files Browse the repository at this point in the history
* make single branch for particular changes

* test

* add makefile

* add makefile

* add makefile

* add makefile

* add makefile

* add makefile

* add more commands

* remove flake8

* change clean command

* test

* fix scripts for policy

* return data back

* adding test runner

* update readme file

* move repo to org
  • Loading branch information
stepanLav authored Aug 24, 2023
1 parent c7ff3e2 commit 2e069c4
Show file tree
Hide file tree
Showing 14 changed files with 2,905 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_for_xcm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
${{ env.DEV_XCM_JSON_PATH }}
- name: Install dependencies
run: pip install -r requirements.txt
run: make init

- name: Build body text
run: echo This comment was written by a bot! >> body_file.txt
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/update_network_list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ jobs:
uses: ./.github/workflows/setup-path

- name: Install dependencies
run: pip install -r requirements.txt
run: make init
- name: Generate README file
run: python ./scripts/generate_network_list.py
run: make generate_network_list

- name: Make Pull Request
uses: ./.github/workflows/make-pull-request
Expand All @@ -91,9 +91,9 @@ jobs:
uses: ./.github/workflows/setup-path

- name: Install dependencies
run: pip install -r requirements.txt
run: make init
- name: Generate new Dapps list file
run: python ./scripts/generate_dapps_list.py
run: make generate_dapp_list

- name: Make Pull Request
uses: ./.github/workflows/make-pull-request
Expand All @@ -119,9 +119,9 @@ jobs:
uses: ./.github/workflows/setup-path

- name: Install dependencies
run: pip install -r requirements.txt
run: make init
- name: Generate new Test data file
run: python ./scripts/update_test_data.py
run: make generate_test_file

- name: Make Pull Request
uses: ./.github/workflows/make-pull-request
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_type_files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: ./.github/workflows/setup-path

- name: Install dependencies
run: pip install -r requirements.txt
run: make init

- name: Update chain types
run: python ./scripts/create_type_file.py prod
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
.vscode
__pycache__
.pytest_cache
allure-report
allure-results
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
repos:
- repo: https://github.com/novasamatech/pre-commit-hooks
rev: a0eca3e206a0ee7d824489540565ce280c1d2da9
hooks:
- id: check-chains-json
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-json
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ Note: Icons should be used from trusted sources, however currently icons are not

[Nova Wallet]: https://t.me/novawallet

### Submitting Contributions

- Fork the repository and create a new branch for your contribution.
- Initialize repository by: `make init`
- Commit your changes with a descriptive commit message.
- Push your branch to your forked repository.
- Submit a pull request detailing your changes and explaining why they should be merged.

## License
Nova utils is available under the Apache 2.0 license. See the LICENSE file for more info.
© Novasama Technologies GmbH 2023
2 changes: 1 addition & 1 deletion chains/apply_dev_to_prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ def get_ids(chains):


with open("chains.json", "w") as fout:
json.dump(prod_chains, fout, indent=4)
json.dump(prod_chains, fout, indent=4)
68 changes: 68 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Variables
PYTHON := python
PYTHON_VERSION := 3.11
VENV ?= .venv

THREADS = 4
RE_RUNS = 2
RE_RUN_DELAY = 15
ALLURE_DIR = allure-results
TEST_RUN = $(VENV)/bin/python -m pytest --rootdir . --alluredir=$(ALLURE_DIR) -n $(THREADS) -v --reruns $(RE_RUNS) --reruns-delay $(RE_RUN_DELAY)

CHAINS_FILES=\
chains

# Targets
.PHONY: test clean lint init venv requirements generate_network_list test-all

clean:
rm -rf *.pyc __pycache__/ **/__pycache__/

init: venv .create-venv requirements .install-pre-commit

generate_network_list:
$(VENV)/bin/python ./scripts/generate_network_list.py

generate_dapp_list:
$(VENV)/bin/python ./scripts/generate_dapps_list.py

generate_test_file:
$(VENV)/bin/python ./scripts/update_test_data.py

venv:
$(PYTHON) -m venv .venv

.create-venv:
test -d $(VENV) || python$(PYTHON_VERSION) -m venv $(VENV)
$(VENV)/bin/python -m pip install --upgrade pip
$(VENV)/bin/python -m pip install poetry

.install-pre-commit:
$(VENV)/bin/poetry run pre-commit install

requirements:
$(VENV)/bin/poetry install
. .venv/bin/activate

test-all: test-nodes-availability test-networks-precision test-network-chain-id test-network-prefix test-eth-availability test-new-assets

test-nodes-availability:
$(TEST_RUN) "./tests/test_nodes_availability.py"

test-networks-precision:
$(TEST_RUN) "./tests/test_network_parameters.py::TestPrecision"

test-network-chain-id:
$(TEST_RUN) "./tests/test_network_parameters.py::TestChainId"

test-network-prefix:
$(TEST_RUN) "./tests/test_network_parameters.py::TestNetworkPrefix"

test-eth-availability:
$(TEST_RUN) "./tests/test_eth_nodes_availability.py"

test-new-assets:
$(TEST_RUN) "./tests/test_check_new_assets.py"

allure:
allure serve $(ALLURE_DIR)
Loading

0 comments on commit 2e069c4

Please sign in to comment.