diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md new file mode 100644 index 00000000..71a10480 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -0,0 +1,35 @@ +--- +name: 'Bug Report' +about: Report a bug +--- + +# Bug Report + +## Description + + A clear and concise description of the problem... + +## Is this a regression? + + + Yes, the previous version in which this bug was not present was: ... + +## Minimal Reproduction + +```code + +``` + +## Stack trace / Error message + +```code + +``` + + + +## Your Environment + +```code + +``` diff --git a/.github/ISSUE_TEMPLATE/feature.md b/.github/ISSUE_TEMPLATE/feature.md new file mode 100644 index 00000000..0551e461 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.md @@ -0,0 +1,18 @@ +--- +name: 'Feature Request' +about: Suggest a feature +--- + +# Feature Request + +## Description + + A clear and concise description of the problem or missing capability... + +## Describe the solution you'd like + + If you have a solution in mind, please describe it. + +## Describe alternatives you've considered + + Have you considered any alternative solutions or workarounds? diff --git a/.github/PULL_REQUEST_TEMPLATE/general.md b/.github/PULL_REQUEST_TEMPLATE/general.md new file mode 100644 index 00000000..e0d0d026 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/general.md @@ -0,0 +1,31 @@ +# PR Checklist + +Please check if your PR fulfills the following requirements: + +- [ ] The commit message follows our contributing guidelines +- [ ] Tests for the changes have been added (for bug fixes / features) +- [ ] Docs have been added / updated (for bug fixes / features) + +## PR Type + +What kind of change does this PR introduce? + +- [ ] Bugfix +- [ ] Feature +- [ ] Code style update +- [ ] Refactoring (no functional changes) +- [ ] Build related changes +- [ ] CI related changes +- [ ] Documentation content changes +- [ ] Other + +## What is the current behavior? + +## What is the new behavior? + +## Does this PR introduce a breaking change? + +- [ ] Yes +- [ ] No + +## Other information diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..8d37121e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,36 @@ +name: Publish + +on: + push: + tags: + - "v*.*.*" + +jobs: + publish: + name: Publish the package on pypi + runs-on: ubuntu-latest + steps: + - name: Checkout the source code + uses: actions/checkout@v2 + + - name: Set the python version + uses: actions/setup-python@v2 + + # This is the version of python used to package the code. The unit + # tests will have run against python 3.6, 3.7 etc ensuring + # compatibility with those runtimes. + # https://github.com/axnsan12/drf-yasg/pull/741#discussion_r713297594 + with: + python-version: 3.8 + + - name: Install pip dependencies + run: pip install -r requirements/publish.txt + + - name: Build the distributions + run: python setup.py sdist bdist_wheel + + - name: Publish the package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml new file mode 100644 index 00000000..d03495c0 --- /dev/null +++ b/.github/workflows/review.yml @@ -0,0 +1,33 @@ +name: Review + +on: [push, pull_request] + +jobs: + review: + name: Run linters and tests + runs-on: ubuntu-latest + strategy: + matrix: + python: [3.6, 3.7, 3.8, 3.9] + + steps: + - name: Set up pip package caching + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: ${{ runner.os }}-pip- + + - name: Checkout the source code + uses: actions/checkout@v2 + + - name: Set the python version + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + + - name: Install pip dependencies + run: pip install -r requirements/ci.txt + + - name: Run unit tests + run: tox diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index db3fd242..00000000 --- a/.travis.yml +++ /dev/null @@ -1,70 +0,0 @@ -language: python -python: - - '3.6' - - '3.7' - - '3.8' - - '3.9' - -dist: focal - -cache: pip - -matrix: - include: - - python: '3.8' - env: TOXENV=docs - - python: '3.9' - env: TOXENV=djmaster - - python: '3.8' - env: TOXENV=lint - - - stage: publish - python: '3.8' - before_script: - # workaround for Travis' inability to build PEP517 projects; anything added to build-system.requires - # will also have to be added here until Travis implements this - - pip install setuptools-scm - script: skip - env: PYPI_DEPLOY=true - deploy: &pypi - provider: pypi - user: cvijdea - password: - secure: 54DvknusZ7uHlo9IJxgbNDVKYrwaScyuOZyAGZPb/PTUj8WroQZtp1bFOrAtzfcM4ctIIoLWVzmSwrxypmU4hNif2ZvJ8Vo2PnVh9G6wQ2fD2FN+kFBYczBNrzW5xhjJ53OiTYy/zzHgzxC/sp+hB4sibWl0v69PGU5v6oyBltOWZLXYpqMA6fINt62XDVwuNHVKAo1T/yoeJMQKeCKYAx8QOtve9/qcl5Td/OOM6z42hX5+q3N7RgkCFLl0KopwaPwBaL1Z3Bn+aUhiIUdrRrdigY329QtNXoa/VRBNvUSAwbvecShmgl3c9HigL2ZWmtmHaXda6YCdqmbVfSHSEDsn4AwhZ3A9WblbRtuBwP79YKiE+4BLmgLlGGA4IrAKr3woe+078q/bGqBzmeDd+jt72hhibzD5B96zo4tSNksSxSJGwMYH988fBN/ppynrzRvO0sR/THwpb0r42era8tRd3ZVBefloVas/nQZZs4+zMYoO0fbaLDXdkfaxsF5/X6WkwTYjbI3tdapUT6lYXwi1eKUM1ZGsfKpuq0lFa3qxevYBKveWStQwGyJz1KhVUHbo3OrA3U6q9yoqpzhcZBhzGAPSgumi+EkBUj69cymlYkmqXVBn4VnWsdeFefNYE6Kvh/HJEDPDaWSNgfVLN9xWVqJqM7QiWA351W9dRZA= - on: - tags: true - distributions: "sdist bdist_wheel" - - allow_failures: - - env: TOXENV=lint - - env: TOXENV=djmaster - - fast_finish: true - -install: - - python -m pip install -U pip setuptools - - pip install -r requirements/ci.txt - -before_script: - - coverage erase - -script: - - tox - -after_success: - - | - if [[ -z "$TOXENV" && -z "$PYPI_DEPLOY" ]]; then - coverage combine || true - coverage report - codecov - fi - -stages: - - test - - name: publish - if: tag IS present - -notifications: - email: - on_success: always - on_failure: always diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 499d32f5..ec6e92dd 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -93,7 +93,7 @@ You want to contribute some code? Great! Here are a few steps to get you started Incomplete/Work In Progress pull requests are encouraged, because they allow you to get feedback and help more easily. -#. **Your code must pass all the required travis jobs before it is merged** +#. **Your code must pass all the required CI jobs before it is merged** As of now, this consists of running on the supported Python, Django, DRF version matrix (see README), and building the docs succesfully. @@ -108,13 +108,13 @@ Release checklist * update ``docs/changelog.rst`` with changes since the last tagged version * commit & tag the release - ``git tag x.x.x -m "Release version x.x.x"`` * push using ``git push --follow-tags`` -* verify that `Travis`_ has built the tag and succesfully published the release to `PyPI`_ +* verify that `Actions`_ has built the tag and successfully published the release to `PyPI`_ * publish release notes `on GitHub`_ * start the `ReadTheDocs build`_ if it has not already started * deploy the live demo `on Heroku`_ -.. _Travis: https://travis-ci.org/axnsan12/drf-yasg/builds +.. _Actions: https://github.com/axnsan12/drf-yasg/actions .. _PyPI: https://pypi.org/project/drf-yasg/ .. _on GitHub: https://github.com/axnsan12/drf-yasg/releases .. _ReadTheDocs build: https://readthedocs.org/projects/drf-yasg/builds/ diff --git a/README.rst b/README.rst index a55b123c..36b9b6a8 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ drf-yasg - Yet another Swagger generator ######################################## -|travis| |nbsp| |codecov| |nbsp| |rtd-badge| |nbsp| |pypi-version| +|actions| |nbsp| |codecov| |nbsp| |rtd-badge| |nbsp| |pypi-version| Generate **real** Swagger/OpenAPI 2.0 specifications from a Django Rest Framework API. @@ -98,7 +98,7 @@ Usage 0. Installation =============== -The preferred instalation method is directly from pypi: +The preferred installation method is directly from pypi: .. code:: console @@ -335,9 +335,9 @@ djangorestframework-recursive Integration with `djangorestframework-recursive `_ is provided out of the box - if you have ``djangorestframework-recursive`` installed. -.. |travis| image:: https://img.shields.io/travis/axnsan12/drf-yasg/master.svg - :target: https://travis-ci.org/axnsan12/drf-yasg - :alt: Travis CI +.. |actions| image:: https://img.shields.io/github/workflow/status/axnsan12/drf-yasg/Review + :target: https://github.com/axnsan12/drf-yasg/actions + :alt: GitHub Workflow Status .. |codecov| image:: https://img.shields.io/codecov/c/github/axnsan12/drf-yasg/master.svg :target: https://codecov.io/gh/axnsan12/drf-yasg diff --git a/docs/conf.py b/docs/conf.py index 4d006bb0..f3b72e1e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -321,4 +321,4 @@ def role_github_pull_request_or_issue(name, rawtext, text, lineno, inliner, opti def setup(app): - app.add_stylesheet('css/style.css') + app.add_css_file('css/style.css') diff --git a/requirements/base.txt b/requirements/base.txt index 2ca5a52c..79c2f3f7 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,9 +1,9 @@ coreapi>=2.3.3 coreschema>=0.0.4 +djangorestframework>=3.10.3 +django>=2.2.16 ruamel.yaml>=0.15.34 inflection>=0.3.1 +packaging>=21.0 +pytz>=2021.1 uritemplate>=3.0.0 -packaging - -djangorestframework>=3.10.3 -Django>=2.2.16 diff --git a/requirements/ci.txt b/requirements/ci.txt index 351828de..ce6ec29e 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -1,5 +1,4 @@ # requirements for the CI test runner -tox-travis>=0.10 codecov>=2.0.9 -r tox.txt diff --git a/requirements/publish.txt b/requirements/publish.txt new file mode 100644 index 00000000..9006a710 --- /dev/null +++ b/requirements/publish.txt @@ -0,0 +1 @@ +wheel>=0.37.0 \ No newline at end of file diff --git a/setup.py b/setup.py index 7900914a..39f70b5d 100755 --- a/setup.py +++ b/setup.py @@ -85,8 +85,8 @@ def drf_yasg_setup(**kwargs): drf_yasg_setup(use_scm_version=True) except (ImportError, LookupError) as e: - if os.getenv('CI', 'false') == 'true' or os.getenv('TRAVIS', 'false') == 'true': - # don't silently fail on travis - we don't want to accidentally push a dummy version to PyPI + if os.getenv('CI', 'false') == 'true': + # don't silently fail on CI - we don't want to accidentally push a dummy version to PyPI raise err_msg = str(e) diff --git a/tox.ini b/tox.ini index 80c12c04..37ceb169 100644 --- a/tox.ini +++ b/tox.ini @@ -6,19 +6,25 @@ isolated_build_env = .package # https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django envlist = py{36,37,38,39}-django{22,30}-drf{310,311,312}, - py{36,37,38,39}-django31-drf{311,312}, - djmaster, lint, docs + py{36,37,38,39}-django{31,32}-drf{311,312}, + py38-{lint, docs}, + py39-djmaster + skip_missing_interpreters = true [testenv:.package] # no additional dependencies besides PEP 517 deps = +[testenv:py39-djmaster] +ignore_outcome = true + [testenv] deps = django22: Django>=2.2,<2.3 django30: Django>=3.0,<3.1 django31: Django>=3.1,<3.2 + django32: Django>=3.2,<3.3 drf310: djangorestframework>=3.10,<3.11 drf311: djangorestframework>=3.11,<3.12 @@ -28,8 +34,7 @@ deps = # test with the latest builds of Django and django-rest-framework # to get early warning of compatibility issues - djmaster: https://github.com/django/django/archive/master.tar.gz - djmaster: https://github.com/ottoyiu/django-cors-headers/archive/master.tar.gz + djmaster: https://github.com/django/django/archive/main.tar.gz djmaster: https://github.com/encode/django-rest-framework/archive/master.tar.gz # other dependencies