Add support for PyMongo Async and N+1 Dereference/select_related using Pipeline #712
Workflow file for this run
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: MongoengineCI | |
| on: | |
| # All PRs | |
| pull_request: | |
| # All branch pushes (runs linting, tests, doc build on every push) | |
| push: | |
| # Manual trigger from Action page | |
| workflow_dispatch: | |
| # release tags | |
| create: | |
| tags: | |
| - 'v[0-9]+\.[0-9]+\.[0-9]+*' | |
| # Cancel in-progress runs when a new workflow run is triggered | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| MAIN_PYTHON_VERSION: "3.14" | |
| jobs: | |
| linting: | |
| # Run pre-commit (https://pre-commit.com/) | |
| # which runs pre-configured linter & autoformatter | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "pyproject.toml" | |
| - name: Install Dependencies for lint | |
| run: uv sync --only-group dev | |
| - name: Run pre-commit | |
| run: uv run pre-commit run -a | |
| test: | |
| # Test suite runs against recent python versions | |
| # and against a few combinations of MongoDB and pymongo | |
| name: "test (Python ${{ matrix.python-version }}, MongoDB ${{ matrix.mongodb-version }}, PyMongo ${{ matrix.pymongo-version }})" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ] | |
| mongodb-version: [ "4.4", "5.0", "6.0", "7.0", "8.0", "8.3" ] | |
| pymongo-version: [ "4.14", "4.15", "4.16", "4.17" ] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv and set the Python version ${{ matrix.python-version }} | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| enable-cache: true | |
| cache-dependency-glob: "pyproject.toml" | |
| - name: Start MongoDB | |
| uses: supercharge/mongodb-github-action@1.12.1 | |
| with: | |
| mongodb-version: ${{ matrix.mongodb-version }} | |
| mongodb-replica-set: mongoengine | |
| - name: Cache tox environments | |
| uses: actions/cache@v4 | |
| with: | |
| path: .tox | |
| key: tox-${{ matrix.python-version }}-mg${{ matrix.pymongo-version }}-${{ hashFiles('pyproject.toml', 'tox.ini') }} | |
| restore-keys: | | |
| tox-${{ matrix.python-version }}-mg${{ matrix.pymongo-version }}- | |
| - name: Install Dependencies | |
| run: uv sync --only-group test | |
| - name: Run test suite | |
| run: | | |
| env="py$(echo "${{ matrix.python-version }}" | tr -d . )-mg$(echo "${{ matrix.pymongo-version }}" | tr -d . )" | |
| echo "Running tox environment: $env" | |
| uv run tox run -e "$env" -- "--cov=mongoengine --cov-report=" | |
| uv run coverage combine | |
| uv run coverage report | |
| # - name: Send coverage to Coveralls | |
| # env: | |
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # COVERALLS_SERVICE_NAME: GitHub | |
| # run: uv run coveralls | |
| build_doc_dryrun: | |
| # ensures that readthedocs can be built continuously | |
| # to avoid that it breaks when new releases are being created | |
| # The way RTD works is that it builds the doc on its side | |
| # builds are visible at https://readthedocs.org/projects/mongoengine-odm/builds/ | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv and set the Python version ${{ env.MAIN_PYTHON_VERSION }} | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| with: | |
| python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
| enable-cache: true | |
| cache-dependency-glob: "pyproject.toml" | |
| - name: Install python dependencies | |
| run: uv sync --only-group docs | |
| - name: Build documentation | |
| run: | | |
| cd docs | |
| make html-readthedocs | |
| build-release: | |
| runs-on: ubuntu-latest | |
| needs: [ linting, test, build_doc_dryrun ] | |
| if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv and set the Python version ${{ env.MAIN_PYTHON_VERSION }} | |
| uses: astral-sh/setup-uv@v8.1.0 | |
| with: | |
| python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
| enable-cache: true | |
| cache-dependency-glob: "pyproject.toml" | |
| - name: Build wheel and sdist for release | |
| run: uv build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| publish-to-pypi: | |
| runs-on: ubuntu-latest | |
| needs: [ build-release ] | |
| if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| id-token: write # Required for trusted publishing | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.pypi_token }} |