forked from open-craft/problem-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcircle.yml
More file actions
174 lines (171 loc) · 5.26 KB
/
Copy pathcircle.yml
File metadata and controls
174 lines (171 loc) · 5.26 KB
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
version: 2.1
jobs:
build:
docker:
- image: <<parameters.docker_image>>
- image: circleci/mysql:5.6
command: mysqld --character-set-server=latin1 --collation-server=latin1_swedish_ci
environment:
MYSQL_ROOT_PASSWORD: rootpw
parameters:
test_command:
type: string
docker_image:
type: string
environment:
MOZ_HEADLESS: 1
WORKBENCH_DATABASES: '{"default": {"ENGINE": "django.db.backends.mysql", "NAME": "db", "USER": "root", "PASSWORD": "rootpw", "HOST": "127.0.0.1", "OPTIONS": {"charset": "utf8mb4"}}}'
steps:
- checkout
- run:
name: Update system
command: |
sudo apt-get update
sudo apt-get install -y libgtk3.0-cil-dev libasound2 libasound2 libdbus-glib-1-2 libdbus-1-3 libgtk2.0-0 default-libmysqlclient-dev
- run:
name: Install geckodriver
command: |
wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz
tar xzf geckodriver-v0.26.0-linux64.tar.gz
sudo mv geckodriver /usr/local/bin/geckodriver
which geckodriver
- run:
name: Install new firefox
command: |
wget https://archive.mozilla.org/pub/firefox/releases/70.0.1/linux-x86_64/en-US/firefox-70.0.1.tar.bz2
tar jxf firefox-70.0.1.tar.bz2
export PATH="$(pwd)/firefox/:$PATH"
- run:
name: Sync submodules
command: git submodule sync
- run:
name: Update submodules
command: git submodule update --init
- run:
name: Run tests
command: |
export PATH="$(pwd)/firefox/:$PATH"
mkdir -p /tmp/coverage/$CIRCLE_SHA1
virtualenv venv
source venv/bin/activate
pip -q install -r test_requirements.txt
pip install -e .
<<parameters.test_command>>
if [ -e .coverage.* ]; then
cp .coverage.* /tmp/coverage/$CIRCLE_SHA1/.
fi
- persist_to_workspace:
root: /tmp
paths:
- coverage
coverage:
docker:
- image: <<parameters.docker_image>>
parameters:
docker_image:
type: string
steps:
- checkout
- run:
name: Update system and install deps
command: |
sudo apt-get update
virtualenv venv
source venv/bin/activate
pip install 'coverage==5.0.3'
- attach_workspace:
at: /tmp/workspace
- run:
command: |
source venv/bin/activate
coverage combine /tmp/workspace/coverage/$CIRCLE_SHA1/
coverage report
deploy:
docker:
- image: <<parameters.docker_image>>
parameters:
docker_image:
type: string
dist_type:
type: string
steps:
- checkout
- restore_cache:
key: dependencies-{{ checksum "circle.yml" }}-{{ checksum "setup.py" }}
- run:
name: Install dependencies
command: |
virtualenv venv
source venv/bin/activate
pip install -U pip twine wheel
- save_cache:
key: dependencies-{{ checksum "circle.yml" }}-{{ checksum "setup.py" }}
paths:
- "venv"
- run:
name: Verify commit is tagged and tag matches version
command: |
source venv/bin/activate
python setup.py verify_tag
- run:
name: Initialize .pypirc
command: |
echo -e "[pypi]" >> ~/.pypirc
echo -e "username = opencraft" >> ~/.pypirc
echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
- run:
name: Create packages
command: |
source venv/bin/activate
python setup.py <<parameters.dist_type>>
- run:
name: Upload to pypi
command: |
source venv/bin/activate
twine upload dist/*
workflows:
version: 2
build_and_deploy:
jobs:
- build:
name: py35-quality
test_command: make quality
docker_image: circleci/python:3.5-buster-browsers
filters:
tags:
only: /.*/
- build:
name: py35-unit
test_command: make test.unit
docker_image: circleci/python:3.5-buster-browsers
filters:
tags:
only: /.*/
- build:
name: py35-integration
test_command: make test.integration
docker_image: circleci/python:3.5-buster-browsers
filters:
tags:
only: /.*/
- coverage:
name: py35-coverage
docker_image: circleci/python:3.5-buster
filters:
tags:
only: /.*/
requires:
- py35-quality
- py35-unit
- py35-integration
- deploy:
name: py35-deploy-bdist_wheel
docker_image: circleci/python:3.5-buster
dist_type: bdist_wheel
requires:
- py35-coverage
filters:
tags:
only: /v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/