Add mongodb 6.0 and 7.0 to the CI pipeline #414
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_4: 3.4 | |
PYMONGO_3_6: 3.6 | |
PYMONGO_3_9: 3.9 | |
PYMONGO_3_11: 3.11 | |
PYMONGO_3_12: 3.12 | |
PYMONGO_4_0: 4.0 | |
PYMONGO_4_3: 4.3.2 | |
PYMONGO_4_4: 4.4.1 | |
PYMONGO_4_6: 4.6.0 | |
MAIN_PYTHON_VERSION: 3.7 | |
jobs: | |
linting: | |
# Run pre-commit (https://pre-commit.com/) | |
# which runs pre-configured linter & autoformatter | |
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_dep.sh | |
- run: pre-commit run -a | |
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] | |
MONGODB: [$MONGODB_4_0] | |
PYMONGO: [$PYMONGO_3_11] | |
include: | |
- python-version: 3.7 | |
MONGODB: $MONGODB_3_6 | |
PYMONGO: $PYMONGO_3_9 | |
- python-version: 3.8 | |
MONGODB: $MONGODB_4_4 | |
PYMONGO: $PYMONGO_3_11 | |
- python-version: 3.9 | |
MONGODB: $MONGODB_4_4 | |
PYMONGO: $PYMONGO_3_12 | |
- 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 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
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_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/') -- -a "-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/') -- -a "--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 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
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@v3 | |
- uses: actions/setup-python@v4 | |
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@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
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 }} |