-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (57 loc) · 2.51 KB
/
workflowTestingAndDeploy.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
name: Continuos Integration -Testing, Build and Deploy Backend Catalog Microservice to AWS ECS
on:
pull_request:
push:
branches:
- main
env:
# Setting an environment variable with the value of a configuration variable
ECR_BACKEND_IMAGE: ${{ secrets.ECR_BACKEND_IMAGE }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
ECS_CLUSTER: ${{ secrets.ECS_CLUSTER }}
ECS_BACKEND_SERVICE: ${{ secrets.ECS_BACKEND_SERVICE }}
jobs:
continuos-integration:
name: Continuos Integration - Testing and Deploy
runs-on: ubuntu-latest
environment: production-catalog-microservice
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
uses: actions/setup-python@v5
with:
python-version: '3.12.X'
- name: Install dependencies with poetry
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Install libs for testing
run: |
poetry install
- name: Run tests unit - Backend Catalog Microservice
run: |
poetry run pytest
# - name: Configure AWS credentials to login to ECR
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
# - name: Login to Amazon ECR with Docker
# run: |
# aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
# - name: Build and push Docker image to Amazon ECR
# run: |
# docker buildx create --use
# docker buildx inspect --bootstrap
# docker buildx build --platform linux/amd64 -t ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$ECR_BACKEND_IMAGE:latest --push .
# - name: Deploy to ECS Backend Catalog Microservice
# uses: imehedi/actions-awscli-v2@latest
# with:
# args: ecs update-service --cluster ${{ secrets.ECS_CLUSTER }} --service ${{ secrets.ECS_BACKEND_SERVICE }} --force-new-deployment
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}