Merge pull request #28 from lukevs/github-action-tst
Add Github Actions to run pre-commit and tests
This commit is contained in:
commit
6c3c13054b
25
.github/workflows/github-actions.yml
vendored
Normal file
25
.github/workflows/github-actions.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
name: Python package
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Python 3.9
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: 3.9
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install -r requirements.txt
|
||||||
|
pip install -r requirements_dev.txt
|
||||||
|
- name: Run precommit
|
||||||
|
run: |
|
||||||
|
pre-commit run --all-files
|
||||||
|
- name: Test with unittest
|
||||||
|
run: |
|
||||||
|
python -m unittest tests/*.py
|
@ -13,7 +13,7 @@ repos:
|
|||||||
language: system
|
language: system
|
||||||
types: [python]
|
types: [python]
|
||||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
rev: v0.770
|
rev: v0.910
|
||||||
hooks:
|
hooks:
|
||||||
- id: 'mypy'
|
- id: 'mypy'
|
||||||
additional_dependencies:
|
additional_dependencies:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
from web3 import Web3
|
from web3 import Web3
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ def fetch_block(w3, base_provider, block_number: int) -> Block:
|
|||||||
block_logs = w3.eth.get_logs({"blockHash": block_hash})
|
block_logs = w3.eth.get_logs({"blockHash": block_hash})
|
||||||
|
|
||||||
## Get gas used by individual txs and store them too
|
## Get gas used by individual txs and store them too
|
||||||
txs_gas_data = {}
|
txs_gas_data: Dict[str, Dict[str, Any]] = {}
|
||||||
|
|
||||||
for transaction in block_data["transactions"]:
|
for transaction in block_data["transactions"]:
|
||||||
tx_hash = (transaction.hash).hex()
|
tx_hash = (transaction.hash).hex()
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
pre-commit==2.13.0
|
pre-commit==2.13.0
|
||||||
pylint==2.9.3
|
pylint==2.9.3
|
||||||
|
mypy==0.910
|
||||||
|
Loading…
x
Reference in New Issue
Block a user