-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ANXOS-171: Extend worflows and adapt module, reformat and extend tests
- Loading branch information
Showing
16 changed files
with
329 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Publish package | ||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.8' | ||
architecture: 'x64' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: Build source and binary distribution package | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
env: | ||
PACKAGE_VERSION: ${{ github.ref }} | ||
|
||
- name: Check distribution package | ||
run: | | ||
twine check dist/* | ||
- name: Publish distribution package | ||
run: | | ||
twine upload dist/* | ||
env: | ||
TWINE_REPOSITORY: ${{ secrets.PYPI_REPOSITORY }} | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
TWINE_NON_INTERACTIVE: yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Run linter and tests | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: | ||
- "3.7" | ||
- "3.8" | ||
- "3.9" | ||
- "3.10" | ||
django-version: | ||
- "3.2" | ||
- "4.0" | ||
drf-version: | ||
- "3.12" | ||
- "3.13" | ||
exclude: | ||
- python-version: "3.7" | ||
django-version: "4.0" | ||
- drf-version: "3.12" | ||
django-version: "4.0" | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install codecov black | ||
- name: Lint with black | ||
run: black ./drf_ip_restrictions ./tests --check | ||
|
||
- name: Install Django version | ||
run: | | ||
python -m pip install "Django==${{ matrix.django-version }}.*" | ||
- name: Install DRF version | ||
run: | | ||
python -m pip install "djangorestframework==${{ matrix.drf-version }}.*" | ||
- name: Python, Django and DRF versions | ||
run: | | ||
echo "Python ${{ matrix.python-version }} -> Django ${{ matrix.django-version }} -> DRF ${{ matrix.drf-version }}" | ||
python --version | ||
echo "Django: `django-admin --version`" | ||
echo "DRF: `pip show djangorestframework|grep Version|sed s/Version:\ //`" | ||
- name: Setup environment | ||
run: | | ||
pip install -e . | ||
- name: Run tests | ||
run: | | ||
# prepare Django project: link all necessary data from the test project into the root directory | ||
# Hint: Simply changing the directory does not work (leads to missing files in coverage report) | ||
ln -s ./tests/testapp testapp | ||
ln -s ./tests/core core | ||
ln -s ./tests/manage.py manage.py | ||
# run tests with coverage | ||
coverage run --source='./drf_ip_restrictions' manage.py test | ||
coverage report | ||
coverage xml | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
## [1.0.0] - 2022-06-22 | ||
### Added | ||
- Initial implementation | ||
- Unit tests | ||
|
||
[Unreleased]: https://github.com/anexia/drf-ip-restrictions/compare/1.0.0...HEAD | ||
[1.0.0]: https://github.com/anexia/drf-ip-restrictions/releases/tag/1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Guidance on how to contribute | ||
|
||
> By submitting a pull request or filing a bug, issue, or feature request, | ||
> you are agreeing to comply with this waiver of copyright interest. | ||
> Details can be found in our [LICENSE](LICENSE). | ||
|
||
There are two primary ways to help: | ||
- Using the issue tracker, and | ||
- Changing the code-base. | ||
|
||
|
||
## Using the issue tracker | ||
|
||
Use the issue tracker to suggest feature requests, report bugs, and ask questions. | ||
This is also a great way to connect with the developers of the project as well | ||
as others who are interested in this solution. | ||
|
||
Use the issue tracker to find ways to contribute. Find a bug or a feature, mention in | ||
the issue that you will take on that effort, then follow the _Changing the code-base_ | ||
guidance below. | ||
|
||
|
||
## Changing the code-base | ||
|
||
Generally speaking, you should fork this repository, make changes in your | ||
own fork, and then submit a pull request. All new code should have associated | ||
unit tests that validate implemented features and the presence or lack of defects. | ||
Additionally, the code should follow any stylistic and architectural guidelines | ||
prescribed by the project. In the absence of such guidelines, mimic the styles | ||
and patterns in the existing code-base. | ||
|
||
### Contribution guidelines | ||
- Your code should follow PEP 8 -- Style Guide for Python Code | ||
- Your changes should be covered by unit-tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
description='A library that allows IP restrictions for views/endpoints in Django REST framework.', | ||
long_description=README, | ||
long_description_content_type='text/markdown', | ||
url='https://github.com/anexia-it/drf-ip-restrictions', | ||
url='https://github.com/anexia/drf-ip-restrictions', | ||
author='Alexandra Bruckner', | ||
author_email='[email protected]', | ||
install_requires=[ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.