This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcircle.yml
113 lines (105 loc) · 4.51 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
defaults: &defaults
docker:
- image: circleci/python:3.4-jessie-browsers
- image: circleci/postgres:9.4.12-alpine
environment:
- POSTGRES_USER: ubuntu
- POSTGRES_DB: circle_test
- image: docker.elastic.co/elasticsearch/elasticsearch:6.2.2
environment:
- cluster.name: elasticsearch
- xpack.security.enabled: false
- network.host: 0.0.0.0
- http.port: 9200
- discovery.type: single-node
version: 2.0
jobs:
install_and_build:
<<: *defaults
working_directory: ~/circleci-flaskphilo
steps:
- checkout
- run:
name: Dependencies
command: |
git clone https://github.com/awslabs/git-secrets.git && cd git-secrets && sudo make install
git secrets --register-aws ; git secrets --add '[a-zA-Z0-9]{20,}@(.*)$' ; git secrets --add '\-{5}BEGIN\ RSA\ PRIVATE\ KEY-{5}' ; git secrets --scan --scan-history -r .
sudo pip3 install -r ~/circleci-flaskphilo/test/tools/provision/requirements.txt
sudo pip3 install flake8
cd ~/circleci-flaskphilo
- run:
name: Setting Redis
command: |
wget http://download.redis.io/releases/redis-4.0.1.tar.gz
tar xzf redis-4.0.1.tar.gz
cd redis-4.0.1 && make
- run:
command: ~/circleci-flaskphilo/redis-4.0.1/src/redis-server
background: true
- run:
command: |
cd ~/circleci-flaskphilo
- run:
command: |
sudo apt-get install -y postgresql-client
sleep 10 && wget --waitretry=5 --retry-connrefused -v http://127.0.0.1:9200/
psql -h localhost -p 5432 -U postgres -c "CREATE ROLE ds WITH ENCRYPTED PASSWORD 'dsps';"
psql -h localhost -p 5432 -U postgres -c "ALTER ROLE ds WITH ENCRYPTED PASSWORD 'dsps'";
psql -h localhost -p 5432 -U postgres -c "ALTER ROLE ds SET client_encoding TO 'utf8';"
psql -h localhost -p 5432 -U postgres -c "ALTER ROLE ds WITH LOGIN;"
psql -h localhost -p 5432 -U postgres -c "ALTER ROLE ds SET default_transaction_isolation TO 'read committed';"
psql -h localhost -p 5432 -U postgres -c "ALTER ROLE ds SET timezone TO 'UTC';"
psql -h localhost -p 5432 -U postgres -c "CREATE DATABASE ds;"
psql -h localhost -p 5432 -U postgres -c "CREATE DATABASE ds_test;"
psql -h localhost -p 5432 -U postgres -c "ALTER DATABASE ds OWNER TO ds;"
psql -h localhost -p 5432 -U postgres -c "ALTER DATABASE ds_test OWNER TO ds;"
psql -h localhost -p 5432 -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE ds to ds;"
psql -h localhost -p 5432 -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE ds_test to ds;"
psql -h localhost -p 5432 -U postgres -c "CREATE DATABASE ds2;"
psql -h localhost -p 5432 -U postgres -c "CREATE DATABASE ds2_test;"
psql -h localhost -p 5432 -U postgres -c "ALTER DATABASE ds2 OWNER TO ds;"
psql -h localhost -p 5432 -U postgres -c "ALTER DATABASE ds2_test OWNER TO ds;"
psql -h localhost -p 5432 -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE ds2 to ds;"
psql -h localhost -p 5432 -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE ds2_test to ds;"
flake8 --exclude build,bin ./
cd ~/circleci-flaskphilo/test; python3 manage.py test --settings tests.config.ci --q tests/
deployment_production:
<<: *defaults
working_directory: ~/circleci-flaskphilo
steps:
- checkout
- run:
command: |
sudo pip3 install --upgrade setuptools
sed -i "s/USER/$RIFF_USER/g" .pypirc
sed -i "s/PASS/$RIFF_PASS/g" .pypirc
sed -i "s/GITHUB_TAG/$CIRCLE_TAG/" setup-circle.py
cp .pypirc ~
sed -i "s|version='.*',|version='${CIRCLE_TAG}',|g" setup.py
python3 setup.py sdist upload -r pypi
workflows:
version: 2
build-only:
jobs:
- install_and_build:
filters:
branches:
ignore:
- dev
- /feature\/.*
build-and-deploy-production:
jobs:
- install_and_build:
filters:
branches:
ignore: /.*/
tags:
only: /[0-9]*\..*/
- deployment_production:
requires:
- install_and_build
filters:
branches:
ignore: /.*/
tags:
only: /[0-9]*\..*/