/
config.yml
126 lines (107 loc) · 3.78 KB
/
config.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
version: 2
jobs:
build:
# branches:
# only:
# - master
# - dev
docker:
- image: circleci/python:3.8-node-browsers
environment:
PGUSER: postgres
PGHOST: localhost
PGPORT: 5432
PGDATABASE: bpp
DJANGO_BPP_SECRET_KEY: foobar
DJANGO_SETTINGS_MODULE: django_bpp.settings.test
- image: mpasternak79/circleci-postgres:12
environment:
POSTGRESS_PASSWORD: password
POSTGRES_HOST_AUTH_METHOD: trust
- image: redis:latest
steps:
- setup_remote_docker
- run:
name: install postgresql-client
command: |
sudo apt install -y postgresql-client
- run:
name: create database
command: |
createdb bpp
- checkout
- restore_cache:
key: cache-10-{{ checksum "requirements.txt" }}-{{ checksum "requirements_dev.txt" }}-{{ checksum "yarn.lock" }}
- run: sudo apt --quiet install -y --quiet gettext locales
- run: sudo sed -i 's/^# *\(pl_PL.UTF-8\)/\1/' /etc/locale.gen
- run: sudo locale-gen
- run: sudo sh -c 'LANG=pl_PL.UTF-8 > /etc/default/locale'
- run: export LC_ALL=pl_PL.UTF-8
- run: locale
- run: sudo npm install -g grunt-cli
- run: sudo pip install --upgrade pip
- run:
name: venv
command: |
mkdir -p ./venv
virtualenv ./venv
. venv/bin/activate
pip install --upgrade pip
pip install -q -r requirements.txt -r requirements_dev.txt
- run:
name: migrate database
command: |
. venv/bin/activate
python src/manage.py migrate
- run:
name: make assets
command: |
. venv/bin/activate
make assets
- save_cache: # cache Python dependencies using checksum of Pipfile as the cache-key
key: cache-10-{{ checksum "requirements.txt" }}-{{ checksum "requirements_dev.txt" }}-{{ checksum "yarn.lock" }}
paths:
- "/home/circleci/.cache"
# Sklonuj bazy danych, zeby było kapke szybciej
- run:
name: clone bpp to testing databases gw0, gw1
command: |
createdb test_bpp_gw0 -T bpp
createdb test_bpp_gw1 -T bpp
# Uruchamiaj na lokalnym firefoxie używając dwóch CPU
- run:
name: pytest
command: |
. venv/bin/activate
pytest -d -n 2 --splinter-headless --cov=src --ds=django_bpp.settings.test # src/integration_tests/test_global_search.py
# Testy JavaScript
- run: make js-tests
# Wyślij statystyki pokrycia kodu testami do coveralls.io
- run:
name: Submit coverage to coveralls.io
command: |
. venv/bin/activate
coveralls
# Zbuduj pakiet WHL -- bez wrzucania go na serwer (próbnie)
- run:
name: create ONLY whl package -- only on DEV
command: |
. venv/bin/activate
if [ $CIRCLE_BRANCH = 'dev' ]; then make bdist_wheel; fi
# Skonfiguruj PyPI
- run:
name: init .pypirc
command: |
echo -e "[distutils]" > ~/.pypirc
echo -e "index-servers = pypi" >> ~/.pypirc
echo -e "[pypi]" >> ~/.pypirc
echo -e "repository = https://upload.pypi.org/legacy/" >> ~/.pypirc
echo -e "username = dotz" >> ~/.pypirc
echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
# Zbuduj pakiet
- run:
name: create and upload packages -- only on MASTER
command: |
. venv/bin/activate
cat ~/.pypirc | grep -v password
if [ $CIRCLE_BRANCH = 'master' ]; then make bdist_wheel upload; fi