Skip to content

Commit

Permalink
readjusting to makesure no similar container names
Browse files Browse the repository at this point in the history
  • Loading branch information
kek20009 committed Oct 31, 2024
1 parent 3afe44c commit 8d7e730
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions .github/workflows/ms5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
python-version: ["3.8", "3.9", "3.10"]

steps:
# Checkout code
- uses: actions/checkout@v2 # Updated to correct version
#Checkout code
- uses: actions/checkout@v2 # Updated to correct version

#Set up Python
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -27,28 +27,34 @@ jobs:
python -m pip install --upgrade pip
pip install pylint flask flask_cors flasgger pytest
#Run pylint on all Python files
- name: Analyze code with pylint
#Run pylint on all Python files
- name: Analyze code with pylint, excluding main.py
run: |
pylint $(git ls-files '*.py')
#Build Docker Image for API
- name: Build API Docker Image
run: |
docker build -t api-image -f ./Backend/dockerfile .
docker build -t api-image -f Backend/dockerfile .
#Start Container
# Stop and Remove Existing Container (if any). this was the error
- name: Stop and Remove Existing API Container
run: |
docker stop api-container || true # Stop if running, ignore if not
docker rm api-container || true # Remove if exists, ignore if not
#Start API Container
- name: Start API Container
run: |
docker run -d -p 5000:5000 --name api-container api-image
docker run -d -p 5000:5000 --name api-container api-image # Start container on port 5000
#Start the API Service & Run All Tests
#Run all Python tests in the directory
- name: Run all Python tests in directory
run: |
docker exec api-container pytest $(find . -name 'test_*.py')
docker exec api-container pytest $(find . -name 'test_*.py') # Execute tests in Docker
#End the testing
#Stop and Remove API Container after tests
- name: Stop and Remove API Container
run: |
docker stop api-container
docker rm api-container
docker stop api-container # Stop container after tests
docker rm api-container # Remove container after tests

0 comments on commit 8d7e730

Please sign in to comment.