forked from AG-Salinga/sampledb-api-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
96 lines (90 loc) · 2.45 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
89
90
91
92
93
94
95
96
image: python:latest
stages:
- test
- mirror
- deploy
test:
stage: test
parallel:
matrix:
- IMAGE: ['python:3.7-slim', 'python:3.8-slim', 'python:3.9-slim', 'python:3.10-slim', 'python:3.11-slim', 'python:3.12-slim']
image: $IMAGE
script:
- mkdir htmlcov
- mkdir mypycov
- python -m pip install --upgrade pytest pytest-html coverage requests-mock mypy types-requests lxml
- python -m compileall -f .
- python -m pytest -v
- python -m pytest --html=report.html --self-contained-html
- python -m pytest --junitxml=report.xml
- python -m coverage run --source "./" --omit "./test/*",setup.py -m pytest
- python -m coverage report
- python -m coverage html
- python -m mypy sampledbapi --html-report mypycov
artifacts:
paths:
- report.html
- report.xml
- htmlcov/
- mypycov/
expire_in: 1 month
when: always
reports:
junit: report.xml
style:
allow_failure: true
script:
- python -m pip install --upgrade pycodestyle
- python3 -m pycodestyle --ignore=E402,E501,W504,W601 sampledbapi
mirror:
stage: mirror
image: ubuntu:22.04
variables:
GIT_STRATEGY: none
script:
- apt-get update && apt-get upgrade -y
- apt-get install -y git
- mkdir --mode=700 ~/.ssh/
- echo "$PRIVATE_KEY" > ~/.ssh/id_ed25519
- echo "github.com ssh-ed25519 $GITHUB_HOST_KEY" >> ~/.ssh/known_hosts
- chmod 400 ~/.ssh/*
- git clone --mirror "$CI_REPOSITORY_URL" repo
- cd repo && git push --mirror git@github.com:AG-Salinga/sampledb-api-wrapper && cd -
deploy_production:
stage: deploy
variables:
TWINE_USERNAME: $PYPI_USERNAME
TWINE_PASSWORD: $PYPI_PASSWORD
script:
- apt-get update
- apt-get install wget software-properties-common apt-transport-https ca-certificates -y
- python -m pip install twine
- python setup.py install
- python setup.py sdist bdist_wheel
- twine upload dist/*
artifacts:
paths:
- dist/
expire_in: 6 months
only:
- tags
pages:
stage: deploy
script:
- apt-get update
- apt-get install pandoc -y
- python -m pip install sphinx sphinx_rtd_theme IPython ipykernel nbsphinx m2r2
- python setup.py install
- mkdir .public
- cd doc
- sphinx-apidoc -o . ../sampledbapi -f -P -M -e
- sphinx-build -b html . _build
- mv _build/* ../.public/
- cd ..
- mv .public public
only:
- tags
artifacts:
paths:
- public
expire_in: 1 hour