Update README.md #15
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: Run Pytest Suite | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| mongo: | |
| image: mongo:6.0 | |
| ports: | |
| - 27017:27017 | |
| options: >- | |
| --health-cmd="mongosh --eval 'db.runCommand({ ping: 1 })'" | |
| --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: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m venv venv | |
| source venv/bin/activate | |
| pip install -r requirements.txt | |
| pip install -r requirements-dev.txt | |
| pip install pytest-cov codecov | |
| - name: Set MongoDB URI | |
| run: echo "MONGODB_URI=mongodb://localhost:27017/testdb" >> $GITHUB_ENV | |
| - name: Run tests with coverage | |
| run: | | |
| source venv/bin/activate | |
| pytest --cov=. --cov-report=xml --disable-warnings --tb=short | |
| - name: Upload coverage to Codecov | |
| if: always() | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| fail_ci_if_error: false | |
| branch: main |