-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
88 lines (80 loc) · 2.85 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# This file is a template, and might need editing before it works on your project.
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python/tags/
image: jugit-registry.fz-juelich.de/ibg-1/modsim/imageanalysis/uat/python:3.9
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
stages:
- build
- test
- deploy
test:
image: jugit-registry.fz-juelich.de/ibg-1/modsim/imageanalysis/uat/miniconda3 #continuumio/miniconda3
stage: test
tags:
- bigmem
script:
- conda install -y python=3.9 gcc -c conda-forge
- pip install --upgrade pip
- pip install .[test]
- pip install tox flake8 # you can also use tox
- tox -e py39
- pip install papermill
# create kernel for jupyter notebook
- pip install --upgrade pip ipython ipykernel
- ipython kernel install --name "python3" --user
# test the example notebook
- papermill example_simple.ipynb example_simple_exec.ipynb
- papermill example_simple_custom.ipynb example_simple_exec.ipynb
coverage: '/TOTAL.*\s+(\d+%)/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: report.xml
run:
stage: build
script:
- python setup.py bdist_wheel
# an alternative approach is to install and run:
- pip install dist/*
# run the command here
- python -c "import uatrack"
artifacts:
paths:
- dist/*.whl
.deploy_common:
# common config
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
upload_package:
stage: deploy
# dot pass artifacts from other stages
dependencies: []
cache: []
extends: .deploy_common
script:
- set -e
- pip install twine bump2version
- git config --global user.email "${GITLAB_USER_EMAIL}"
- git config --global user.name "${GITLAB_USER_NAME}"
- git log
# list tags
- git tag
- bump2version patch
- python setup.py sdist bdist_wheel
- ls -all dist/
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
- git remote set-url origin "https://${CI_PUSH_NAME}:${CI_PUSH_TOKEN}@jugit.fz-juelich.de/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}.git"
- git push -o ci.skip --tags origin HEAD:${CI_COMMIT_REF_NAME}
- TWINE_PASSWORD=${PYPI_API_TOKEN} TWINE_USERNAME=__token__ twine upload --repository pypi dist/*
artifacts:
paths:
- dist/