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

Commit hooks #1982

Merged
merged 18 commits into from
Aug 24, 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
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
18 changes: 9 additions & 9 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 @@ -73,7 +73,7 @@ jobs:
commit-message: Update networks list
app-id: ${{ secrets.PR_APP_ID}}
app-token: ${{ secrets.PR_APP_TOKEN}}
branch-name: update-networks-${{github.run_number}}
branch-name: update-networks-readme
pr-title: Update network list
pr-body: Update networks list in https://github.com/novasamatech/nova-utils/tree/master/chains
pr-base: master
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 @@ -102,7 +102,7 @@ jobs:
commit-message: Update dapps list
app-id: ${{ secrets.PR_APP_ID}}
app-token: ${{ secrets.PR_APP_TOKEN}}
branch-name: update-dapps-${{github.run_number}}
branch-name: update-dapps-readme
pr-title: Update Dapps list
pr-body: Update dapps list in https://github.com/novasamatech/nova-utils/tree/master/dapps
pr-base: master
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 All @@ -130,7 +130,7 @@ jobs:
commit-message: Update test data file
app-id: ${{ secrets.PR_APP_ID}}
app-token: ${{ secrets.PR_APP_TOKEN}}
branch-name: update-tests-${{github.run_number}}
branch-name: update-test-file
pr-title: Update Test data File
pr-body: Update test data file ./tests/chains_for_testBalance.json
pr-base: master
Expand Down
4 changes: 2 additions & 2 deletions .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 All @@ -28,7 +28,7 @@ jobs:
commit-message: Update chain types
app-id: ${{ secrets.PR_APP_ID}}
app-token: ${{ secrets.PR_APP_TOKEN}}
branch-name: update-types-${{github.run_number}}
branch-name: update-type-files
pr-title: Update types for networks
pr-body: This PR was generated automatically by the GitHub Action, **update-types**.

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_xcm_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
app-id: ${{ secrets.PR_APP_ID}}
app-token: ${{ secrets.PR_APP_TOKEN}}
pr-reviewer: ${{ env.PR_REVIEWER }}
branch-name: update-xcm-coefficients-${{github.run_number}}
branch-name: update-xcm-coefficients
pr-title: 🆙 Update XCM coefficients for ${{ env.ENVIRONMENT }} env
pr-body: This PR was generated automatically 🤖
pr-base: master
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