Skip to content

Commit

Permalink
Merge pull request #1 from loadsmart/github-actions
Browse files Browse the repository at this point in the history
GitHub actions
  • Loading branch information
marlontrapp authored Jul 29, 2021
2 parents f31795d + f434be5 commit 8edffdc
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 1 deletion.
37 changes: 37 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9]

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: |
make venv
- name: Lint
run: |
make lint
- name: Test
run: |
make tox-with-system-python
- name: Build
run: |
make build
35 changes: 35 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
make venv
- name: Build package
run: make build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PYTHON_BIN = .venv/bin/
.PHONY: clean clean-build clean-pyc lint tests test-all build

.venv/bin/activate:
$(PYTHON) -m virtualenv .venv
$(PYTHON) -m venv .venv

venv: .venv/bin/activate
$(PYTHON_BIN)pip install -e '.[dev]'
Expand All @@ -30,6 +30,9 @@ test:
test-all:
$(PYTHON_BIN)tox

tox-with-system-python:
$(PYTHON_BIN)tox -e py

build:
$(PYTHON_BIN)python setup.py build
$(PYTHON_BIN)python setup.py install
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
install_requires=[
'django',
'djangorestframework',
'django-picklefield',
'django-constance>=2,<3',
'django-waffle>=2,<3',
],
Expand Down

0 comments on commit 8edffdc

Please sign in to comment.