@@ -23,49 +23,60 @@ jobs:
2323 run : |
2424 python -m pip install --upgrade pip
2525 pip install -r requirements.txt
26- pip install pytest httpx uvicorn
26+ pip install "dvc[gdrive]" pytest httpx uvicorn
2727
28- # NEW: Download trained model from previous job
29- - name : Download trained model artifact
30- uses : actions/download-artifact@v4
31- with :
32- name : trained-model
33- path : data/models/
28+ # ---- DVC CONFIG ----
29+ - name : Create Google Drive Service Account JSON
30+ env :
31+ GCP_SA_KEY : ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
32+ run : |
33+ echo "$GCP_SA_KEY" > service_account.json
34+
35+ - name : Configure DVC remote
36+ run : |
37+ dvc remote modify storage gdrive_use_service_account true
38+ dvc remote modify storage gdrive_service_account_json_file_path service_account.json
3439
35- - name : Verify model exists
40+ - name : Pull latest model from Google Drive
3641 run : |
37- ls -R data/ models/
42+ dvc pull -v models/word2vec_godfather.model.dvc
3843
39- - name : Verify model loads
44+ # ---- MODEL CHECK ----
45+ - name : Verify model loads correctly
4046 run : |
4147 python -c "
4248 from gensim.models import Word2Vec
4349 import src.config as config
4450 model = Word2Vec.load(str(config.MODEL_FILE))
45- print('✓ Model loaded successfully ')
51+ print('✓ Model loaded:', len(model.wv), 'words ')
4652 "
4753
54+ # ---- RUN FASTAPI ----
4855 - name : Start FastAPI server
4956 run : |
5057 uvicorn src.fastapi_app:app --host 0.0.0.0 --port 8000 &
5158 sleep 5
5259
60+ # ---- BASIC CURL TESTS ----
5361 - name : Test health endpoint
5462 run : curl -f http://localhost:8000/health
5563
5664 - name : Test similar words endpoint
57- run : curl -f http://localhost:8000/similar/godfather?topn=3
65+ run : curl -f " http://localhost:8000/similar/godfather?topn=3"
5866
5967 - name : Test similarity endpoint
6068 run : curl -f "http://localhost:8000/similarity?w1=godfather&w2=family"
6169
6270 - name : Test vocabulary endpoint
6371 run : curl -f http://localhost:8000/vocabulary
6472
73+ # ---- PYTEST ----
6574 - name : Run pytest
6675 run : pytest tests/test_api.py -v
6776
77+ # ---- CLEANUP ----
6878 - name : Cleanup
6979 if : always()
7080 run : |
7181 pkill -f uvicorn || true
82+ rm -f service_account.json
0 commit comments