Skip to content

Commit

Permalink
Refactor project (#1)
Browse files Browse the repository at this point in the history
* feat: update project
  • Loading branch information
avara1986 authored Nov 10, 2020
1 parent 3980bd9 commit b7239e9
Show file tree
Hide file tree
Showing 59 changed files with 3,045 additions and 2,010 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Fixes # [refer the issue number]

Changes proposed in this PR:
- [Updated X functionality]
- [Refactor X class]
48 changes: 48 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv
pipenv install --dev --system
- name: Test with pytest
run: |
python setup.py test
- name: Run mypy
continue-on-error: true
run: |
mypy consulate
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 consulate --show-source --statistics
- name: Lint with pylint
run: |
pylint --rcfile=pylintrc consulate
- name: Security safety
run: |
safety check
- name: Security bandit
run: |
bandit -r consulate/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ cover
docs/_build
MANIFEST
venv
htmlcov
88 changes: 14 additions & 74 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,18 @@
sudo: required

services:
- docker

language: python

env:
global:
- PATH=$HOME/.local/bin:$PATH
- AWS_DEFAULT_REGION=us-east-1
- secure: "GxBrm8hKFLazshbB3c+rQUQYHAim/rm8KtBXz6uNWRvsccAK6otc5Wcz01kj679d9C9L3I/G6/wCxfgglQp3YMGKlLT+jHQpOMdDauEdeKvaUuPh3hDQBPSAUhIpycgxz9AghdWqOQGkpQQqNW9UZRC42SW2eIyWFIlQf6W31Vc="
- secure: "YdDXZGAOp1WZenhfZnHhL9cOeUQbvZZOr8FWWJoJz3EdTbf6jE2UuK4HU6CgoYDpfFlc7geah2xARr/2rkN716Rz4ZzeHBtNXfwqqQRWRLkB8J73Nowmm+6J+skv6meJyCHtcHalpv7pAH5QPn3zMK2EAogdcDJmd5GSVBjwPoo="

stages:
- test
- name: upload coverage
- name: deploy
if: tag IS present

python:
- "3.8"
install:
- pip install awscli
- pip install -r requires/testing.txt
- python setup.py develop

before_script:
- ./bootstrap
- source build/test-environment

script: nosetests

- python -m pip install --upgrade pip
- pip install --upgrade setuptools coveralls pipenv
- pipenv lock --dev --requirements > requirements.txt
- pip install -r requirements.txt
script:
- coverage erase
- python setup.py test
after_success:
- aws s3 cp .coverage "s3://com-gavinroy-travis/consulate/$TRAVIS_BUILD_NUMBER/.coverage.${TRAVIS_PYTHON_VERSION}"
- coverage combine
- coveralls

jobs:
include:
- python: 2.7
- python: 3.4
- python: 3.5
- python: 3.6
- python: pypy
- python: pypy3
- stage: upload coverage
if: repo IS gmr/consulate
sudo: false
services: []
python: 3.6
install:
- pip install awscli coverage codecov
before_script: true
script:
- mkdir coverage
- aws s3 cp --recursive s3://com-gavinroy-travis/consulate/$TRAVIS_BUILD_NUMBER/
coverage
- cd coverage
- coverage combine
- cd ..
- mv coverage/.coverage .
- coverage report
after_success: codecov
- stage: deploy
sudo: false
if: repo IS gmr/consulate
python: 3.6
services: []
install: true
before_script: true
script: true
after_success: true
deploy:
distributions: sdist bdist_wheel
provider: pypi
user: crad
on:
tags: true
all_branches: true
password:
secure: "W3mHi2tzX34KcN82tdVPZwS0RHBGkI2Cy/df18ehsVKoOzWzQvaQKh2Jh1LIBOvdZCyih+KltmMNT8ounqUd+ql6kBFd0kotQk3C3x5R5KlpbhQ4BNKp++grs+iycPwK6qnJISypt2d3ykJNgqUgfBI0p+7XVpMkBY0GIXGNcvk="
notifications:
email:
- [email protected]
59 changes: 1 addition & 58 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,3 @@
# Contributing

## Test Coverage

To contribute to Consulate, please make sure that any new features or changes
to existing functionality **include test coverage**.

*Pull requests that add or change code without coverage have a much lower chance
of being accepted.*

## Prerequisites

Consulate test suite has a couple of requirements:

* Dependencies from [requires/testing.txt](requires/testing.txt) are installed
* Local Docker and [docker-compose](https://docs.docker.com/compose/)

## Installing Dependencies

You may want to develop in a virtual environment. This is usually done inside the source
repository, and `.gitignore` is configured to ignore a virtual environment in `env`.

```bash
python3 -m venv env
source env/bin/activate
```

To install the dependencies needed to run Consulate tests, use

```bash
pip install -r requires/testing.txt
```

## Starting the test dependency

Prior to running tests, ensure that Consul is running via Docker using:

```bash
./bootstrap
```

This script uses [docker-compose](https://docs.docker.com/compose/) to launch a Consul server container that is
pre-configured for the tests. In addition, it configures `build/test-environment` that is loaded
by the tests with configuration information for connecting to Consul.

## Running Tests

To run all test suites, run:

nosetests

## Code Formatting

Please format your code using [yapf](http://pypi.python.org/pypi/yapf)
with ``pep8`` style prior to issuing your pull request. In addition, run
``flake8`` to look for any style errors prior to submitting your PR.

Both are included when the test requirements are installed. If you are fixing
formatting for existing code, please separate code-reformatting commits from
functionality changes.
See this [webpage](https://python-microservices.github.io/contributing/)
13 changes: 13 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
py-ms-consulate = {editable = true,extras = ["tests"],path = "."}

[packages]
py-ms-consulate = {editable = true, extras = ["unixsocket"],path = "."}

[pipenv]
allow_prereleases = true
Loading

0 comments on commit b7239e9

Please sign in to comment.