Skip to content
Snippets Groups Projects
Commit c7a3ae13 authored by Hafiz, Aqib (PG/T - Comp Sci & Elec Eng)'s avatar Hafiz, Aqib (PG/T - Comp Sci & Elec Eng)
Browse files

Update .gitlab-ci.yml file

parent 450121af
No related branches found
No related tags found
No related merge requests found
Pipeline #72626 failed
stages: # List of stages for jobs, and their order of execution stages:
- build - train
- test - test
- deploy - deploy
build-job: # This job runs in the build stage, which runs first. variables:
stage: build MODEL_PATH: "distilbert-finetuned-ner"
script:
- echo "Compiling the code..." before_script:
- echo "Compile complete." # Ensure the required Python version and pip are set up
- apt-get update && apt-get install -y python3 python3-pip
- python3 -m pip install --upgrade pip
- pip3 install -r requirements.txt
unit-test-job: # This job runs in the test stage. train:
stage: test # It only starts when the job in the build stage completes successfully. stage: train
script: script:
- echo "Running unit tests... This will take about 60 seconds." - python3 train_model.py
- echo "Code coverage is 90%" artifacts:
paths:
- $MODEL_PATH # Save the trained model as an artifact
lint-test-job: # This job also runs in the test stage. test:
stage: test # It can run at the same time as unit-test-job (in parallel). stage: test
script: script:
- echo "Linting code... This will take about 10 seconds." - echo "Testing the model..."
- echo "No lint issues found." # Ensure Flask is installed
- pip3 install flask
# Run the Flask app in the background
- nohup python3 app.py &
- sleep 10 # Wait for the server to start
# Run the tests
- curl -X POST http://localhost:5003/predict -H "Content-Type: application/json" -d '{"tokens": ["For", "this", "purpose", "the", "Gothenburg", "Young", "Persons", "Empowerment", "Scale", "(", "GYPES", ")", "was", "developed", "."]}'
- curl -X POST http://localhost:5003/stress_test -H "Content-Type: application/json" -d '{"tokens": ["For", "this", "purpose", "the", "Gothenburg", "Young", "Persons", "Empowerment", "Scale", "(", "GYPES", ")", "was", "developed", "."]}'
- curl -X POST http://localhost:5003/run_stress_test -H "Content-Type: application/json" -d '{"num_requests": 50}'
- curl -X GET http://localhost:5003/get_latest_results
dependencies:
- train
deploy-job: # This job runs in the deploy stage. deploy:
stage: deploy # It only runs when *both* jobs in the test stage complete successfully. stage: deploy
environment: production
script: script:
- echo "Deploying application..." - echo "Deploying model..."
- echo "Application successfully deployed." # Deployment steps go here, for example, uploading the model to a server
dependencies:
- train
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment