-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
65 lines (61 loc) · 1.64 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
stages:
- build
- deploy-github
- deploy-pypi
build:
stage: build
image: python:3.9-slim
script:
- apt-get update
- apt-get install -y python3-opencv tesseract-ocr libzbar0
- apt-get -y install build-essential
- pip install .
- python3 -c "from improutils import *"
- cd docs
- make html
- cd ..
- python -m unittest discover -s tests
deploy_github:
stage: deploy-github
image:
name: alpine/git:latest
entrypoint: [""]
script:
- mkdir -p ~/.ssh
- echo "${GITHUB_MIRROR_PRIVATE_SSH_KEY}" > ~/.ssh/improutils_mirror
- chmod 600 ~/.ssh/improutils_mirror
- eval $(ssh-agent -s)
- echo "" | ssh-add ~/.ssh/improutils_mirror
- ssh-keyscan github.com >> ~/.ssh/known_hosts
- git remote remove github || true
- git remote add github [email protected]:ImprolabFIT/Improutils.git
- git checkout ${CI_COMMIT_REF_NAME}
- git -c core.sshCommand="ssh -v" push --force -u github HEAD:${CI_COMMIT_BRANCH}
- git -c core.sshCommand="ssh -v" push --tags github || true
deploy_staging:
stage: deploy-pypi
image: python:3.9-slim
variables:
TARGET_ENV: "stage"
TWINE_USERNAME: $PYPI_USER
TWINE_PASSWORD: $PYPI_TOKEN_TEST
script:
- pip install twine
- python setup.py sdist
- twine upload --repository testpypi dist/* --verbose
only:
- master
deploy_production:
stage: deploy-pypi
image: python:3.9-slim
variables:
TWINE_USERNAME: $PYPI_USER
TWINE_PASSWORD: $PYPI_TOKEN_PROD
script:
- pip install twine
- python setup.py sdist
- version=$(python setup.py --version)
- twine upload dist/* --verbose
only:
- master
when: manual