Skip to content

Commit

Permalink
Setup CI (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhatelmas authored Aug 12, 2021
1 parent 567c4a5 commit db4ca17
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 32 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: build
on:
push:
branches:
- 'main'
pull_request:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.6, 3.7, 3.8, 3.9]
django:
- 'django>=3.2.0, <3.3'
- 'django>=3.1.0, <3.2'
- 'django>=3.0.0, <3.1'
- 'django>=2.2.0, <3.0'
- 'django>=2.1.0, <2.2.0'
- 'django>=2.0.0, <2.1.0'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}

- name: Add pip bin to PATH
run: |
echo "/home/runner/.local/bin" >> $GITHUB_PATH
- name: Install deps with ${{ matrix.python }}
run: |
pip install ".[test, ci]"
pip install "${{ matrix.django }}" --upgrade
# ignore for now
# - name: Lint with ${{ matrix.python }}
# if: ${{ matrix.python == '3.8' }}
# run: make lint

- name: Install, test and code coverage with ${{ matrix.python }}
run: |
python setup.py install
make test
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
STREAM_KEY ?= NOT_EXIST
STREAM_SECRET ?= NOT_EXIST

.PHONY: help check test lint lint-fix

help: ## Display this help message
@echo "Please use \`make <target>\` where <target> is one of"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; \
{printf "\033[36m%-40s\033[0m %s\n", $$1, $$2}'

lint: ## Run linters
black --check stream
flake8 --ignore=E501,E225,W293,W503,F401 stream_django

lint-fix:
black stream_django

test: ## Run tests
STREAM_KEY=$(STREAM_KEY) STREAM_SECRET=$(STREAM_SECRET) python setup.py test

check: lint test ## Run linters + tests
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

requirements = [django, "stream-python>=3.0.1", "pytz"]

extras_require = {
"test": ["httpretty==1.1.1"],
}
extras_require = {"test": ["httpretty==1.1.1"], "ci": ["black", "flake8", "pytest-cov"]}

setup(
name="stream-django",
Expand Down

0 comments on commit db4ca17

Please sign in to comment.