Added unit test and codequality stage #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: recommendation-service-ci | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| paths: | |
| - '.github/workflows/recommendation.yaml' | |
| - 'src/recommendation/**' | |
| jobs: | |
| unit-testing: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: 3.11 | |
| - name: Install dependencies | |
| run: | | |
| cd src/recommendation | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run unit tests | |
| working-directory: ./src/recommendation | |
| run: | | |
| python3 -m unittest discover -s . -p "test_recommendation_service.py" | |
| code-quality: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: 3.11 | |
| - name: Install dependencies | |
| run: | | |
| cd src/recommendation | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run flake8 (code quality check) | |
| working-directory: ./src/recommendation | |
| run: | | |
| flake8 . --max-line-length=100 --exclude=demo_pb2.py,demo_pb2_grpc.py,venv | |
| continue-on-error: true | |