From 9f748b695a8ccb6c626e8e93b49d3745191818b5 Mon Sep 17 00:00:00 2001 From: Angel Dijoux <77701490+Angel-Dijoux@users.noreply.github.com> Date: Thu, 2 Nov 2023 20:58:00 +0100 Subject: [PATCH] chore(workflow): update deployement workflow. (#14) * modified: .gitignore * chore: update workflow. * fix: flake8 error. * fix: last mistake --- .github/workflows/deployment.yml | 30 +++++++++++-------- .gitignore | 5 +++- src/blueprints/formations.py | 2 +- .../formation/scrap/get_formation.py | 2 +- src/models/formation.py | 2 -- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 8d0685e..e876930 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -1,31 +1,35 @@ name: Deployment on: + workflow_call: push: branches: - main paths-ignore: - - '.github/**' - - '.vscode/**' + - ".github/**" + - ".vscode/**" env: MARIADB_ROOT_PASSWORD: ${{ secrets.MARIADB_ROOT_PASSWORD }} DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }} DATABASE_USERNAME: ${{ secrets.DATABASE_USERNAME }} SECRET_KEY: ${{ secrets.SECRET_KEY }} + ONISEP_EMAIL: ${{ secrets.ONISEP_EMAIL }} + ONISEP_PASSWORD: ${{ secrets.ONISEP_PASSWORD }} + ONISEP_APP_ID: ${{ secrets.ONISEP_APP_ID }} jobs: build: runs-on: self-hosted - + steps: - - name: Checkout code - uses: actions/checkout@v3 - - name: Stop running Docker container - run: docker stop api - - name: remove container - run: docker rm api - - name: Remove previous Docker image - run: docker rmi onisep_api-api:latest - - name: Build and Run Docker container - run: docker-compose up -d + - name: Checkout code + uses: actions/checkout@v3 + - name: Stop running Docker container + run: docker stop api + - name: remove container + run: docker rm api + - name: Remove previous Docker image + run: docker rmi onisep_api-api:latest + - name: Build and Run Docker container + run: docker-compose up -d diff --git a/.gitignore b/.gitignore index 44acee0..161259f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,7 @@ __pycache__/ .env #Ignore db local file -*.db \ No newline at end of file +*.db + +# Ignore Bruno directory for now +/Onisep \ No newline at end of file diff --git a/src/blueprints/formations.py b/src/blueprints/formations.py index c4fc726..517043f 100644 --- a/src/blueprints/formations.py +++ b/src/blueprints/formations.py @@ -2,7 +2,7 @@ from typing import Any, Tuple from flask import Blueprint, Response, request -from flask_jwt_extended import get_jwt_identity, jwt_required +from flask_jwt_extended import jwt_required from werkzeug.exceptions import HTTPException from src.blueprints.route_handler import HttpMethod, route_handler diff --git a/src/business_logic/formation/scrap/get_formation.py b/src/business_logic/formation/scrap/get_formation.py index a55ac55..1829888 100644 --- a/src/business_logic/formation/scrap/get_formation.py +++ b/src/business_logic/formation/scrap/get_formation.py @@ -1,6 +1,6 @@ import requests + from src.business_logic.formation import HEADERS, ONISEP_URL -from src.business_logic.formation.scrap.get_onisep_token import get_token from src.business_logic.formation.scrap.types import ( Facet, SearchedFormations, diff --git a/src/models/formation.py b/src/models/formation.py index 9f0d52c..93ab532 100644 --- a/src/models/formation.py +++ b/src/models/formation.py @@ -1,5 +1,3 @@ -from dataclasses import dataclass -from typing import Optional import uuid from sqlalchemy import Text