# Tests and Coverage name: Test on: push: branches: [ main, develop ] pull_request: branches: [ main, develop ] env: POETRY_VERSION: 1.8.0 PYTHON_VERSION: "3.12" jobs: test: name: Run Tests runs-on: ubuntu-latest services: mongodb: image: mongo:7-jammy ports: - 27017:27017 options: >- --health-cmd "mongosh --eval 'db.adminCommand(\"ping\")'" --health-interval 10s --health-timeout 5s --health-retries 5 steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} cache: 'pip' - name: Install Poetry run: | curl -sSL https://install.python-poetry.org | python3 - echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Install dependencies run: | poetry config virtualenvs.in-project true poetry install - name: Run unit tests env: MONGODB_URL: mongodb://localhost:27017 MONGODB_DATABASE: testdb run: | poetry run pytest tests/unit -v --cov --cov-report=xml --cov-report=html - name: Upload coverage uses: codecov/codecov-action@v3 with: files: ./coverage.xml flags: unittests name: codecov-umbrella continue-on-error: true - name: Archive coverage results uses: actions/upload-artifact@v4 with: name: coverage-report path: htmlcov/ continue-on-error: true