From 0bee1bcb2939cff4276a844df43f4fd6876d1e85 Mon Sep 17 00:00:00 2001 From: yongchand Date: Mon, 24 Oct 2022 13:27:18 +0900 Subject: [PATCH 1/4] Implement Pytest PR --- .github/workflows/pytest.yml | 22 ++++++++++++++++++++++ requirements.txt | 13 +++++++++++++ setup.py | 22 +++++----------------- 3 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/pytest.yml create mode 100644 requirements.txt diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..fdfebf0 --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,22 @@ +name: Pytest PR +on: [push] +jobs: + run-test-code: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.9 + uses: actions/setup-python@v4 + with: + python-version: '3.9' + cache: 'pip' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Test with pytest + run: | + export KLAYTN_ETL_RUN_SLOW_TESTS=True + pytest + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6d88b97 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,13 @@ +web3>=5.29,<6 +eth-rlp<0.3 +eth-utils==1.10 +eth-abi==2.1.1 +# TODO: This has to be removed when "ModuleNotFoundError: No module named 'eth_utils.toolz'" is fixed at eth-abi +python-dateutil>=2.8.0,<3 +click==8.0.4 +ethereum-dasm==0.1.4 +pytz==2022.1 +base58 +requests +boto3 +google-cloud-storage \ No newline at end of file diff --git a/setup.py b/setup.py index f732d84..65c14c4 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,9 @@ def version(): except: return "0.0.0.dev0" +with open('requirements.txt') as f: + requirements = f.read().splitlines() + long_description = read('README.md') if os.path.isfile("README.md") else "" setup( @@ -31,26 +34,11 @@ def version(): 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9' + 'Programming Language :: Python :: 3.9', ], keywords=['klaytn', 'etl', 'batch'], python_requires='>=3.7.2,<4', - install_requires=[ - 'web3>=5.29,<6', - # eth-rlp is explicitly written to prevent dependency related issue - 'eth-rlp<0.3', - 'eth-utils==1.10', - 'eth-abi==2.1.1', - # TODO: This has to be removed when "ModuleNotFoundError: No module named 'eth_utils.toolz'" is fixed at eth-abi - 'python-dateutil>=2.8.0,<3', - 'click==8.0.4', - 'ethereum-dasm==0.1.4', - 'pytz==2022.1', - 'base58', - 'requests', - 'boto3', - 'google-cloud-storage' - ], + install_requires=requirements, extras_require={ 'dev': [ 'pytest~=4.3.0' From 0290a38567e51ed0bde25f6b00f6ed389dd116f3 Mon Sep 17 00:00:00 2001 From: yongchand Date: Mon, 24 Oct 2022 13:29:10 +0900 Subject: [PATCH 2/4] Change to pull request --- .github/workflows/pytest.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index fdfebf0..f159fc9 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -1,5 +1,8 @@ name: Pytest PR -on: [push] +on: + pull-request: + branches: + - main jobs: run-test-code: runs-on: ubuntu-latest From 08a1102eefdf375e163e31483d1625dec5bcfa9c Mon Sep 17 00:00:00 2001 From: yongchand Date: Mon, 24 Oct 2022 13:43:43 +0900 Subject: [PATCH 3/4] make github action efficient --- .github/workflows/pytest.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index f159fc9..596e897 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -17,9 +17,9 @@ jobs: run: | python -m pip install --upgrade pip pip install pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install -r requirements.txt - name: Test with pytest + env: + KLAYTN_ETL_RUN_SLOW_TESTS: True run: | - export KLAYTN_ETL_RUN_SLOW_TESTS=True pytest - From ac38a796ebee04151f9c9eef058c180ce7944a43 Mon Sep 17 00:00:00 2001 From: yongchand Date: Mon, 24 Oct 2022 13:48:16 +0900 Subject: [PATCH 4/4] fix typo --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 596e897..5f08512 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -1,6 +1,6 @@ name: Pytest PR on: - pull-request: + pull_request: branches: - main jobs: