-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (61 loc) · 1.69 KB
/
workflow.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Workflow
on:
push:
branches:
- main
- dev
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_mini.txt
- name: Check with flake8
env:
SECRET_KEY: ${{ secrets.SECRET_KEY }}
run: python -m flake8 crm_yandex/
- name: Run migrations
env:
SECRET_KEY: ${{ secrets.SECRET_KEY }}
run: |
cd crm_yandex/
python manage.py migrate
- name: Run tests with coverage
run: |
pip install coverage
cd crm_yandex/
python manage.py test
coverage run -m unittest discover
coverage report -m
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: CRM-for-Yandex-ambassadors/backend
build_and_push_to_docker_hub:
name: Push Docker image to DockerHub
runs-on: ubuntu-latest
needs: tests
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to DockerHub
uses: docker/build-push-action@v4
with:
push: true
tags: margoloko/ya_crm_backend:latest