Skip to content

Merge pull request #6 from healthy-food-and-dietary-products/feature/… #6

Merge pull request #6 from healthy-food-and-dietary-products/feature/…

Merge pull request #6 from healthy-food-and-dietary-products/feature/… #6

name: healthy_food workflow
on:
push:
pull_request:
jobs:
flake8_and_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.6.1
virtualenvs-create: false
- name: Install dependencies
run: |
poetry install --no-interaction --no-root
- name: Test with flake8
run: |
python -m flake8
# - name: Test with pytest
# run: |
# pytest
build_and_push_to_docker_hub:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
needs: flake8_and_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 backend to Docker Hub
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/healthy_food:v.01
send_message:
runs-on: ubuntu-latest
needs: build_and_push_to_docker_hub
steps:
- name: send message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
${{ github.workflow }} completed successfully!
Repository: ${{ github.repository }}.
Branch name: ${{ github.ref_name }}.
Commit author: ${{ github.actor }}.
Commit message: ${{ github.event.commits[0].message }}.
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}