Add MongoCollection (#87) #245
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: Python package | |
| on: | |
| push: | |
| branches: [ master, v3 ] | |
| pull_request: | |
| branches: [ master, v3 ] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.13'] | |
| steps: | |
| - name: Check out the code | |
| uses: actions/checkout@v3 | |
| - name: Set up uv | |
| uses: hynek/setup-cached-uv@v2 | |
| with: | |
| cache-dependency-path: uv.lock | |
| - name: Pin Python version | |
| run: uv python pin ${{ matrix.python-version }} | |
| - name: Sync dependencies | |
| run: uv sync | |
| - name: Lint check | |
| run: uvx ruff check | |
| - name: Check formatting | |
| run: uvx ruff format --check | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| settings: | |
| - python: '3.13' | |
| coverage: false | |
| steps: | |
| - name: Check out the code | |
| uses: actions/checkout@v3 | |
| - name: Set up uv | |
| uses: hynek/setup-cached-uv@v2 | |
| with: | |
| cache-dependency-path: uv.lock | |
| - name: Install Podman | |
| uses: gacts/[email protected] | |
| - name: Install Hatch | |
| run: | | |
| python3 -m pip install --upgrade pip | |
| python3 -m pip install hatch | |
| echo "HATCH_UV=$(which uv)" >>$GITHUB_ENV | |
| - name: Pin Python version | |
| run: uv python pin ${{ matrix.settings.python }} | |
| - name: Sync dependencies | |
| run: uv sync | |
| - name: Setup mongo | |
| run: hatch run mongo:start | |
| - name: Test with pytest | |
| if: ${{ !matrix.settings.coverage }} | |
| run: uv run pytest tests/ | |
| - name: Test with pytest and coverage | |
| if: ${{ matrix.settings.coverage }} | |
| run: uv run pytest --cov=src --cov-report term-missing tests/ | |
| - name: Verify coverage | |
| if: ${{ matrix.settings.coverage }} | |
| run: uv run coverage report | tail -1 | egrep "TOTAL +[0-9]+ +0 +100%" | |
| - name: Stop mongo | |
| if: always() | |
| run: hatch run mongo:remove |