diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c37d343 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +name: Python CI + +on: + push: + branches: [master] + pull_request: + branches: + - '**' + +jobs: + run_tests: + name: Tests + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04] + python-version: ['3.8'] + toxenv: [django22, django30, django31, django32, quality, docs, pii_check] + + steps: + - uses: actions/checkout@v2 + - name: setup python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install pip + run: pip install -r requirements/pip.txt + + - name: Install Dependencies + run: pip install -r requirements/ci.txt + + - name: Run Tests + env: + TOXENV: ${{ matrix.toxenv }} + run: tox + + - name: Run Coverage + if: matrix.python-version == '3.8' && matrix.toxenv=='django22' + uses: codecov/codecov-action@v1 + with: + flags: unittests + fail_ci_if_error: true \ No newline at end of file diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml new file mode 100644 index 0000000..8ac5119 --- /dev/null +++ b/.github/workflows/pypi-publish.yml @@ -0,0 +1,33 @@ +name: Publish package to PyPi + +on: + release: + types: [published] + +jobs: + + push: + runs-on: ubuntu-20.04 + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: setup python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install pip + run: pip install -r requirements/pip.txt + + - name: Install Dependencies + run: pip install setuptools wheel + + - name: Build package + run: python setup.py sdist bdist_wheel + + - name: Publish to PyPi + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_UPLOAD_TOKEN }} \ No newline at end of file diff --git a/Makefile b/Makefile index 6e10cc3..43fbdd1 100644 --- a/Makefile +++ b/Makefile @@ -42,12 +42,13 @@ upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in pip install -qr requirements/pip-tools.txt # Make sure to compile files after any other files they include! + pip-compile --rebuild --upgrade --allow-unsafe -o requirements/pip.txt requirements/pip.in pip-compile --rebuild --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in pip-compile --rebuild --upgrade -o requirements/base.txt requirements/base.in pip-compile --rebuild --upgrade -o requirements/test.txt requirements/test.in pip-compile --rebuild --upgrade -o requirements/doc.txt requirements/doc.in pip-compile --rebuild --upgrade -o requirements/quality.txt requirements/quality.in - pip-compile --rebuild --upgrade -o requirements/travis.txt requirements/travis.in + pip-compile --rebuild --upgrade -o requirements/ci.txt requirements/ci.in pip-compile --rebuild --upgrade -o requirements/dev.txt requirements/dev.in # Let tox control the Django version for tests sed '/^[dD]jango==/d' requirements/test.txt > requirements/test.tmp @@ -60,6 +61,7 @@ pii_check: ## check for PII annotations on all Django models tox -e pii_check requirements: ## install development environment requirements + pip install -qr requirements/pip.txt pip install -qr requirements/pip-tools.txt pip-sync requirements/dev.txt requirements/private.* diff --git a/requirements/ci.in b/requirements/ci.in new file mode 100644 index 0000000..06a74e8 --- /dev/null +++ b/requirements/ci.in @@ -0,0 +1,7 @@ +# Requirements for running tests in Github Actions + +-c constraints.txt + +codecov # Code coverage reporting +tox # Virtualenv management for tests +tox-battery # Makes tox aware of requirements file changes diff --git a/requirements/ci.txt b/requirements/ci.txt new file mode 100644 index 0000000..336c1d7 --- /dev/null +++ b/requirements/ci.txt @@ -0,0 +1,52 @@ +# +# This file is autogenerated by pip-compile with python 3.8 +# To update, run: +# +# pip-compile --output-file=requirements/ci.txt requirements/ci.in +# +backports.entry-points-selectable==1.1.0 + # via virtualenv +certifi==2021.5.30 + # via requests +charset-normalizer==2.0.4 + # via requests +codecov==2.1.12 + # via -r requirements/ci.in +coverage==5.5 + # via codecov +distlib==0.3.2 + # via virtualenv +filelock==3.0.12 + # via + # tox + # virtualenv +idna==3.2 + # via requests +packaging==21.0 + # via tox +platformdirs==2.2.0 + # via virtualenv +pluggy==0.13.1 + # via tox +py==1.10.0 + # via tox +pyparsing==2.4.7 + # via packaging +requests==2.26.0 + # via codecov +six==1.16.0 + # via + # tox + # virtualenv +toml==0.10.2 + # via tox +tox==3.24.1 + # via + # -r requirements/ci.in + # tox-battery +tox-battery==0.6.1 + # via -r requirements/ci.in +urllib3==1.26.6 + # via requests +virtualenv==20.7.2 + # via tox diff --git a/requirements/pip.in b/requirements/pip.in new file mode 100644 index 0000000..7b68e86 --- /dev/null +++ b/requirements/pip.in @@ -0,0 +1,5 @@ +# Core dependencies for installing other packages + +pip +setuptools +wheel \ No newline at end of file diff --git a/requirements/pip.txt b/requirements/pip.txt new file mode 100644 index 0000000..5827e49 --- /dev/null +++ b/requirements/pip.txt @@ -0,0 +1,14 @@ +# +# This file is autogenerated by pip-compile with python 3.8 +# To update, run: +# +# pip-compile --allow-unsafe --output-file=requirements/pip.txt requirements/pip.in +# +wheel==0.37.0 + # via -r requirements/pip.in + +# The following packages are considered to be unsafe in a requirements file: +pip==21.2.4 + # via -r requirements/pip.in +setuptools==57.4.0 + # via -r requirements/pip.in