This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
MongoengineCI #73
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 | |
# release tags | |
create: | |
tags: | |
- 'v[0-9]+\.[0-9]+\.[0-9]+*' | |
env: | |
MONGODB_4_4: 4.4 | |
PYMONGO_3_9: 3.9 | |
PYMONGO_3_11: 3.11 | |
MAIN_PYTHON_VERSION: 3.9 | |
jobs: | |
linting: | |
# Run pre-commit (https://pre-commit.com/) | |
# which runs pre-configured linter & autoformatter | |
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 | |
test: | |
# Test suite run against recent python versions | |
# and against a few combination of MongoDB and pymongo | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: [3.6] | |
MONGODB: [$MONGODB_4_4] | |
PYMONGO: [$PYMONGO_3_9] | |
include: | |
- python-version: 3.6 | |
MONGODB: $MONGODB_4_4 | |
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 }} | |
- 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@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: install python dep | |
run: | | |
pip install -e . | |
pip install -r docs/requirements.txt | |
- name: build doc | |
run: | | |
cd docs | |
make html-readthedocs | |
build-n-publish-dummy: | |
runs-on: ubuntu-latest | |
needs: [linting, test, build_doc_dryrun] | |
if: github.event_name != 'pull_request' | |
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 | |
# # 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 | |
# 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, build_doc_dryrun, build-n-publish-dummy] | |
if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.7 | |
# 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@master | |
with: | |
password: ${{ secrets.pypi_token }} |