From aad7823dd51571c31a8b7bcb17a67394f5d696aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=9C=D0=BE?= =?UTF-8?q?=D1=81=D0=BA=D0=B0=D0=BB=D1=8F=D0=BD=D0=BE=D0=B2?= Date: Wed, 30 Aug 2023 18:15:19 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=20=D0=B2=D0=BE=D1=80=D0=BA=D1=84=D0=BB?= =?UTF-8?q?=D0=BE=D1=83=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=20=D1=88=D0=B0=D0=B3=20=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BE=D0=B1=D1=80=D0=B0=D0=B7=D0=B0=20=D0=B1=D1=8D=D0=BA=D1=8D?= =?UTF-8?q?=D0=BD=D0=B4=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 52 ++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d0c7d86..eb7035b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,40 +29,32 @@ jobs: python -m pip install --upgrade pip pip install flake8==6.0.0 pip install -r ./backend/requirements.txt - - name: Test with flake8 #and django tests - # env: - # POSTGRES_USER: django_user - # POSTGRES_PASSWORD: django_password - # POSTGRES_DB: django_db - # SECRET_KEY: ${{ secrets.SECRET_KEY }} - # DB_HOST: 127.0.0.1 - # DB_PORT: 5432 + - name: Test with flake8 run: | cd backend python -m flake8 - # python manage.py test - # build_backend_and_push_to_docker_hub: - # name: Push Docker image to DockerHub - # runs-on: ubuntu-latest - # needs: tests - # if: github.ref == 'refs/heads/main' - # 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: - # context: ./backend/ - # push: true - # tags: ${{ secrets.DOCKER_USERNAME }}/kittygram_backend:latest + build_backend_and_push_to_docker_hub: + name: Push Docker image to DockerHub + runs-on: ubuntu-latest + needs: tests + if: github.ref == 'refs/heads/main' + 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: + context: ./backend/ + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/foodgram_backend:latest # frontend_tests: # runs-on: ubuntu-latest