Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actions #741

Merged
merged 11 commits into from
Sep 22, 2021
Merged
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: 'Bug Report'
about: Report a bug
---

# Bug Report

## Description

<!-- edit: --> A clear and concise description of the problem...

## Is this a regression?

<!-- Did this behavior use to work in the previous version? -->
<!-- edit: --> Yes, the previous version in which this bug was not present was: ...

## Minimal Reproduction

```code

```

## Stack trace / Error message

```code

```

<!-- If the issue is accompanied by an exception or an error, please share it below: -->

## Your Environment

```code

```
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: 'Feature Request'
about: Suggest a feature
---

# Feature Request

## Description

<!-- edit: --> A clear and concise description of the problem or missing capability...

## Describe the solution you'd like

<!-- edit: --> If you have a solution in mind, please describe it.

## Describe alternatives you've considered

<!-- edit: --> Have you considered any alternative solutions or workarounds?
31 changes: 31 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/general.md
Original file line number Diff line number Diff line change
@@ -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
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
33 changes: 33 additions & 0 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
@@ -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
70 changes: 0 additions & 70 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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/
Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -335,9 +335,9 @@ djangorestframework-recursive
Integration with `djangorestframework-recursive <https://github.com/heywbj/django-rest-framework-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
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
8 changes: 4 additions & 4 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion requirements/ci.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# requirements for the CI test runner
tox-travis>=0.10
codecov>=2.0.9

-r tox.txt
1 change: 1 addition & 0 deletions requirements/publish.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wheel>=0.37.0
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 9 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down