Skip to content

Commit

Permalink
add GitHub Actions (#3)
Browse files Browse the repository at this point in the history
* test with actions

* add GitHub Actions
  • Loading branch information
Edmaroff authored Apr 10, 2024
1 parent 074cbb7 commit 801d3d7
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 3 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Linting and Testing

on:
push:
branches: [main, dev]
pull_request:
branches: [main]

jobs:
tests:
runs-on: ubuntu-22.04
env:
SECRET_KEY: ${{ secrets.SECRET_KEY }}
DEBUG: ${{ secrets.DEBUG }}
ALLOWED_HOSTS: ${{ secrets.ALLOWED_HOSTS }}
POSTGRES_ENGINE: ${{ secrets.POSTGRES_ENGINE }}
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_HOST: ${{ secrets.POSTGRES_HOST }}
POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }}
services:
postgesql_main:
image: postgres:12
env:
POSTGRES_DB: ${{ env.POSTGRES_DB}}
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
ports:
- 5432:5432
options:
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 5

steps:
- name: Проверка репозитория на изменения
uses: actions/checkout@v4

- name: Установка python
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Установка зависимостей
working-directory: ./retail_order_api
run: pip install -r requirements.txt

- name: Линтинг
working-directory: ./retail_order_api
run: flake8

- name: Тестирование
working-directory: ./retail_order_api
run: pytest -v --cov=. --cov-report lcov:./lcov.info

- name: Coveralls
uses: coverallsapp/[email protected]
with:
base-path: ./retail_order_api
file: ./retail_order_api/lcov.info
github-token: ${{ secrets.GITHUB_TOKEN }}

env:
SECRET_KEY: ${{ env.SECRET_KEY }}
DEBUG: ${{ env.DEBUG }}
ALLOWED_HOSTS: ${{ env.ALLOWED_HOSTS }}
POSTGRES_ENGINE: ${{ env.POSTGRES_ENGINE }}
POSTGRES_DB: ${{ env.POSTGRES_DB }}
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_HOST: ${{ env.POSTGRES_HOST}}
POSTGRES_PORT: ${{ env.POSTGRES_PORT }}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<a href="https://github.com/Edmaroff/retail-order-api/actions/workflows/actions.yml"><img src="https://github.com/Edmaroff/retail-order-api/actions/workflows/actions.yml/badge.svg?" alt="GitHub Actions"/></a>
<a href='https://coveralls.io/github/Edmaroff/retail-order-api?'><img src='https://coveralls.io/repos/github/Edmaroff/retail-order-api/badge.svg?branch=dev' alt='Coverage Status' /></a>
<a href="https://documenter.getpostman.com/view/25907870/2s9Ykn92Za"><img src="https://img.shields.io/badge/API docs-latest-blue.svg" alt="API Docs"/></a>
<img src="https://img.shields.io/badge/python-3.12-blue" alt="Python version"/>
<img src="https://img.shields.io/badge/django-5.0-blue" alt="Django Version"/>
<img src="https://img.shields.io/badge/Django%20REST%20framework-3.15-blue" alt="Django REST Framework Version"/>

<h1>API Сервис заказа товаров для розничных сетей</h1>

<hr>
Expand Down
Binary file modified retail_order_api/requirements.txt
Binary file not shown.
3 changes: 0 additions & 3 deletions retail_order_api/tests/backend/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,6 @@ def test_filter_products_by_product_name(
self.assert_response(response, expected_product_info_ids)


# -----------------------------------------------------


@pytest.mark.django_db
class TestBuyerBasketView:
"""Тесты для BuyerBasketView."""
Expand Down

0 comments on commit 801d3d7

Please sign in to comment.