Skip to content

Commit

Permalink
Merge pull request #1605 from ChildMindInstitute/release/1.6.0
Browse files Browse the repository at this point in the history
Release/1.6.0
  • Loading branch information
ChaconC authored Sep 18, 2024
2 parents bf49879 + 633788d commit 387eec3
Show file tree
Hide file tree
Showing 45 changed files with 2,424 additions and 2,297 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/oasdif.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: OASDIFF breaking changes
on:
pull_request:
branches:
- develop
- main
workflow_call: {}
# pull_request:
# branches:
# - develop
# - main
jobs:
compare:
runs-on: ubuntu-latest
Expand All @@ -25,7 +26,7 @@ jobs:
on-failure:
runs-on: ubuntu-latest
if: ${{ always() && (needs.compare.result == 'failure' || needs.compare.result == 'timed_out') }}
if: ${{ !cancelled() && (needs.compare.result == 'failure' || needs.compare.result == 'timed_out') }}
needs:
- compare
steps:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

name: Build and Deploy
on:
# push: {}
push:
# branches:
# - develop
workflow_dispatch: {}
# pull_request:
# types:
Expand Down Expand Up @@ -95,18 +97,6 @@ jobs:
tags: ${{ steps.sha.outputs.IMAGE_NAME }},${{ env.ECR_REPO }}:latest
platforms: linux/amd64,linux/arm64

# - name: Build image for ECR
# id: build_step
# run: |
# echo "IMAGE_NAME=${ECR_REPO}:${GITHUB_BRANCH_OR_TAG/\//-}-${GITHUB_SHA:0:5}" >> "$GITHUB_OUTPUT"
# docker build -t ${ECR_REPO}:${GITHUB_BRANCH_OR_TAG/\//-}-${GITHUB_SHA:0:5} -f ./compose/fastapi/Dockerfile .
# docker tag ${ECR_REPO}:${GITHUB_BRANCH_OR_TAG/\//-}-${GITHUB_SHA:0:5} ${ECR_ADDRESS}/${ECR_REPO}:${GITHUB_BRANCH_OR_TAG/\//-}-${GITHUB_SHA:0:5}
#
# - name: Push image to ECR
# run: |
# aws ecr get-login-password | docker login --username AWS --password-stdin ${ECR_ADDRESS}
# docker push ${ECR_REPO}:${GITHUB_BRANCH_OR_TAG/\//-}-${GITHUB_SHA:0:5}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -118,7 +108,7 @@ jobs:
deploy_to_dev:
name: Deploy to Dev
needs: build_job
environment: dev
# environment: dev
#if: ${{ github.event.pull_request.merged }}
uses: ./.github/workflows/run_deploy_dev.yaml
with:
Expand Down
110 changes: 59 additions & 51 deletions .github/workflows/run_deploy_dev.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
name: Deploy to Dev
on:
workflow_dispatch:
inputs:
IMAGE_NAME:
required: true
type: string
description: Image tag

workflow_call:
inputs:
IMAGE_NAME:
Expand All @@ -17,58 +24,59 @@ env:
IMAGE_NAME: ${{ inputs.IMAGE_NAME }}

jobs:
run_migration:
name: Run Database Migrations
runs-on: ubuntu-latest
env:
TASK_DEFINITION: migration
ECS_SERVICE_NAME: migration

steps:
- name: echo IMAGE_NAME
run: |
echo $IMAGE_NAME
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: arn:aws:iam::017925157769:role/cmiml-dev-oidc-github-role
role-session-name: OIDC-GHA-session
aws-region: ${{ env.AWS_REGION }}

- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition ${{ env.TASK_DEFINITION }} --query taskDefinition > task-definition.json
- name: Render Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: mind_logger
image: ${{ inputs.IMAGE_NAME }}

- name: Update Task Definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}

- name: Run migration container
id: run-task
uses: geekcell/[email protected]
with:
cluster: ${{ env.ECS_CLUSTER_NAME }}
task-definition: ${{ env.TASK_DEFINITION }}
subnet-ids: subnet-02b7cfd48947b31ef
security-group-ids: sg-0976f7b2b2b5bf411
override-container-command: |
/bin/sh
-c
/fastapi-migrate all
# run_migration:
# environment: dev
# name: Run Database Migrations
# runs-on: ubuntu-latest
# env:
# TASK_DEFINITION: migration
# ECS_SERVICE_NAME: migration
#
# steps:
# - name: echo IMAGE_NAME
# run: |
# echo $IMAGE_NAME
#
# - name: configure aws credentials
# uses: aws-actions/configure-aws-credentials@v3
# with:
# role-to-assume: arn:aws:iam::017925157769:role/cmiml-dev-oidc-github-role
# role-session-name: OIDC-GHA-session
# aws-region: ${{ env.AWS_REGION }}
#
# - name: Download task definition
# run: |
# aws ecs describe-task-definition --task-definition ${{ env.TASK_DEFINITION }} --query taskDefinition > task-definition.json
#
# - name: Render Amazon ECS task definition
# id: task-def
# uses: aws-actions/amazon-ecs-render-task-definition@v1
# with:
# task-definition: task-definition.json
# container-name: mind_logger
# image: ${{ inputs.IMAGE_NAME }}
#
# - name: Update Task Definition
# uses: aws-actions/amazon-ecs-deploy-task-definition@v1
# with:
# task-definition: ${{ steps.task-def.outputs.task-definition }}
#
# - name: Run migration container
# id: run-task
# uses: geekcell/github-action-aws-ecs-run-task@v4
# with:
# cluster: ${{ env.ECS_CLUSTER_NAME }}
# task-definition: ${{ env.TASK_DEFINITION }}
# subnet-ids: subnet-02b7cfd48947b31ef
# security-group-ids: sg-0976f7b2b2b5bf411
# override-container-command: |
# /bin/sh
# -c
# /fastapi-migrate all

deploy_to_ecs:
runs-on: ubuntu-latest
needs: run_migration
# needs: run_migration

name: Deploy ${{ matrix.apps.name }}
strategy:
Expand Down Expand Up @@ -127,7 +135,7 @@ jobs:

on-failure:
runs-on: ubuntu-latest
if: ${{ always() && (needs.deploy_to_ecs.result == 'failure' || needs.deploy_to_ecs.result == 'timed_out') }}
if: ${{ !cancelled() && (needs.deploy_to_ecs.result == 'failure' || needs.deploy_to_ecs.result == 'timed_out') }}
needs:
- deploy_to_ecs
steps:
Expand All @@ -144,7 +152,7 @@ jobs:

on-success:
runs-on: ubuntu-latest
if: ${{ always() && (needs.deploy_to_ecs.result == 'success') }}
if: ${{ !cancelled() && (needs.deploy_to_ecs.result == 'success') }}
needs:
- deploy_to_ecs
steps:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# VSCode
.vscode/

allure-results/


## Python stuff
Expand Down
123 changes: 61 additions & 62 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,90 +4,89 @@ verify_ssl = true
name = "pypi"

[packages]
aioredis = "~=2.0.1"
alembic = "~=1.8.1"
asyncpg = "~=0.29.0"
boto3 = "==1.26.10"
fastapi = "==0.110.0"
redis = "==5.0.8"
alembic = "==1.13.2"
asyncpg = "==0.29.0"
boto3 = "==1.35.16"
fastapi = "==0.110.3"
# The latest version of the fastapi is not taken because of the issue
# with fastapi-mail that requires 0.21 < starlette < 0.22
# starlette version for those deps ==0.21.0
fastapi-mail = "~=1.2.2"
httpx = "~=0.23"
jinja2 = "~=3.1.2"
bcrypt = "==4.0.1"
passlib = {version = "~=1.7.4", extras = ["bcrypt"]}
pyOpenSSL = "~=22.1.0"
pydantic = {extras = ["email"], version = "==1.10.15"}
python-jose = {version = "~=3.3.0", extras = ["cryptography"]}
python-multipart = "~=0.0.5"
sentry-sdk = "~=2.3"
fastapi-mail = "==1.2.9"
httpx = "==0.27.2"
jinja2 = "==3.1.4"
bcrypt = "==4.2.0"
passlib = { version = "==1.7.4", extras = ["bcrypt"] }
pyOpenSSL = "==24.2.1"
pydantic = { extras = ["email"], version = "==1.10.18" }
python-jose = { version = "==3.3.0", extras = ["cryptography"] }
python-multipart = "==0.0.9"
sentry-sdk = "~=2.13"
sqlalchemy = { extras = ["asyncio"], version = "==1.4.53" }
uvicorn = {extras = ["standard"], version = "==0.29.0"}
taskiq = {extras = ["reload"], version = "==0.9.1"}
aiohttp = "==3.9.5"
uvicorn = { extras = ["standard"], version = "==0.30.6" }
taskiq = { extras = ["reload"], version = "==0.11.7" }
aiohttp = "==3.10.5"
firebase-admin = "==6.5.0"
aio-pika = "==9.3.0"
azure-storage-blob = "==12.18.2"
taskiq-fastapi = "==0.3.0"
taskiq-redis = "==0.5.0"
taskiq-aio-pika = "==0.4.0"
sqlalchemy-utils = "==0.41.1"
typer = {extras = ["all"], version = "==0.9.0"}
aiofiles = "==23.2.1"
opentelemetry-api = "==1.24.0"
opentelemetry-distro = "==0.45b0"
opentelemetry-instrumentation = "==0.45b0"
opentelemetry-instrumentation-asgi = "==0.45b0"
opentelemetry-instrumentation-asyncio = "==0.45b0"
opentelemetry-instrumentation-aws-lambda = "==0.45b0"
opentelemetry-instrumentation-dbapi = "==0.45b0"
opentelemetry-instrumentation-fastapi = "==0.45b0"
opentelemetry-instrumentation-logging = "==0.45b0"
opentelemetry-instrumentation-sqlite3 = "==0.45b0"
opentelemetry-instrumentation-tortoiseorm = "==0.45b0"
opentelemetry-instrumentation-urllib = "==0.45b0"
opentelemetry-instrumentation-wsgi = "==0.45b0"
opentelemetry-propagator-aws-xray = "==1.0.1"
opentelemetry-sdk = "==1.24.0"
opentelemetry-semantic-conventions = "==0.45b0"
opentelemetry-test-utils = "==0.45b0"
opentelemetry-util-http = "==0.45b"
opentelemetry-exporter-otlp = "==1.24.0"
opentelemetry-sdk-extension-aws = "==2.0.1"
nh3 = "==0.2.17"
aio-pika = "==9.4.3"
azure-storage-blob = "==12.22.0"
taskiq-fastapi = "==0.3.2"
taskiq-redis = "==1.0.0"
taskiq-aio-pika = "==0.4.1"
sqlalchemy-utils = "==0.41.2"
typer = "==0.12.5"
aiofiles = "==24.1.0"
opentelemetry-api = "==1.27.0"
opentelemetry-sdk = "==1.27.0"
opentelemetry-exporter-otlp = "==1.27.0"
opentelemetry-distro = "==0.48b0"
opentelemetry-instrumentation = "==0.48b0"
opentelemetry-instrumentation-asgi = "==0.48b0"
opentelemetry-instrumentation-asyncio = "==0.48b0"
opentelemetry-instrumentation-dbapi = "==0.48b0"
opentelemetry-instrumentation-fastapi = "==0.48b0"
opentelemetry-instrumentation-logging = "==0.48b0"
opentelemetry-instrumentation-sqlite3 = "==0.48b0"
opentelemetry-instrumentation-tortoiseorm = "==0.48b0"
opentelemetry-instrumentation-urllib = "==0.48b0"
opentelemetry-instrumentation-wsgi = "==0.48b0"
opentelemetry-semantic-conventions = "==0.48b0"
opentelemetry-test-utils = "==0.48b0"
opentelemetry-util-http = "==0.48b0"
opentelemetry-propagator-aws-xray = "==1.0.2"
opentelemetry-sdk-extension-aws = "==2.0.2"
nh3 = "==0.2.18"
pymongo = "*"

[dev-packages]
# Nobody knows for what its needed
ipdb = "~=0.13"
pudb = "~=2022.1"
ipdb = "==0.13.13"
pudb = "==2024.1.2"
# Linters and Formatters
pre-commit = "~=2.7.1"
ruff = "=0.6.2"
pre-commit = "==3.8.0"
ruff = "==0.6.4"
# Tests
allure-pytest = "*"
pydantic-factories = "~=1.17.0"
pytest = "~=7.1"
allure-pytest = "==2.13.5"
pydantic-factories = "==1.17.3"
pytest = "==8.3.3"
pytest-asyncio = "~=0.19"
pytest-cov = "~=3.0"
pytest-env = "~=0.8.1"
pytest-lazy-fixture = "~=0.6"
pytest-mock = "~=3.8"
pytest-cov = "==5.0.0"
pytest-env = "==1.1.4"
pytest-lazy-fixtures = "==1.1.1"
pytest-mock = "==3.14.0"
nest-asyncio = "==1.6.0"
gevent = "~=23.9"
gevent = "==24.2.1"
# MyPy
mypy = "==1.10.0"
mypy = "==1.11.2"
types-passlib = "==1.7.7.20240819"
types-python-dateutil = "==2.9.0.20240821"
types-python-dateutil = "==2.9.0.20240906"
types-python-jose = "==3.3.4.20240106"
typing-extensions = "==4.12.2"
types-requests = "==2.32.0.20240712"
types-pytz = "==2024.1.0.20240417"
types-aiofiles = "==24.1.0.20240626"
types-cachetools = "==5.5.0.20240820"
# https://github.com/sqlalchemy/sqlalchemy/issues/7714
greenlet = "~=2.0.1"
greenlet = "==3.1.0"
# JSONLD deps only for dev
reproschema = "*"
cachetools = "==5.3.0"
Expand Down
Loading

0 comments on commit 387eec3

Please sign in to comment.