Made tests for auth-service and document-service #48
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: Monorepo Tests & SonarCloud | |
| on: | |
| push: | |
| branches: [main, Development] | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| jobs: | |
| test-and-analyze: | |
| name: Run Tests & SonarCloud Analysis | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.13'] | |
| steps: | |
| - name: π§Ύ Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: π Setup Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: π¦ Install global test dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pytest pytest-cov coverage | |
| - name: π Install service dependencies | |
| working-directory: ./backend/api | |
| run: | | |
| for service in */; do | |
| if [ -f "${service}requirements.txt" ]; then | |
| echo "Installing requirements for $service" | |
| pip install -r "${service}requirements.txt" | |
| fi | |
| done | |
| - name: π§ͺ Run tests with coverage | |
| working-directory: ./backend/api | |
| run: | | |
| SERVICES=$(find . -maxdepth 1 -type d -name "*_service" -exec basename {} \;) | |
| COV_ARGS="" | |
| for service in $SERVICES; do | |
| COV_ARGS="$COV_ARGS --cov=$service" | |
| done | |
| pytest $COV_ARGS --cov-report=xml $(find . -type d -name "tests") | |
| - name: π Move coverage report to root | |
| run: mv ./backend/api/coverage.xml ./coverage.xml | |
| - name: π SonarCloud Analysis | |
| uses: SonarSource/sonarcloud-github-action@v2 | |
| with: | |
| projectBaseDir: . | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |