Skip to content

add telegram_bot_service/tests/test_bot.py #2

add telegram_bot_service/tests/test_bot.py

add telegram_bot_service/tests/test_bot.py #2

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov
- name: Run tests
run: |
pytest --cov=./ --cov-report=xml
- name: Upload coverage
uses: codecov/codecov-action@v2
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
gcr.io/${{ secrets.GCP_PROJECT_ID }}/telegram-bot:${{ github.sha }}
gcr.io/${{ secrets.GCP_PROJECT_ID }}/translation-service:${{ github.sha }}
gcr.io/${{ secrets.GCP_PROJECT_ID }}/transport-service:${{ github.sha }}
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: google-github-actions/setup-gcloud@v0
with:
service_account_key: ${{ secrets.GCP_SA_KEY }}
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Deploy to GKE
run: |
gcloud container clusters get-credentials ${{ secrets.GKE_CLUSTER }} --zone ${{ secrets.GKE_ZONE }}
kubectl apply -f k8s/