From fe9f7f1f808ce7532779ea69eeac87c378c2a7a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastien=20G=C3=A9rard?= Date: Mon, 2 Nov 2020 20:31:23 +0100 Subject: [PATCH 01/12] test github actions --- .github/workflows/github-actions.yml | 54 ++++++++++++++++++++++ .github/workflows/install_ci_python_dep.sh | 5 ++ .github/workflows/install_mongo.sh | 8 ++++ .github/workflows/start_mongo.sh | 8 ++++ 4 files changed, 75 insertions(+) create mode 100644 .github/workflows/github-actions.yml create mode 100644 .github/workflows/install_ci_python_dep.sh create mode 100644 .github/workflows/install_mongo.sh create mode 100644 .github/workflows/start_mongo.sh diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml new file mode 100644 index 00000000..678b39ae --- /dev/null +++ b/.github/workflows/github-actions.yml @@ -0,0 +1,54 @@ +name: MongoengineCI +on: [push] +env: + MONGODB_3_4: 3.4.19 + MONGODB_3_6: 3.6.13 + MONGODB_4_0: 4.0.13 + + PYMONGO_3_4: 3.4 + PYMONGO_3_6: 3.6 + PYMONGO_3_9: 3.9 + PYMONGO_3_11: 3.11 + + MAIN_PYTHON_VERSION: 3.7 +jobs: + linting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.7 + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - run: bash .github/workflows/install_ci_python_dep.sh + - run: pre-commit run -a + tests: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9, pypy3] + MONGODB: [$MONGODB_4_0] + PYMONGO: [$PYMONGO_3_11] + include: + - python-version: 3.7 + MONGODB: $MONGODB_3_4 + PYMONGO: $PYMONGO_3_6 + - python-version: 3.7 + MONGODB: $MONGODB_3_6 + PYMONGO: $PYMONGO_3_9 + - python-version: 3.7 + MONGODB: $MONGODB_3_6 + PYMONGO: $PYMONGO_3_11 + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - run: bash .github/workflows/install_mongo.sh ${{ matrix.MONGODB }} + - run: bash .github/workflows/install_ci_python_dep.sh + - run: 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" diff --git a/.github/workflows/install_ci_python_dep.sh b/.github/workflows/install_ci_python_dep.sh new file mode 100644 index 00000000..48b04e9d --- /dev/null +++ b/.github/workflows/install_ci_python_dep.sh @@ -0,0 +1,5 @@ +#!/bin/bash +pip install --upgrade pip +pip install coveralls +pip install pre-commit +pip install tox diff --git a/.github/workflows/install_mongo.sh b/.github/workflows/install_mongo.sh new file mode 100644 index 00000000..a98440a8 --- /dev/null +++ b/.github/workflows/install_mongo.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +MONGODB=$1 + +mongo_build=mongodb-linux-x86_64-${MONGODB} +wget http://fastdl.mongodb.org/linux/$mongo_build.tgz +tar xzf $mongo_build.tgz +${PWD}/$mongo_build/bin/mongod --version diff --git a/.github/workflows/start_mongo.sh b/.github/workflows/start_mongo.sh new file mode 100644 index 00000000..dc844dbd --- /dev/null +++ b/.github/workflows/start_mongo.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +MONGODB=$1 + +mongodb_dir=${PWD}/mongodb-linux-x86_64-${MONGODB} +mkdir $mongodb_dir/data +$mongodb_dir/bin/mongod --dbpath $mongodb_dir/data --logpath $mongodb_dir/mongodb.log --fork +mongo --eval 'db.version();' # Make sure mongo is awake From 59438a476825fbfff51e0407e95b8b2d1ff235d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastien=20G=C3=A9rard?= Date: Wed, 4 Nov 2020 14:58:42 +0100 Subject: [PATCH 02/12] add IRC notif to github actions --- .github/workflows/github-actions.yml | 37 +++++++++++++++++++++++++--- .travis.yml | 1 + 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 678b39ae..b4df9fc0 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -1,5 +1,10 @@ name: MongoengineCI -on: [push] +on: + push: + branches: + - master + - /^v.*$/ + pull_request: env: MONGODB_3_4: 3.4.19 MONGODB_3_6: 3.6.13 @@ -22,11 +27,14 @@ jobs: python-version: 3.7 - run: bash .github/workflows/install_ci_python_dep.sh - run: pre-commit run -a - tests: + + test: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - python-version: [3.6, 3.7, 3.8, 3.9, pypy3] + python-version: [3.6] + #, 3.7, 3.8, 3.9, pypy3] MONGODB: [$MONGODB_4_0] PYMONGO: [$PYMONGO_3_11] include: @@ -52,3 +60,26 @@ jobs: 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" + + irc_notification: + runs-on: ubuntu-latest + needs: [linting, test] + steps: + - uses: rectalogic/notify-irc@v1 + if: success() + with: + channel: "irc.freenode.org#mongoengine" + nickname: github-notifier + message: | + Build ${{ job.status }} - ${{ github.actor }} ${{ github.event_name }} ${{ github.event.ref }} + build-wheel: + runs-on: ubuntu-latest + needs: [linting, test] + steps: + - uses: actions/checkout@master + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - run: pip install wheel + - run: python setup.py sdist bdist_wheel diff --git a/.travis.yml b/.travis.yml index b29dab33..4f566dcb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -82,6 +82,7 @@ notifications: # Only run builds on the master branch and GitHub releases (tagged as vX.Y.Z) branches: + # Only run builds on the master branch and GitHub releases (tagged as vX.Y.Z) only: - master - /^v.*$/ From 7b772e3a4ad44106ba5880be3b84174be506da35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastien=20G=C3=A9rard?= Date: Wed, 4 Nov 2020 20:58:52 +0100 Subject: [PATCH 03/12] publish to test-pypi --- .github/workflows/github-actions.yml | 36 +++++++++++++++++++--------- .travis.yml | 36 ++++++++++++++-------------- 2 files changed, 43 insertions(+), 29 deletions(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index b4df9fc0..0959d380 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -1,10 +1,15 @@ name: MongoengineCI on: + # All PR + pull_request: + # master branch merge push: branches: - master - - /^v.*$/ - pull_request: + # release tags + create: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+*' env: MONGODB_3_4: 3.4.19 MONGODB_3_6: 3.6.13 @@ -15,7 +20,7 @@ env: PYMONGO_3_9: 3.9 PYMONGO_3_11: 3.11 - MAIN_PYTHON_VERSION: 3.7 +# MAIN_PYTHON_VERSION: 3.7 jobs: linting: runs-on: ubuntu-latest @@ -33,8 +38,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.6] - #, 3.7, 3.8, 3.9, pypy3] + python-version: [3.6, 3.7, 3.8, 3.9, pypy3] MONGODB: [$MONGODB_4_0] PYMONGO: [$PYMONGO_3_11] include: @@ -53,9 +57,10 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - run: bash .github/workflows/install_mongo.sh ${{ matrix.MONGODB }} - - run: bash .github/workflows/install_ci_python_dep.sh - - run: bash .github/workflows/start_mongo.sh ${{ matrix.MONGODB }} + - 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 @@ -72,7 +77,8 @@ jobs: nickname: github-notifier message: | Build ${{ job.status }} - ${{ github.actor }} ${{ github.event_name }} ${{ github.event.ref }} - build-wheel: + + build-n-publish: runs-on: ubuntu-latest needs: [linting, test] steps: @@ -81,5 +87,13 @@ jobs: uses: actions/setup-python@v1 with: python-version: 3.7 - - run: pip install wheel - - run: python setup.py sdist bdist_wheel + # todo separate build from publish + # https://stackoverflow.com/questions/59349905/which-properties-does-github-event-in-a-github-workflow-have + - run: | + pip install wheel + python setup.py sdist bdist_wheel + - uses: pypa/gh-action-pypi-publish@master + if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') + with: + password: ${{ secrets.pypi_password }} + repository_url: https://test.pypi.org/legacy/ diff --git a/.travis.yml b/.travis.yml index 4f566dcb..c67d1c89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,21 +88,21 @@ branches: - /^v.*$/ # Whenever a new release is created via GitHub, publish it on PyPI. -deploy: - provider: pypi - user: the_drow - password: - secure: QMyatmWBnC6ZN3XLW2+fTBDU4LQcp1m/LjR2/0uamyeUzWKdlOoh/Wx5elOgLwt/8N9ppdPeG83ose1jOz69l5G0MUMjv8n/RIcMFSpCT59tGYqn3kh55b0cIZXFT9ar+5cxlif6a5rS72IHm5li7QQyxexJIII6Uxp0kpvUmek= - - # Create a source distribution and a pure python wheel for faster installs. - distributions: "sdist bdist_wheel" - - # Only deploy on tagged commits (aka GitHub releases) and only for the parent - # repo's builds running Python v3.7 along with PyMongo v3.x and MongoDB v3.4. - # We run Travis against many different Python, PyMongo, and MongoDB versions - # and we don't want the deploy to occur multiple times). - on: - tags: true - repo: MongoEngine/mongoengine - condition: ($PYMONGO = ${PYMONGO_3_11}) && ($MONGODB = ${MONGODB_3_4}) - python: 3.7 +#deploy: +# provider: pypi +# user: the_drow +# password: +# secure: QMyatmWBnC6ZN3XLW2+fTBDU4LQcp1m/LjR2/0uamyeUzWKdlOoh/Wx5elOgLwt/8N9ppdPeG83ose1jOz69l5G0MUMjv8n/RIcMFSpCT59tGYqn3kh55b0cIZXFT9ar+5cxlif6a5rS72IHm5li7QQyxexJIII6Uxp0kpvUmek= +# +# # Create a source distribution and a pure python wheel for faster installs. +# distributions: "sdist bdist_wheel" +# +# # Only deploy on tagged commits (aka GitHub releases) and only for the parent +# # repo's builds running Python v3.7 along with PyMongo v3.x and MongoDB v3.4. +# # We run Travis against many different Python, PyMongo, and MongoDB versions +# # and we don't want the deploy to occur multiple times). +# on: +# tags: true +# repo: MongoEngine/mongoengine +# condition: ($PYMONGO = ${PYMONGO_3_11}) && ($MONGODB = ${MONGODB_3_4}) +# python: 3.7 From 8f3d21c312badbe2441521eff610bae69313aa51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastien=20G=C3=A9rard?= Date: Wed, 4 Nov 2020 23:14:28 +0100 Subject: [PATCH 04/12] improve tag format match --- .github/workflows/github-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 0959d380..46bdf3d3 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -9,7 +9,7 @@ on: # release tags create: tags: - - 'v[0-9]+.[0-9]+.[0-9]+*' + - 'v[0-9]+\.[0-9]+\.[0-9]+*' env: MONGODB_3_4: 3.4.19 MONGODB_3_6: 3.6.13 From fd35df07c40a9f3d39286c7cce32ebc1064f636d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastien=20G=C3=A9rard?= Date: Wed, 4 Nov 2020 23:22:38 +0100 Subject: [PATCH 05/12] add regular pypi deploy to github actions --- .github/workflows/github-actions.yml | 5 +++- .travis.yml | 36 ++++++++++++++-------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 46bdf3d3..52a93f97 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -92,8 +92,11 @@ jobs: - run: | pip install wheel python setup.py sdist bdist_wheel + - uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.test_pypi_password }} + repository_url: https://test.pypi.org/legacy/ - uses: pypa/gh-action-pypi-publish@master if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') with: password: ${{ secrets.pypi_password }} - repository_url: https://test.pypi.org/legacy/ diff --git a/.travis.yml b/.travis.yml index c67d1c89..4f566dcb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,21 +88,21 @@ branches: - /^v.*$/ # Whenever a new release is created via GitHub, publish it on PyPI. -#deploy: -# provider: pypi -# user: the_drow -# password: -# secure: QMyatmWBnC6ZN3XLW2+fTBDU4LQcp1m/LjR2/0uamyeUzWKdlOoh/Wx5elOgLwt/8N9ppdPeG83ose1jOz69l5G0MUMjv8n/RIcMFSpCT59tGYqn3kh55b0cIZXFT9ar+5cxlif6a5rS72IHm5li7QQyxexJIII6Uxp0kpvUmek= -# -# # Create a source distribution and a pure python wheel for faster installs. -# distributions: "sdist bdist_wheel" -# -# # Only deploy on tagged commits (aka GitHub releases) and only for the parent -# # repo's builds running Python v3.7 along with PyMongo v3.x and MongoDB v3.4. -# # We run Travis against many different Python, PyMongo, and MongoDB versions -# # and we don't want the deploy to occur multiple times). -# on: -# tags: true -# repo: MongoEngine/mongoengine -# condition: ($PYMONGO = ${PYMONGO_3_11}) && ($MONGODB = ${MONGODB_3_4}) -# python: 3.7 +deploy: + provider: pypi + user: the_drow + password: + secure: QMyatmWBnC6ZN3XLW2+fTBDU4LQcp1m/LjR2/0uamyeUzWKdlOoh/Wx5elOgLwt/8N9ppdPeG83ose1jOz69l5G0MUMjv8n/RIcMFSpCT59tGYqn3kh55b0cIZXFT9ar+5cxlif6a5rS72IHm5li7QQyxexJIII6Uxp0kpvUmek= + + # Create a source distribution and a pure python wheel for faster installs. + distributions: "sdist bdist_wheel" + + # Only deploy on tagged commits (aka GitHub releases) and only for the parent + # repo's builds running Python v3.7 along with PyMongo v3.x and MongoDB v3.4. + # We run Travis against many different Python, PyMongo, and MongoDB versions + # and we don't want the deploy to occur multiple times). + on: + tags: true + repo: MongoEngine/mongoengine + condition: ($PYMONGO = ${PYMONGO_3_11}) && ($MONGODB = ${MONGODB_3_4}) + python: 3.7 From 0e9920b19029c5e73030ace21a7bb52ffbc389aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastien=20G=C3=A9rard?= Date: Fri, 6 Nov 2020 21:42:12 +0100 Subject: [PATCH 06/12] Build sphinx doc as part of ci --- .github/workflows/github-actions.yml | 34 ++++++++++++++++++++++------ docs/Makefile | 6 +++++ docs/conf.py | 2 +- docs/requirements.txt | 4 ++-- 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 52a93f97..d56e4c3a 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -66,6 +66,22 @@ jobs: - 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" + build_doc_dryrun: + # ensures that readthedocs can be built continuously + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - run: | + pip install -e . + pip install -r docs/requirements.txt + - run: | + cd docs + make html-readthedocs + irc_notification: runs-on: ubuntu-latest needs: [linting, test] @@ -89,14 +105,18 @@ jobs: python-version: 3.7 # todo separate build from publish # https://stackoverflow.com/questions/59349905/which-properties-does-github-event-in-a-github-workflow-have - - run: | + - name: build dummy wheel for test-pypi + run: | pip install wheel - python setup.py sdist bdist_wheel - - uses: pypa/gh-action-pypi-publish@master + python setup.py egg_info -b ".dev`date '+%Y%m%d%H%M%S'`" build sdist bdist_wheel +# python setup.py sdist bdist_wheel + - name: publish test-pypi + uses: pypa/gh-action-pypi-publish@master with: password: ${{ secrets.test_pypi_password }} repository_url: https://test.pypi.org/legacy/ - - uses: pypa/gh-action-pypi-publish@master - if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') - with: - password: ${{ secrets.pypi_password }} +# - name: publish pypi +# uses: pypa/gh-action-pypi-publish@master +# if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') +# with: +# password: ${{ secrets.pypi_password }} diff --git a/docs/Makefile b/docs/Makefile index cdc77c36..0bf35356 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -35,6 +35,12 @@ html: @echo @echo "Build finished. Check $(BUILDDIR)/html/index.html" +html-readthedocs: + $(SPHINXBUILD) -T -E -b readthedocs $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + + dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo diff --git a/docs/conf.py b/docs/conf.py index f8a4999a..808deaa8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,7 +26,7 @@ sys.path.insert(0, os.path.abspath("..")) # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ["sphinx.ext.autodoc", "sphinx.ext.todo"] +extensions = ["sphinx.ext.autodoc", "sphinx.ext.todo", "readthedocs_ext.readthedocs"] # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] diff --git a/docs/requirements.txt b/docs/requirements.txt index abd12629..dfda6a70 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,3 @@ -pymongo>=3.11 -Sphinx==3.2.1 +Sphinx==3.3.0 sphinx-rtd-theme==0.5.0 +readthedocs-sphinx-ext==2.1.1 From 6e332e782b7d9c6745ccb5510acee439b3e1ca2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastien=20G=C3=A9rard?= Date: Sat, 7 Nov 2020 15:30:51 +0100 Subject: [PATCH 07/12] minor improvement to github actions --- .github/workflows/github-actions.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index d56e4c3a..a1a3c403 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -57,7 +57,8 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - run: | + - 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 }} @@ -75,10 +76,12 @@ jobs: uses: actions/setup-python@v2 with: python-version: 3.7 - - run: | + - name: install python dep + run: | pip install -e . pip install -r docs/requirements.txt - - run: | + - name: build doc + run: | cd docs make html-readthedocs From cc591a634a3fbd7b24726fbef2dd8059d056e006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastien=20G=C3=A9rard?= Date: Sun, 15 Nov 2020 14:02:03 +0100 Subject: [PATCH 08/12] add coveralls to actions --- .github/workflows/github-actions.yml | 14 +++++++++++--- setup.py | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index a1a3c403..43a70a85 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -20,7 +20,8 @@ env: PYMONGO_3_9: 3.9 PYMONGO_3_11: 3.11 -# MAIN_PYTHON_VERSION: 3.7 + MAIN_PYTHON_VERSION: 3.7 + jobs: linting: runs-on: ubuntu-latest @@ -66,6 +67,11 @@ jobs: 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 }} + if: ${{ matrix.python-version == env.MAIN_PYTHON_VERSION }} + run: coveralls build_doc_dryrun: # ensures that readthedocs can be built continuously @@ -114,12 +120,14 @@ jobs: python setup.py egg_info -b ".dev`date '+%Y%m%d%H%M%S'`" build sdist bdist_wheel # python setup.py sdist bdist_wheel - name: publish test-pypi + if: github.event_name != 'pull_request' uses: pypa/gh-action-pypi-publish@master with: - password: ${{ secrets.test_pypi_password }} + password: ${{ secrets.test_pypi_token }} repository_url: https://test.pypi.org/legacy/ + ## Must clean prev files and rebuild here # - name: publish pypi # uses: pypa/gh-action-pypi-publish@master # if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') # with: -# password: ${{ secrets.pypi_password }} +# password: ${{ secrets.pypi_token }} diff --git a/setup.py b/setup.py index ffc35743..37b95e37 100644 --- a/setup.py +++ b/setup.py @@ -112,7 +112,7 @@ extra_opts = { "tests_require": [ "pytest<5.0", "pytest-cov", - "coverage<5.0", # recent coverage switched to sqlite format for the .coverage file which isn't handled properly by coveralls + "coverage", "blinker", "Pillow>=7.0.0", ], From 0f1fce4a7b2d08a72d8705c86cffc8fdc1e2d0af Mon Sep 17 00:00:00 2001 From: Bastien Gerard Date: Wed, 16 Dec 2020 21:52:49 +0100 Subject: [PATCH 09/12] Add separate jobs for test-pypi and pypi in github actions --- .github/workflows/github-actions.yml | 39 +++++++++++++++++++--------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 43a70a85..1205e7c5 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -35,6 +35,8 @@ jobs: - 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-latest strategy: fail-fast: false @@ -75,6 +77,7 @@ jobs: 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@v2 @@ -103,6 +106,26 @@ jobs: message: | Build ${{ job.status }} - ${{ github.actor }} ${{ github.event_name }} ${{ github.event.ref }} + build-n-publish-dummy: + runs-on: ubuntu-latest + needs: [linting, test] + steps: + - uses: actions/checkout@master + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: build dummy wheel for test-pypi + run: | + pip install wheel + python setup.py egg_info -b ".dev`date '+%Y%m%d%H%M%S'`" build sdist bdist_wheel + - name: publish test-pypi + if: github.event_name != 'pull_request' + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.test_pypi_token }} + repository_url: https://test.pypi.org/legacy/ + build-n-publish: runs-on: ubuntu-latest needs: [linting, test] @@ -117,17 +140,9 @@ jobs: - name: build dummy wheel for test-pypi run: | pip install wheel - python setup.py egg_info -b ".dev`date '+%Y%m%d%H%M%S'`" build sdist bdist_wheel -# python setup.py sdist bdist_wheel - - name: publish test-pypi - if: github.event_name != 'pull_request' + python setup.py sdist bdist_wheel + - name: publish pypi uses: pypa/gh-action-pypi-publish@master + if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') with: - password: ${{ secrets.test_pypi_token }} - repository_url: https://test.pypi.org/legacy/ - ## Must clean prev files and rebuild here -# - name: publish pypi -# uses: pypa/gh-action-pypi-publish@master -# if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') -# with: -# password: ${{ secrets.pypi_token }} + password: ${{ secrets.pypi_token }} \ No newline at end of file From aa368be4d39a602d93f8ca458df3524ade6b74fb Mon Sep 17 00:00:00 2001 From: Bastien Gerard Date: Wed, 16 Dec 2020 21:54:55 +0100 Subject: [PATCH 10/12] minor comment improvement --- .github/workflows/github-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 1205e7c5..6bb673ba 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -115,7 +115,7 @@ jobs: uses: actions/setup-python@v1 with: python-version: 3.7 - - name: build dummy wheel for test-pypi + - name: build dummy wheel for test-pypi (hacking versioning to make it unique) run: | pip install wheel python setup.py egg_info -b ".dev`date '+%Y%m%d%H%M%S'`" build sdist bdist_wheel From 81197d60610622cac5bddc11f50a8bf19ebaa9de Mon Sep 17 00:00:00 2001 From: Bastien Gerard Date: Wed, 16 Dec 2020 22:05:25 +0100 Subject: [PATCH 11/12] comment out travis file, until next release is fully operational from github actions --- .travis.yml | 108 --------------------------------------------------- .travis_.yml | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 108 deletions(-) delete mode 100644 .travis.yml create mode 100644 .travis_.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4f566dcb..00000000 --- a/.travis.yml +++ /dev/null @@ -1,108 +0,0 @@ -# For full coverage, we'd have to test all supported Python, MongoDB, and -# PyMongo combinations. However, that would result in an overly long build -# with a very large number of jobs, hence we only test a subset of all the -# combinations. -# * Python3.7, MongoDB v3.4 & the latest PyMongo v3.x is currently the "main" setup, -# Other combinations are tested. See below for the details or check the travis jobs - -# We should periodically check MongoDB Server versions supported by MongoDB -# Inc., add newly released versions to the test matrix, and remove versions -# which have reached their End of Life. See: -# 1. https://www.mongodb.com/support-policy. -# 2. https://docs.mongodb.com/ecosystem/drivers/driver-compatibility-reference/#python-driver-compatibility -# -# Reminder: Update README.rst if you change MongoDB versions we test. - -language: python -dist: xenial -python: - - 3.6 - - 3.7 - - 3.8 - - 3.9 - - pypy3 - -env: - global: - - MONGODB_3_4=3.4.19 - - MONGODB_3_6=3.6.13 - - MONGODB_4_0=4.0.13 - - - PYMONGO_3_4=3.4 - - PYMONGO_3_6=3.6 - - PYMONGO_3_9=3.9 - - PYMONGO_3_11=3.11 - - - MAIN_PYTHON_VERSION=3.7 - matrix: - - MONGODB=${MONGODB_3_4} PYMONGO=${PYMONGO_3_11} - -matrix: - # Finish the build as soon as one job fails - fast_finish: true - - include: - - python: 3.7 - env: MONGODB=${MONGODB_3_6} PYMONGO=${PYMONGO_3_6} - - python: 3.7 - env: MONGODB=${MONGODB_3_6} PYMONGO=${PYMONGO_3_9} - - python: 3.7 - env: MONGODB=${MONGODB_3_6} PYMONGO=${PYMONGO_3_11} - - python: 3.8 - env: MONGODB=${MONGODB_4_0} PYMONGO=${PYMONGO_3_11} - -install: - # Install Mongo - - wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB}.tgz - - tar xzf mongodb-linux-x86_64-${MONGODB}.tgz - - ${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --version - # Install Python dependencies. - - pip install --upgrade pip - - pip install coveralls - - pip install pre-commit - - pip install tox - # tox dryrun to setup the tox venv (we run a mock test). - - tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO | tr -d . | sed -e 's/pypypy/pypy/') -- -a "-k=test_ci_placeholder" - -before_script: - - mkdir ${PWD}/mongodb-linux-x86_64-${MONGODB}/data - - ${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/data --logpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/mongodb.log --fork - # Run pre-commit hooks (black, flake8, etc) on entire codebase - - if [[ $TRAVIS_PYTHON_VERSION == $MAIN_PYTHON_VERSION ]]; then pre-commit run -a; else echo "pre-commit checks only runs on py37"; fi - - mongo --eval 'db.version();' # Make sure mongo is awake - -script: - - tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO | tr -d . | sed -e 's/pypypy/pypy/') -- -a "--cov=mongoengine" - -after_success: - - if [[ $TRAVIS_PYTHON_VERSION == $MAIN_PYTHON_VERSION ]]; then coveralls --verbose; else echo "coveralls only sent for py37"; fi - -notifications: - irc: irc.freenode.org#mongoengine - -# Only run builds on the master branch and GitHub releases (tagged as vX.Y.Z) -branches: - # Only run builds on the master branch and GitHub releases (tagged as vX.Y.Z) - only: - - master - - /^v.*$/ - -# Whenever a new release is created via GitHub, publish it on PyPI. -deploy: - provider: pypi - user: the_drow - password: - secure: QMyatmWBnC6ZN3XLW2+fTBDU4LQcp1m/LjR2/0uamyeUzWKdlOoh/Wx5elOgLwt/8N9ppdPeG83ose1jOz69l5G0MUMjv8n/RIcMFSpCT59tGYqn3kh55b0cIZXFT9ar+5cxlif6a5rS72IHm5li7QQyxexJIII6Uxp0kpvUmek= - - # Create a source distribution and a pure python wheel for faster installs. - distributions: "sdist bdist_wheel" - - # Only deploy on tagged commits (aka GitHub releases) and only for the parent - # repo's builds running Python v3.7 along with PyMongo v3.x and MongoDB v3.4. - # We run Travis against many different Python, PyMongo, and MongoDB versions - # and we don't want the deploy to occur multiple times). - on: - tags: true - repo: MongoEngine/mongoengine - condition: ($PYMONGO = ${PYMONGO_3_11}) && ($MONGODB = ${MONGODB_3_4}) - python: 3.7 diff --git a/.travis_.yml b/.travis_.yml new file mode 100644 index 00000000..114fd76f --- /dev/null +++ b/.travis_.yml @@ -0,0 +1,108 @@ +## For full coverage, we'd have to test all supported Python, MongoDB, and +## PyMongo combinations. However, that would result in an overly long build +## with a very large number of jobs, hence we only test a subset of all the +## combinations. +## * Python3.7, MongoDB v3.4 & the latest PyMongo v3.x is currently the "main" setup, +## Other combinations are tested. See below for the details or check the travis jobs +# +## We should periodically check MongoDB Server versions supported by MongoDB +## Inc., add newly released versions to the test matrix, and remove versions +## which have reached their End of Life. See: +## 1. https://www.mongodb.com/support-policy. +## 2. https://docs.mongodb.com/ecosystem/drivers/driver-compatibility-reference/#python-driver-compatibility +## +## Reminder: Update README.rst if you change MongoDB versions we test. +# +#language: python +#dist: xenial +#python: +# - 3.6 +# - 3.7 +# - 3.8 +# - 3.9 +# - pypy3 +# +#env: +# global: +# - MONGODB_3_4=3.4.19 +# - MONGODB_3_6=3.6.13 +# - MONGODB_4_0=4.0.13 +# +# - PYMONGO_3_4=3.4 +# - PYMONGO_3_6=3.6 +# - PYMONGO_3_9=3.9 +# - PYMONGO_3_11=3.11 +# +# - MAIN_PYTHON_VERSION=3.7 +# matrix: +# - MONGODB=${MONGODB_3_4} PYMONGO=${PYMONGO_3_11} +# +#matrix: +# # Finish the build as soon as one job fails +# fast_finish: true +# +# include: +# - python: 3.7 +# env: MONGODB=${MONGODB_3_6} PYMONGO=${PYMONGO_3_6} +# - python: 3.7 +# env: MONGODB=${MONGODB_3_6} PYMONGO=${PYMONGO_3_9} +# - python: 3.7 +# env: MONGODB=${MONGODB_3_6} PYMONGO=${PYMONGO_3_11} +# - python: 3.8 +# env: MONGODB=${MONGODB_4_0} PYMONGO=${PYMONGO_3_11} +# +#install: +# # Install Mongo +# - wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGODB}.tgz +# - tar xzf mongodb-linux-x86_64-${MONGODB}.tgz +# - ${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --version +# # Install Python dependencies. +# - pip install --upgrade pip +# - pip install coveralls +# - pip install pre-commit +# - pip install tox +# # tox dryrun to setup the tox venv (we run a mock test). +# - tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO | tr -d . | sed -e 's/pypypy/pypy/') -- -a "-k=test_ci_placeholder" +# +#before_script: +# - mkdir ${PWD}/mongodb-linux-x86_64-${MONGODB}/data +# - ${PWD}/mongodb-linux-x86_64-${MONGODB}/bin/mongod --dbpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/data --logpath ${PWD}/mongodb-linux-x86_64-${MONGODB}/mongodb.log --fork +# # Run pre-commit hooks (black, flake8, etc) on entire codebase +# - if [[ $TRAVIS_PYTHON_VERSION == $MAIN_PYTHON_VERSION ]]; then pre-commit run -a; else echo "pre-commit checks only runs on py37"; fi +# - mongo --eval 'db.version();' # Make sure mongo is awake +# +#script: +# - tox -e $(echo py$TRAVIS_PYTHON_VERSION-mg$PYMONGO | tr -d . | sed -e 's/pypypy/pypy/') -- -a "--cov=mongoengine" +# +#after_success: +# - if [[ $TRAVIS_PYTHON_VERSION == $MAIN_PYTHON_VERSION ]]; then coveralls --verbose; else echo "coveralls only sent for py37"; fi +# +#notifications: +# irc: irc.freenode.org#mongoengine +# +## Only run builds on the master branch and GitHub releases (tagged as vX.Y.Z) +#branches: +# # Only run builds on the master branch and GitHub releases (tagged as vX.Y.Z) +# only: +# - master +# - /^v.*$/ +# +## Whenever a new release is created via GitHub, publish it on PyPI. +#deploy: +# provider: pypi +# user: the_drow +# password: +# secure: QMyatmWBnC6ZN3XLW2+fTBDU4LQcp1m/LjR2/0uamyeUzWKdlOoh/Wx5elOgLwt/8N9ppdPeG83ose1jOz69l5G0MUMjv8n/RIcMFSpCT59tGYqn3kh55b0cIZXFT9ar+5cxlif6a5rS72IHm5li7QQyxexJIII6Uxp0kpvUmek= +# +# # Create a source distribution and a pure python wheel for faster installs. +# distributions: "sdist bdist_wheel" +# +# # Only deploy on tagged commits (aka GitHub releases) and only for the parent +# # repo's builds running Python v3.7 along with PyMongo v3.x and MongoDB v3.4. +# # We run Travis against many different Python, PyMongo, and MongoDB versions +# # and we don't want the deploy to occur multiple times). +# on: +# tags: true +# repo: MongoEngine/mongoengine +# condition: ($PYMONGO = ${PYMONGO_3_11}) && ($MONGODB = ${MONGODB_3_4}) +# python: 3.7 From 49e33b978dc1c206b8522e2b2a0af986a43c6b0f Mon Sep 17 00:00:00 2001 From: Bastien Gerard Date: Wed, 16 Dec 2020 22:21:51 +0100 Subject: [PATCH 12/12] move condition of build-n-publish to job level + disable test-pypi releasing as there is some limitation on the size --- .github/workflows/github-actions.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 6bb673ba..2c2166a5 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -115,20 +115,24 @@ jobs: uses: actions/setup-python@v1 with: python-version: 3.7 - - name: build dummy wheel for test-pypi (hacking versioning to make it unique) + - name: build dummy wheel for test-pypi run: | pip install wheel python setup.py egg_info -b ".dev`date '+%Y%m%d%H%M%S'`" build sdist bdist_wheel - - name: publish test-pypi - if: github.event_name != 'pull_request' - uses: pypa/gh-action-pypi-publish@master - with: - password: ${{ secrets.test_pypi_token }} - repository_url: https://test.pypi.org/legacy/ +# - name: publish test-pypi +# # Although working and recommended, test-pypi has a limit +# # in the size of projects so it's better to avoid publishing +# # until there is a way to garbage collect these dummy releases +# if: github.event_name != 'pull_request' +# uses: pypa/gh-action-pypi-publish@master +# with: +# password: ${{ secrets.test_pypi_token }} +# repository_url: https://test.pypi.org/legacy/ build-n-publish: runs-on: ubuntu-latest needs: [linting, test] + if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') steps: - uses: actions/checkout@master - name: Set up Python 3.7 @@ -143,6 +147,5 @@ jobs: python setup.py sdist bdist_wheel - name: publish pypi uses: pypa/gh-action-pypi-publish@master - if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') with: password: ${{ secrets.pypi_token }} \ No newline at end of file