Skip to content

Commit 3260849

Browse files
authored
Merge pull request #84 from pipermerriam/circleci-project-setup
Circleci project setup
2 parents 61891b2 + 4603a7e commit 3260849

File tree

4 files changed

+152
-33
lines changed

4 files changed

+152
-33
lines changed

.circleci/config.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
version: 2.0
2+
3+
# heavily inspired by https://raw.githubusercontent.com/pinax/pinax-wiki/6bd2a99ab6f702e300d708532a6d1d9aa638b9f8/.circleci/config.yml
4+
5+
common: &common
6+
working_directory: ~/repo
7+
steps:
8+
- checkout
9+
- run:
10+
name: merge pull request base
11+
command: ./.circleci/merge_pr.sh
12+
- run:
13+
name: merge pull request base (2nd try)
14+
command: ./.circleci/merge_pr.sh
15+
when: on_fail
16+
- run:
17+
name: merge pull request base (3nd try)
18+
command: ./.circleci/merge_pr.sh
19+
when: on_fail
20+
- restore_cache:
21+
keys:
22+
- cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
23+
- run:
24+
name: install dependencies
25+
command: pip install --user tox
26+
- run:
27+
name: setup env variables
28+
command: |
29+
echo 'export REDIS_URL=redis://localhost:6379' >> $BASH_ENV
30+
echo 'export DATABASE_URL=postgres://postgres@localhost/func_sig_registry' >> $BASH_ENV
31+
- run:
32+
name: Waiting for Postgres to be ready
33+
command: |
34+
if [[ -z "${POSTGRES_USER}" ]]; then
35+
echo No need for Postgres && exit 0
36+
fi
37+
for i in `seq 1 10`;
38+
do
39+
nc -z localhost 5432 && echo Success && exit 0
40+
echo -n .
41+
sleep 1
42+
done
43+
echo Failed waiting for Postgres && exit 1
44+
- run:
45+
name: run tox
46+
command: ~/.local/bin/tox -r
47+
- save_cache:
48+
paths:
49+
- .hypothesis
50+
- .tox
51+
- ~/.cache/pip
52+
- ~/.local
53+
- ./eggs
54+
key: cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
55+
56+
jobs:
57+
flake8:
58+
<<: *common
59+
docker:
60+
- image: circleci/python:3.6
61+
environment:
62+
TOXENV: flake8
63+
py36-django19:
64+
<<: *common
65+
docker:
66+
- image: circleci/python:3.6
67+
environment:
68+
TOXENV: py36-django19
69+
- image: circleci/postgres:9.6.2-alpine
70+
environment:
71+
POSTGRES_USER: postgres
72+
POSTGRES_DB: func_sig_registry
73+
workflows:
74+
version: 2
75+
test:
76+
jobs:
77+
- flake8
78+
- py36-django19

.circleci/merge_pr.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
4+
PR_INFO_URL=https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER
5+
PR_BASE_BRANCH=$(curl -L "$PR_INFO_URL" | python -c 'import json, sys; obj = json.load(sys.stdin); sys.stdout.write(obj["base"]["ref"])')
6+
git fetch origin +"$PR_BASE_BRANCH":circleci/pr-base
7+
# We need these config values or git complains when creating the
8+
# merge commit
9+
git config --global user.name "Circle CI"
10+
git config --global user.email "circleci@example.com"
11+
git merge --no-edit circleci/pr-base
12+
fi

.travis.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

setup.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
from setuptools import (
4+
setup,
5+
find_packages,
6+
)
7+
8+
extras_require = {
9+
'py36-django19': [
10+
"pytest==5.4.1",
11+
"pytest-xdist",
12+
"tox==3.14.6",
13+
],
14+
'flake8': [
15+
"flake8==3.7.9",
16+
"isort>=4.2.15,<5",
17+
"mypy==0.770",
18+
"pydocstyle>=3.0.0,<4",
19+
]
20+
}
21+
22+
extras_require['dev'] = (
23+
extras_require['dev'] + # noqa: W504
24+
extras_require['py36-django19'] + # noqa: W504
25+
extras_require['flake8']
26+
)
27+
28+
29+
with open('./README.md') as readme:
30+
long_description = readme.read()
31+
32+
33+
setup(
34+
name='4byte-directory',
35+
# *IMPORTANT*: Don't manually change the version here. Use `make bump`, as described in readme
36+
version='0.1.0-alpha.0',
37+
description="""4byte-directory: Registry of 4byte function, event signatures and \
38+
their human readable counterparts.""",
39+
long_description=long_description,
40+
long_description_content_type='text/markdown',
41+
author='Piper Merriam',
42+
author_email='piper@pipermerriam.com',
43+
url='https://github.com/pipermerriam/ethereum-function-signature-registry',
44+
include_package_data=True,
45+
install_requires=[
46+
"eth-utils>=1,<2",
47+
],
48+
python_requires='>=3.6, <4',
49+
extras_require=extras_require,
50+
py_modules=[''],
51+
license="MIT",
52+
zip_safe=False,
53+
keywords='ethereum',
54+
packages=find_packages(exclude=["tests", "tests.*"]),
55+
classifiers=[
56+
'Development Status :: 3 - Alpha',
57+
'Intended Audience :: Developers',
58+
'License :: OSI Approved :: MIT License',
59+
'Natural Language :: English',
60+
'Programming Language :: Python :: 3.6',
61+
],
62+
)

0 commit comments

Comments
 (0)