From 8a818d2ad9270486ff0be97e24d0e149a0f1b1ff Mon Sep 17 00:00:00 2001 From: Elshindr Date: Tue, 9 Jun 2026 17:51:01 +0200 Subject: [PATCH 01/11] test ci --- .github/workflows/ci.yml | 2 +- api.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2564db..45f02f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: branches: [main, develop] push: branches: - - 'feature/**' + - '*' jobs: test-api: diff --git a/api.py b/api.py index 736ecdf..bd75737 100644 --- a/api.py +++ b/api.py @@ -34,7 +34,7 @@ def connect_mysql(): with open("lightfm_model_hist.pkl", "rb") as f: model = pickle.load(f) -with open("models/dataset.pkl", "rb") as f: +with open("dataset.pkl", "rb") as f: dataset = pickle.load(f) print("Modèle LightFM et dataset chargés avec succès") From 1240a982f805c1e71dba95cbc088d686893d6e46 Mon Sep 17 00:00:00 2001 From: Elshindr Date: Tue, 9 Jun 2026 17:54:57 +0200 Subject: [PATCH 02/11] test ci conda --- .github/workflows/ci.yml | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 45f02f6..66ab724 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,17 +15,38 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.10" + # Installer Miniconda + - name: Installer Miniconda + run: | + wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh + bash miniconda.sh -b -p $HOME/miniconda + echo "$HOME/miniconda/bin" >> $GITHUB_PATH + + # Configurer l'environnement Conda + - name: Configurer Conda + run: | + conda update -y conda + conda create -y -n lightfm_env python=3.10 + conda init bash + echo "conda activate lightfm_env" >> $GITHUB_ENV - - name: Installer les dépendances + # Installer lightfm via Conda + - name: Installer lightfm run: | - pip install fastapi uvicorn pymysql pandas numpy \ - lightfm pytest httpx python-dotenv + source $HOME/miniconda/bin/activate lightfm_env + conda install -y -c conda-forge lightfm + # Installer les autres dépendances via pip + - name: Installer les dépendances Python + run: | + source $HOME/miniconda/bin/activate lightfm_env + pip install fastapi uvicorn pymysql pandas numpy httpx==0.25.0 python-dotenv pytest + + # Lancer les tests - name: Lancer les tests - run: pytest tests/ -v + run: | + source $HOME/miniconda/bin/activate lightfm_env + pytest tests/ -v env: MYSQL_HOST: ${{ secrets.MYSQL_HOST }} MYSQL_USER: ${{ secrets.MYSQL_USER }} From 49f484683c4f560b2aca178281a0c80953ef5b9e Mon Sep 17 00:00:00 2001 From: Elshindr Date: Tue, 9 Jun 2026 17:59:37 +0200 Subject: [PATCH 03/11] test ci --- .github/workflows/ci.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66ab724..6632ad0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,20 +33,17 @@ jobs: # Installer lightfm via Conda - name: Installer lightfm run: | - source $HOME/miniconda/bin/activate lightfm_env - conda install -y -c conda-forge lightfm + conda run -n lightfm_env conda install -y -c conda-forge lightfm # Installer les autres dépendances via pip - name: Installer les dépendances Python run: | - source $HOME/miniconda/bin/activate lightfm_env - pip install fastapi uvicorn pymysql pandas numpy httpx==0.25.0 python-dotenv pytest + conda run -n lightfm_env pip install fastapi uvicorn pymysql pandas numpy httpx==0.25.0 python-dotenv pytest # Lancer les tests - name: Lancer les tests run: | - source $HOME/miniconda/bin/activate lightfm_env - pytest tests/ -v + conda run -n lightfm_env pytest tests/ -v env: MYSQL_HOST: ${{ secrets.MYSQL_HOST }} MYSQL_USER: ${{ secrets.MYSQL_USER }} From 7bc183766fc3e28f6ddfbd62d61739746b7af9a5 Mon Sep 17 00:00:00 2001 From: Elshindr Date: Tue, 9 Jun 2026 18:03:23 +0200 Subject: [PATCH 04/11] tests ci --- .github/workflows/ci.yml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6632ad0..a99c006 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,25 +22,18 @@ jobs: bash miniconda.sh -b -p $HOME/miniconda echo "$HOME/miniconda/bin" >> $GITHUB_PATH - # Configurer l'environnement Conda - - name: Configurer Conda + # Créer l'environnement Conda et installer lightfm + - name: Configurer Conda et installer lightfm run: | - conda update -y conda conda create -y -n lightfm_env python=3.10 - conda init bash - echo "conda activate lightfm_env" >> $GITHUB_ENV + conda install -y -n lightfm_env -c conda-forge lightfm - # Installer lightfm via Conda - - name: Installer lightfm - run: | - conda run -n lightfm_env conda install -y -c conda-forge lightfm - - # Installer les autres dépendances via pip + # Installer les dépendances Python via pip dans l'environnement Conda - name: Installer les dépendances Python run: | conda run -n lightfm_env pip install fastapi uvicorn pymysql pandas numpy httpx==0.25.0 python-dotenv pytest - # Lancer les tests + # Lancer les tests dans l'environnement Conda - name: Lancer les tests run: | conda run -n lightfm_env pytest tests/ -v From 3308fbe8ed325285e49ad0602091c98015526cbc Mon Sep 17 00:00:00 2001 From: Elshindr Date: Tue, 9 Jun 2026 18:06:48 +0200 Subject: [PATCH 05/11] folder ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a99c006..b51e57f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: # Lancer les tests dans l'environnement Conda - name: Lancer les tests run: | - conda run -n lightfm_env pytest tests/ -v + conda run -n lightfm_env pytest tests_api/ -v env: MYSQL_HOST: ${{ secrets.MYSQL_HOST }} MYSQL_USER: ${{ secrets.MYSQL_USER }} From ff60d54561395487ed97395f050e2e3427de2f11 Mon Sep 17 00:00:00 2001 From: Elshindr Date: Tue, 9 Jun 2026 18:08:25 +0200 Subject: [PATCH 06/11] ci haversine --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b51e57f..4fb9a89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: # Installer les dépendances Python via pip dans l'environnement Conda - name: Installer les dépendances Python run: | - conda run -n lightfm_env pip install fastapi uvicorn pymysql pandas numpy httpx==0.25.0 python-dotenv pytest + conda run -n lightfm_env pip install fastapi uvicorn pymysql pandas numpy httpx==0.25.0 python-dotenv pytest haversine # Lancer les tests dans l'environnement Conda - name: Lancer les tests From 01ff0d5f41d119bfee38acb684fa1bb271bea81d Mon Sep 17 00:00:00 2001 From: Elshindr Date: Tue, 9 Jun 2026 18:25:27 +0200 Subject: [PATCH 07/11] chargement dataset error --- api.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/api.py b/api.py index bd75737..9a7d112 100644 --- a/api.py +++ b/api.py @@ -34,8 +34,14 @@ def connect_mysql(): with open("lightfm_model_hist.pkl", "rb") as f: model = pickle.load(f) -with open("dataset.pkl", "rb") as f: - dataset = pickle.load(f) +dataset = None +try: + + with open("dataset.pkl", "rb") as f: + dataset = pickle.load(f) +except : + with open("models/dataset.pkl", "rb") as f: + dataset = pickle.load(f) print("Modèle LightFM et dataset chargés avec succès") From a7dfcd4dea75dc069416124d80df5a234e2c642c Mon Sep 17 00:00:00 2001 From: Elshindr Date: Tue, 9 Jun 2026 18:31:32 +0200 Subject: [PATCH 08/11] ci import --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fb9a89..ea717e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,8 +25,8 @@ jobs: # Créer l'environnement Conda et installer lightfm - name: Configurer Conda et installer lightfm run: | - conda create -y -n lightfm_env python=3.10 - conda install -y -n lightfm_env -c conda-forge lightfm + conda create -y -n lightfm_env python=3.9 + conda install -y -n lightfm_env -c conda-forge lightfm numpy scipy tqdm pymysql pandas # Installer les dépendances Python via pip dans l'environnement Conda - name: Installer les dépendances Python From 5345366651465e414c0c91f9a5f1406042e0c880 Mon Sep 17 00:00:00 2001 From: Elshindr Date: Tue, 9 Jun 2026 18:34:36 +0200 Subject: [PATCH 09/11] fix import ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea717e0..53c0d47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: - name: Configurer Conda et installer lightfm run: | conda create -y -n lightfm_env python=3.9 - conda install -y -n lightfm_env -c conda-forge lightfm numpy scipy tqdm pymysql pandas + conda install -y -n lightfm_env -c conda-forge lightfm numpy scipy tqdm pymysql pandas scikit-learn # Installer les dépendances Python via pip dans l'environnement Conda - name: Installer les dépendances Python From d0ae24c5b53ce9c49c0c8964e430945eacc5698f Mon Sep 17 00:00:00 2001 From: Elshindr Date: Tue, 9 Jun 2026 18:49:16 +0200 Subject: [PATCH 10/11] debug ci container --- .github/workflows/ci.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53c0d47..125b307 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,6 @@ jobs: name: Build Docker Images runs-on: ubuntu-latest needs: test-api - strategy: matrix: include: @@ -63,6 +62,15 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Debug matrix + run: | + echo "SERVICE=${{ matrix.service }}" + echo "DOCKERFILE=${{ matrix.dockerfile }}" + - name: Debug repository + run: | + pwd + ls -la + find . -type f | sort - name: Build ${{ matrix.service }} uses: docker/build-push-action@v5 From 714217494a433632a5aa22634771b2fab54370d9 Mon Sep 17 00:00:00 2001 From: Elshindr Date: Tue, 9 Jun 2026 18:55:02 +0200 Subject: [PATCH 11/11] ci test --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 125b307..6cebd32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: build-images: name: Build Docker Images runs-on: ubuntu-latest - needs: test-api + #needs: test-api strategy: matrix: include: @@ -76,6 +76,6 @@ jobs: uses: docker/build-push-action@v5 with: context: . - dockerfile: ${{ matrix.dockerfile }} + file: ${{ matrix.dockerfile }} push: false tags: ${{ matrix.service }}:test \ No newline at end of file