Add types #606
Workflow file for this run
This file contains 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 PR | |
pull_request: | |
# master branch merge | |
push: | |
branches: | |
- master | |
# Manual trigger from Action page | |
workflow_dispatch: | |
# release tags | |
create: | |
tags: | |
- 'v[0-9]+\.[0-9]+\.[0-9]+*' | |
env: | |
MONGODB_3_6: 3.6.23 | |
MONGODB_4_0: 4.0.28 | |
MONGODB_4_4: 4.4 | |
MONGODB_5_0: "5.0" | |
MONGODB_6_0: "6.0" | |
MONGODB_7_0: "7.0" | |
PYMONGO_3_11: 3.11 | |
PYMONGO_3_12: 3.12 | |
PYMONGO_3_13: 3.13 | |
PYMONGO_4_0: 4.0 | |
PYMONGO_4_3: 4.3.3 | |
PYMONGO_4_4: 4.4.1 | |
PYMONGO_4_6: 4.6.2 | |
PYMONGO_4_7: 4.7.3 | |
PYMONGO_4_8: 4.8.0 | |
PYMONGO_4_9: 4.9 | |
MAIN_PYTHON_VERSION: 3.9 | |
MONGOSH: 2.2.15 # Needed for MongoDB 6.0+ | |
jobs: | |
linting: | |
# Run pre-commit (https://pre-commit.com/) | |
# which runs pre-configured linter & autoformatter | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
check-latest: true | |
- run: bash .github/workflows/install_ci_python_dep.sh | |
- run: pre-commit run -a | |
type-check: | |
# Can be moved to pre-commit, separate step for now. | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
check-latest: true | |
- run: bash .github/workflows/install_ci_python_typing_deps.sh | |
- run: mypy mongoengine tests | |
test: | |
# Test suite run against recent python versions | |
# and against a few combination of MongoDB and pymongo | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.7, 3.8, 3.9, "3.10", 3.11, pypy3.9, pypy3.10] | |
MONGODB: [$MONGODB_4_0] | |
PYMONGO: [$PYMONGO_3_11] | |
include: | |
- python-version: 3.8 | |
MONGODB: $MONGODB_3_6 | |
PYMONGO: $PYMONGO_3_12 | |
- python-version: 3.9 | |
MONGODB: $MONGODB_4_4 | |
PYMONGO: $PYMONGO_3_13 | |
- python-version: "3.10" | |
MONGODB: $MONGODB_4_4 | |
PYMONGO: $PYMONGO_4_0 | |
- python-version: "3.11" | |
MONGODB: $MONGODB_5_0 | |
PYMONGO: $PYMONGO_4_3 | |
- python-version: "3.11" | |
MONGODB: $MONGODB_6_0 | |
PYMONGO: $PYMONGO_4_4 | |
- python-version: "3.11" | |
MONGODB: $MONGODB_7_0 | |
PYMONGO: $PYMONGO_4_6 | |
- python-version: "3.11" | |
MONGODB: $MONGODB_7_0 | |
PYMONGO: $PYMONGO_4_7 | |
- python-version: "3.11" | |
MONGODB: $MONGODB_7_0 | |
PYMONGO: $PYMONGO_4_8 | |
- python-version: "3.11" | |
MONGODB: $MONGODB_7_0 | |
PYMONGO: $PYMONGO_4_9 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
check-latest: true | |
- name: install mongo and ci dependencies | |
run: | | |
bash .github/workflows/install_mongo.sh ${{ matrix.MONGODB }} | |
bash .github/workflows/install_mongosh.sh ${{ matrix.MONGODB }} ${{ env.MONGOSH }} | |
bash .github/workflows/install_ci_python_dep.sh | |
bash .github/workflows/start_mongo.sh ${{ matrix.MONGODB }} | |
- name: tox dry-run (to pre-install venv) | |
run: tox -e $(echo py${{ matrix.python-version }}-mg${{ matrix.PYMONGO }} | tr -d . | sed -e 's/pypypy/pypy/') -- "-k=test_ci_placeholder" | |
- name: Run test suite | |
run: tox -e $(echo py${{ matrix.python-version }}-mg${{ matrix.PYMONGO }} | tr -d . | sed -e 's/pypypy/pypy/') -- "--cov=mongoengine" | |
- name: Send coverage to Coveralls | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_SERVICE_NAME: github | |
if: ${{ matrix.python-version == env.MAIN_PYTHON_VERSION }} | |
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@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
check-latest: true | |
- name: install python dep | |
run: | | |
pip install -e . | |
pip install -r docs/requirements.txt | |
- name: build doc | |
run: | | |
cd docs | |
make html-readthedocs | |
build-dryrun: | |
runs-on: ubuntu-latest | |
needs: [linting, test, build_doc_dryrun] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
check-latest: true | |
- name: build dummy wheel for test-pypi | |
run: | | |
pip install wheel | |
python setup.py sdist bdist_wheel | |
build-n-publish: | |
runs-on: ubuntu-latest | |
needs: [linting, test, build_doc_dryrun, build-dryrun] | |
if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
check-latest: true | |
# todo separate build from publish | |
# https://stackoverflow.com/questions/59349905/which-properties-does-github-event-in-a-github-workflow-have | |
- name: build dummy wheel for test-pypi | |
run: | | |
pip install wheel | |
python setup.py sdist bdist_wheel | |
- name: publish pypi | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.pypi_token }} |