forked from open-craft/problem-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle.yml
131 lines (129 loc) · 3.84 KB
/
circle.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
version: 2.1
orbs:
browser-tools: circleci/[email protected]
jobs:
build:
docker:
- image: <<parameters.docker_image>>
- image: circleci/mysql:5.7
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
parallel:
default: 1
type: integer
parallelism: <<parameters.parallel>>
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
- browser-tools/install-firefox
- browser-tools/install-geckodriver
- run:
name: Sync submodules
command: git submodule sync
- run:
name: Update submodules
command: git submodule update --init
- run:
name: Run tests
command: |
virtualenv venv
source venv/bin/activate
mkdir var
pip -q install -r requirements.txt
pip -q install -r requirements-dev.txt
pip -q install -r test_requirements.txt
pip install -e .
<<parameters.test_command>>
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: py38-quality
test_command: make quality
docker_image: cimg/python:3.8-browsers
filters:
tags:
only: /.*/
- build:
name: py38-unit
test_command: make test.unit
docker_image: cimg/python:3.8-browsers
filters:
tags:
only: /.*/
- build:
name: py38-integration
parallel: 4
test_command: |
set -e
TEST_FILES=$(circleci tests glob "problem_builder/tests/integration/test_*.py" | circleci tests split --split-by=timings)
pytest --verbose $TEST_FILES
docker_image: cimg/python:3.8-browsers
filters:
tags:
only: /.*/
- deploy:
name: py38-deploy-bdist_wheel
docker_image: cimg/python:3.8
dist_type: bdist_wheel
requires:
- py38-quality
- py38-unit
- py38-integration
filters:
tags:
only: /v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/