-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
141 lines (126 loc) · 6.15 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
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
130
131
132
133
134
135
136
137
138
139
140
141
image: lamenezes/stoqlib
services:
- postgres:9.5
variables:
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
# Fetch utils/ submodule
GIT_SUBMODULE_STRATEGY: recursive
POSTGRES_DB: test
POSTGRES_USER: test
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
STOQLIB_TEST_HOSTNAME: "postgres"
STOQLIB_TEST_DBNAME: "test"
STOQLIB_TEST_USERNAME: "test"
STOQLIB_TEST_PASSWORD: ""
cache:
key:
files:
- poetry.lock
paths:
- $CI_PROJECT_DIR/.cache/pip
- $CI_PROJECT_DIR/.cache/poetry
stages:
- test
- build
before_script:
- python3 -V
- export LC_ALL=pt_BR.UTF-8
- python3 -m pip install zipp==1.2.0 importlib-resources==2.0.1 poetry
- mkdir $CI_PROJECT_DIR/.cache/poetry/venv -p
- poetry config virtualenvs.create true
- poetry config virtualenvs.in-project false
- poetry config cache-dir $CI_PROJECT_DIR/.cache/poetry
- poetry config virtualenvs.path $CI_PROJECT_DIR/.cache/poetry/venv
- poetry install -vvv
- poetry show
test:
stage: test
script:
- 'git diff ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME} stoqlib/__init__.py || echo "You have to bump the version of this project by running, for example: bumpversion minor"'
- poetry run make coverage
build_dist:
image: cprov/stoq:candidate
stage: build
before_script:
- export LC_ALL=pt_BR.UTF-8
- apt update -yq
- apt --yes install libpq-dev build-essential devscripts debhelper libcairo2-dev pkg-config python3-pip
- python3 -m pip install -U setuptools==51.1.2 wheel pip==20.3.3 kiwi-gtk
script:
- cp setup_old.py setup.py
- make dist
artifacts:
paths:
- dist
generate_deb:
image: cprov/stoq:candidate
stage: build
before_script:
- python3 -V
- export LC_ALL=pt_BR.UTF-8
- apt update -yq
- apt --yes install python3-pip build-essential devscripts debhelper python3-all libcairo2-dev libgirepository1.0-dev gir1.2-webkit2-4.0 build-essential locales git postgresql-client ntp xvfb iso-codes libxss1 gir1.2-webkit-3.0 librsvg2-common poppler-utils libnss3-tools libnss3-dev libusb-1.0-0 libxml2-utils python3-dev python3-zope.interface python3-kiwi python3-psycopg2 python3-pil python3-reportlab python3-dateutil python3-mako python3-lxml python3-xlwt python3-nss python3-storm python3-weasyprint python3-requests python3-openssl python3-pyinotify python3-viivakoodi python3-pykcs11 python3-tz python3-raven python3-aptdaemon.gtk3widgets python3-nose python3-mock python3-pyflakes python3-gevent python3-psutil python3-flask python3-flask-restful python3-blinker python3-tzlocal python3-jwt python3-docutils python3-stoqdrivers libpq-dev
- dpkg-reconfigure --frontend noninteractive tzdata
- python3 -m pip install -U setuptools==51.1.2 wheel pip==20.3.3 kiwi-gtk
script:
- rm -rf dist
- cp setup_old.py setup.py
- python3 setup.py develop
- make deb
artifacts:
paths:
- dist/*.deb
only:
- master
manual_generate_deb:
when: manual
image: cprov/stoq:candidate
stage: build
before_script:
- python3 -V
- export LC_ALL=pt_BR.UTF-8
- apt update -yq
- apt --yes install python3-pip build-essential devscripts debhelper python3-all libcairo2-dev libgirepository1.0-dev gir1.2-webkit2-4.0 build-essential locales git postgresql-client ntp xvfb iso-codes libxss1 gir1.2-webkit-3.0 librsvg2-common poppler-utils libnss3-tools libnss3-dev libusb-1.0-0 libxml2-utils python3-dev python3-zope.interface python3-kiwi python3-psycopg2 python3-pil python3-reportlab python3-dateutil python3-mako python3-lxml python3-xlwt python3-nss python3-storm python3-weasyprint python3-requests python3-openssl python3-pyinotify python3-viivakoodi python3-pykcs11 python3-tz python3-raven python3-aptdaemon.gtk3widgets python3-nose python3-mock python3-pyflakes python3-gevent python3-psutil python3-flask python3-flask-restful python3-blinker python3-tzlocal python3-jwt python3-docutils python3-stoqdrivers libpq-dev
- dpkg-reconfigure --frontend noninteractive tzdata
- python3 -m pip install -U setuptools==51.1.2 wheel pip==20.3.3 kiwi-gtk
script:
- rm -rf dist
- cp setup_old.py setup.py
- python3 setup.py develop
- make deb
artifacts:
paths:
- dist/*.deb
test_stoq_desktop:
image: cprov/stoq:candidate
stage: test
before_script:
- python3 -V
- export LC_ALL=pt_BR.UTF-8
- apt update -yq
- apt install -y software-properties-common
- dpkg-reconfigure --frontend noninteractive tzdata
- apt-add-repository -y ppa:stoq-dev/lancamentos
- apt update -yq
- apt --yes install python3-pip build-essential devscripts debhelper python3-all libcairo2-dev libgirepository1.0-dev gir1.2-webkit2-4.0 build-essential locales git postgresql-client ntp xvfb iso-codes libxss1 gir1.2-webkit-3.0 librsvg2-common poppler-utils libnss3-tools libnss3-dev libusb-1.0-0 libxml2-utils python3-dev python3-zope.interface python3-kiwi python3-psycopg2 python3-pil python3-reportlab python3-dateutil python3-mako python3-lxml python3-xlwt python3-nss python3-storm python3-weasyprint python3-requests python3-openssl python3-pyinotify python3-viivakoodi python3-pykcs11 python3-tz python3-raven python3-aptdaemon.gtk3widgets python3-nose python3-mock python3-pyflakes python3-gevent python3-psutil python3-flask python3-flask-restful python3-blinker python3-tzlocal python3-jwt python3-docutils python3-stoqdrivers libpq-dev
- python3 -m pip install -U setuptools==51.1.2 pip==20.3.3 wheel
- python3 -m pip install -U poetry
- poetry export -f requirements.txt -o requirements.txt --without-hashes --dev
- cat requirements.txt | grep "test\|nose\|zipp" | cut -d " " -f 1 | xargs python3 -m pip install
- python3 setup_old.py develop
- python3 -m pip freeze
script:
- xvfb-run make test TEST_MODULES="stoq plugins"
when: manual
gitlab_pypi_upload:
stage: build
only:
- master
script:
- rm -rf dist/*
- poetry build
- pip install -U twine
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token twine upload --skip-existing --repository-url "https://gitlab.com/api/v4/projects/13882298/packages/pypi" dist/*