.gitlab-ci.yml
# stages of gitlab ci.
stages:
- test
- release
# default settings for all ci jobs.
default:
image: azadehafzarhub/gitlab-ci-python-build:latest
# job for testing package against python version 3.6
# on master branch and send test coverage result to
# codeclimate.
test main branch:
stage: test
before_script:
# run code climate test reporter agent.
- cc-test-reporter before-build
# get bash ready.
- source ~/.bash_profile
# create virtual environment.
- pipenv --python 3.6.9
# install dependencies from the pipfile.
- pipenv install --dev
# run tests.
script:
- script/test.sh
# send test coverage result to codeclimate.
after_script:
- cc-test-reporter after-build --coverage-input-type coverage.py
only:
- master
# job for testing package on other branches than master
# and merge requests against 3.6 version.
test python 3.6.9:
stage: test
before_script:
# get bash ready.
- source ~/.bash_profile
# create virtual environment.
- pipenv --python 3.6.9
# install dependencies from the pipfile.
- pipenv install --dev
# run tests.
script:
- script/test.sh
only:
- branches
- merge_requests
except:
- master
test python 3.7.5:
stage: test
before_script:
# get bash ready.
- source ~/.bash_profile
# create virtual environment.
- pipenv --python 3.7.5
# install dependencies from the pipfile.
- pipenv install --dev
# run tests.
script:
- script/test.sh
except:
- tags
test python 3.8.0:
stage: test
before_script:
# get bash ready.
- source ~/.bash_profile
# create virtual environment.
- pipenv --python 3.8.0
# install dependencies from the pipfile.
- pipenv install --dev
# run tests.
script:
- script/test.sh
except:
- tags
# deploy package to pypi whenever a tag is released.
release to pypi:
stage: release
before_script:
# create a source list.
- python3 setup.py sdist
script:
# upload to pypi.
- twine upload dist/*
# only run for new tags.
only:
- tags
when: manual