Update workflow.yaml #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |