diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml new file mode 100644 index 0000000000..2ea74d86a2 --- /dev/null +++ b/.github/workflows/black.yml @@ -0,0 +1,24 @@ +name: Black + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + + - name: Install dependencies + run: | + python -m venv .venv + source .vevn/bin/activate + python -m pip install --upgrade pip + pip install black + + - name: Check code format with black + run: | + source .vevn/bin/activate + black --check . diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml new file mode 100644 index 0000000000..46d62f2ed9 --- /dev/null +++ b/.github/workflows/django.yml @@ -0,0 +1,42 @@ +name: Django CI + +on: + push: + branches: ["master"] + pull_request: + branches: ["master"] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + + - name: Install Dependencies + run: | + python -m venv .venv + source .vevn/bin/activate + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + + - name: Create a Django project and configure settings + run: | + source .vevn/bin/activate + python -m django startproject mysite + mv rest_framework mysite + cd mysite + echo "INSTALLED_APPS += ['rest_framework']" >> mysite/settings.py + echo "from django.urls import include" >> mysite/urls.py + echo "urlpatterns += [path('', include('rest_framework.urls'))]" >> mysite/urls.py + + - name: Run Migrations, System checks and test + run: | + source .vevn/bin/activate + cd mysite + python manage.py migrate + python manage.py check + python manage.py test diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 0000000000..5d749f047b --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,24 @@ +name: Pylint + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + + - name: Install dependencies + run: | + python -m venv .venv + source .vevn/bin/activate + python -m pip install --upgrade pip + pip install pylint + + - name: Analysing the code with pylint + run: | + source .vevn/bin/activate + pylint . diff --git a/README.md b/README.md index be6619b4eb..6f971d23ef 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # [Django REST framework][docs] [![build-status-image]][build-status] +[![django-ci-status-image]][django-ci-status] +[![pylint-status-image]][pylint-status] +[![black-status-image]][black-status] [![coverage-status-image]][codecov] [![pypi-version]][pypi] @@ -181,6 +184,12 @@ Please see the [security policy][security-policy]. [build-status]: https://github.com/encode/django-rest-framework/actions/workflows/main.yml [coverage-status-image]: https://img.shields.io/codecov/c/github/encode/django-rest-framework/master.svg [codecov]: https://codecov.io/github/encode/django-rest-framework?branch=master +[django-ci-status-image]: https://github.com/encode/django-rest-framework/actions/workflows/django.yml/badge.svg +[django-ci-status]: https://github.com/encode/django-rest-framework/actions/workflows/django.yml +[pylint-status-image]: https://github.com/encode/django-rest-framework/actions/workflows/pylint.yml/badge.svg +[pylint-status]: https://github.com/encode/django-rest-framework/actions/workflows/pylint.yml +[black-status-image]: https://github.com/encode/django-rest-framework/actions/workflows/black.yml/badge.svg +[black-status]: https://github.com/encode/django-rest-framework/actions/workflows/black.yml [pypi-version]: https://img.shields.io/pypi/v/djangorestframework.svg [pypi]: https://pypi.org/project/djangorestframework/ [group]: https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework