Newer
Older
stages:
- test
- build
- release
lint:
image: python:3
cache:
paths:
- .cache/pip
- .cache/pre-commit
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PRE_COMMIT_HOME: "$CI_PROJECT_DIR/.cache/pre-commit"
before_script:
- pip install pre-commit
script:
- pre-commit run -a
test:
image: python:3
stage: test
cache:
paths:
- .cache/pip
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
ARKINDEX_API_SCHEMA_URL: schema.yml
before_script:
- pip install tox
# Download OpenAPI schema from last backend build
# Use internal S3 bucket URL to avoid cache issues
- curl https://teklia-assets-release.s3.eu-west-3.amazonaws.com/arkindex/openapi.yml > schema.yml
script:
- tox
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
test-cookiecutter:
image: python:3
stage: test
cache:
paths:
- .cache/pip
- .cache/pre-commit
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PRE_COMMIT_HOME: "$CI_PROJECT_DIR/.cache/pre-commit"
ARKINDEX_API_SCHEMA_URL: schema.yml
before_script:
- pip install cookiecutter tox pre-commit
# Configure git to be able to commit in the hook
- git config --global user.email "crasher@teklia.com"
- git config --global user.name "Crash Test"
script:
- cookiecutter --no-input .
- cd worker-demo
- find
- tox
- pre-commit run -a
# Store demo build for later docker build
artifacts:
paths:
- worker-demo/
build-cookiecutter:
image: docker:19.03.1
stage: build
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375/
# Ensure artifacts are available
dependencies:
- test-cookiecutter
script:
- cd worker-demo
- docker build .
pypi-publication:
image: python:3
stage: release
only:
- tags
environment:
name: pypi
url: https://pypi.org/project/arkindex-base-worker
before_script:
- pip install twine setuptools wheel
- echo "[distutils]" > ~/.pypirc
- echo "index-servers =" >> ~/.pypirc
- echo " pypi" >> ~/.pypirc
- echo "[pypi]" >> ~/.pypirc
- echo "repository=https://upload.pypi.org/legacy/" >> ~/.pypirc
- echo "username=$PYPI_DEPLOY_USERNAME" >> ~/.pypirc
- echo "password=$PYPI_DEPLOY_PASSWORD" >> ~/.pypirc
script:
- python setup.py sdist bdist_wheel
- twine upload dist/* -r pypi
release-notes:
stage: release
image: registry.gitlab.com/teklia/devops:latest
only:
- tags
script:
- devops release-notes