Skip to content

Commit

Permalink
Merge pull request #1 from ApeWorX/devops/workflows
Browse files Browse the repository at this point in the history
feat(devops): adds GH workflows
  • Loading branch information
mikeshultz committed Jan 23, 2024
2 parents b4e8f1a + 199336a commit eb5c040
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 9 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
on:
release:
types: [published]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.10"
- run: pip install -e .[dev]
- run: pytest

test-release:
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Install dependencies
run: pip install -e .[dev]

- name: Build dist
run: python setup.py sdist bdist_wheel

- name: Publish release to test PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

release:
needs: test-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Install dependencies
run: pip install -e .[dev]

- name: Build dist
run: python setup.py sdist bdist_wheel

- name: Publish release to test PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
82 changes: 82 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
on: [pull_request]

name: Test

concurrency:
# Cancel older, in-progress jobs from the same PR, same workflow.
# use run_id if the job is triggered by a push to ensure
# push-triggered jobs to not get canceled.
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
linting:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name: Run Black
#run: black --check .
run: black --diff .

- name: Run isort
run: isort --check-only .

- name: Run flake8
run: flake8 .

type-check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name: Run MyPy
run: mypy .

test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, macos-latest] # eventually add `windows-latest`
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name: Run Tests
run: pytest
5 changes: 3 additions & 2 deletions evmchains/_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple, Union

VERSION_TUPLE = Tuple[Union[int, str], ...]
else:
VERSION_TUPLE = object
Expand All @@ -12,5 +13,5 @@
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE

__version__ = version = '0.0.1a1'
__version_tuple__ = version_tuple = (0, 0, 1)
__version__ = version = "0.1.dev4+g34f2bde.d20240123"
__version_tuple__ = version_tuple = (0, 1, "dev4", "g34f2bde.d20240123")
4 changes: 2 additions & 2 deletions evmchains/chains.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is auto-generated by scripts/update_rpc.py
# 2024-01-23 02:47:29.050302
# 2024-01-23 19:38:18.687945
# Do not edit this file directly.
from typing import Any, Dict, List
from typing import Any, Dict

PUBLIC_CHAIN_RPCS: Dict[str, Dict[str, Dict[str, Any]]] = {
"arbitrum": {
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ dynamic = ["version"]
[project.optional-dependencies]
dev = [
"black~=23.12.1",
"flake8~=7.0.0",
"isort~=5.13.2",
"mypy~=1.8.0",
"pytest~=7.4.4",
"requests-2.31.0",
"setuptools-scm-8.0.4",
"requests~=2.31.0",
"setuptools-scm~=8.0.4",
"types-requests>=2.31.0.20240106",
]

[tool.mypy]
Expand All @@ -58,6 +60,7 @@ include = '\.pyi?$'
python_files = "test_*.py"
testpaths = "tests"


[tool.isort]
force_grid_wrap = 0
include_trailing_comma = true
Expand Down
4 changes: 2 additions & 2 deletions scripts/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from datetime import datetime
from pathlib import Path
from pprint import PrettyPrinter
from typing import Any, Dict, List, Optional
from typing import Any, Dict
from urllib.parse import urljoin

import black
Expand Down Expand Up @@ -127,7 +127,7 @@ def write_chain_const(chains: Dict[str, Dict[str, Chain]]):
file_str = "# This file is auto-generated by scripts/update_rpc.py\n"
file_str += f"# {stamp()}\n"
file_str += "# Do not edit this file directly.\n"
file_str += "from typing import Any, Dict, List\n\n"
file_str += "from typing import Any, Dict\n\n"
file_str += "PUBLIC_CHAIN_RPCS: Dict[str, Dict[str, Dict[str, Any]]] = {\n"

for ecosystem in chains.keys():
Expand Down
15 changes: 15 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[flake8]
max-line-length = 100
exclude =
venv*
docs
build
.eggs
tests/integration/cli/projects
per-file-ignores =
# Need signal handler before imports
src/ape/__init__.py: E402
# Test data causes long lines
tests/functional/data/python/__init__.py: E501
tests/functional/utils/expected_traces.py: E501

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from setuptools import setup
from setuptools import setup # type: ignore

setup()

0 comments on commit eb5c040

Please sign in to comment.