diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cc7d8b2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c768dc1..0000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: python -sudo: false -python: - - 3.6 - - 3.7 - - 3.8 - - 3.9 -env: - - DJANGO="django>=3.2.0,<3.3" - - DJANGO="django>=3.1.0,<3.2" - - DJANGO="django>=3.0.0,<3.1" - - DJANGO="django>=2.2.0,<3.0" - - DJANGO="django>=2.1.0,<2.2.0" - - DJANGO="django>=2.0.0,<2.1.0" -matrix: - include: - - python: 3.7 - dist: xenial - sudo: true - -install: - - travis_retry pip install pep8==1.7.0 - - travis_retry pip install -e . - - travis_retry pip install $DJANGO --upgrade -script: - - python setup.py test -after_script: - # ensure we validate against pep standards - - 'pep8 --exclude=migrations --ignore=E501,E225,W293 stream' diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..55de737 --- /dev/null +++ b/Makefile @@ -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 \` where 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 diff --git a/setup.py b/setup.py index a361b40..2803a80 100644 --- a/setup.py +++ b/setup.py @@ -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",