publish to test-pypi

This commit is contained in:
Bastien Gérard 2020-11-04 20:58:52 +01:00 committed by Bastien Gerard
parent 59438a4768
commit 7b772e3a4a
2 changed files with 43 additions and 29 deletions

View File

@ -1,10 +1,15 @@
name: MongoengineCI name: MongoengineCI
on: on:
# All PR
pull_request:
# master branch merge
push: push:
branches: branches:
- master - master
- /^v.*$/ # release tags
pull_request: create:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
env: env:
MONGODB_3_4: 3.4.19 MONGODB_3_4: 3.4.19
MONGODB_3_6: 3.6.13 MONGODB_3_6: 3.6.13
@ -15,7 +20,7 @@ env:
PYMONGO_3_9: 3.9 PYMONGO_3_9: 3.9
PYMONGO_3_11: 3.11 PYMONGO_3_11: 3.11
MAIN_PYTHON_VERSION: 3.7 # MAIN_PYTHON_VERSION: 3.7
jobs: jobs:
linting: linting:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -33,8 +38,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
python-version: [3.6] python-version: [3.6, 3.7, 3.8, 3.9, pypy3]
#, 3.7, 3.8, 3.9, pypy3]
MONGODB: [$MONGODB_4_0] MONGODB: [$MONGODB_4_0]
PYMONGO: [$PYMONGO_3_11] PYMONGO: [$PYMONGO_3_11]
include: include:
@ -53,9 +57,10 @@ jobs:
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- run: bash .github/workflows/install_mongo.sh ${{ matrix.MONGODB }} - run: |
- run: bash .github/workflows/install_ci_python_dep.sh bash .github/workflows/install_mongo.sh ${{ matrix.MONGODB }}
- run: bash .github/workflows/start_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) - 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" 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 - name: Run test suite
@ -72,7 +77,8 @@ jobs:
nickname: github-notifier nickname: github-notifier
message: | message: |
Build ${{ job.status }} - ${{ github.actor }} ${{ github.event_name }} ${{ github.event.ref }} Build ${{ job.status }} - ${{ github.actor }} ${{ github.event_name }} ${{ github.event.ref }}
build-wheel:
build-n-publish:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [linting, test] needs: [linting, test]
steps: steps:
@ -81,5 +87,13 @@ jobs:
uses: actions/setup-python@v1 uses: actions/setup-python@v1
with: with:
python-version: 3.7 python-version: 3.7
- run: pip install wheel # todo separate build from publish
- run: python setup.py sdist bdist_wheel # 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/

View File

@ -88,21 +88,21 @@ branches:
- /^v.*$/ - /^v.*$/
# Whenever a new release is created via GitHub, publish it on PyPI. # Whenever a new release is created via GitHub, publish it on PyPI.
deploy: #deploy:
provider: pypi # provider: pypi
user: the_drow # user: the_drow
password: # password:
secure: QMyatmWBnC6ZN3XLW2+fTBDU4LQcp1m/LjR2/0uamyeUzWKdlOoh/Wx5elOgLwt/8N9ppdPeG83ose1jOz69l5G0MUMjv8n/RIcMFSpCT59tGYqn3kh55b0cIZXFT9ar+5cxlif6a5rS72IHm5li7QQyxexJIII6Uxp0kpvUmek= # secure: QMyatmWBnC6ZN3XLW2+fTBDU4LQcp1m/LjR2/0uamyeUzWKdlOoh/Wx5elOgLwt/8N9ppdPeG83ose1jOz69l5G0MUMjv8n/RIcMFSpCT59tGYqn3kh55b0cIZXFT9ar+5cxlif6a5rS72IHm5li7QQyxexJIII6Uxp0kpvUmek=
#
# Create a source distribution and a pure python wheel for faster installs. # # Create a source distribution and a pure python wheel for faster installs.
distributions: "sdist bdist_wheel" # distributions: "sdist bdist_wheel"
#
# Only deploy on tagged commits (aka GitHub releases) and only for the parent # # 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. # # 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 # # We run Travis against many different Python, PyMongo, and MongoDB versions
# and we don't want the deploy to occur multiple times). # # and we don't want the deploy to occur multiple times).
on: # on:
tags: true # tags: true
repo: MongoEngine/mongoengine # repo: MongoEngine/mongoengine
condition: ($PYMONGO = ${PYMONGO_3_11}) && ($MONGODB = ${MONGODB_3_4}) # condition: ($PYMONGO = ${PYMONGO_3_11}) && ($MONGODB = ${MONGODB_3_4})
python: 3.7 # python: 3.7