Skip to content

Commit 1ec1af9

Browse files
committed
[ci] switch to Drone CI
1 parent d8ce2c0 commit 1ec1af9

File tree

10 files changed

+400
-161
lines changed

10 files changed

+400
-161
lines changed

.drone.jsonnet

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
local
2+
volume_cached_poetry = 'cached-poetry',
3+
volume_cached_deps = 'cached-deps',
4+
5+
git_step = {
6+
name: 'fetch',
7+
image: 'docker:git',
8+
commands: ['git fetch --tags'],
9+
},
10+
py_step(name, commands, version='3.7') = {
11+
name: name,
12+
pull: 'always',
13+
image: 'python:%s' % version,
14+
commands: commands,
15+
volumes: [
16+
{
17+
name: volume_cached_poetry,
18+
path: '/root/.poetry',
19+
},
20+
{
21+
name: volume_cached_deps,
22+
path: '/root/.cache/pypoetry/virtualenvs',
23+
},
24+
],
25+
},
26+
notify_step(name, message) = {
27+
name: name,
28+
pull: 'always',
29+
image: 'appleboy/drone-telegram',
30+
environment: {
31+
PLUGIN_TOKEN: {
32+
from_secret: 'TELEGRAM_BOT_TOKEN',
33+
},
34+
PLUGIN_TO: {
35+
from_secret: 'TELEGRAM_CHAT_ID',
36+
},
37+
PLUGIN_MESSAGE: message,
38+
},
39+
};
40+
41+
{
42+
kind: 'pipeline',
43+
name: 'default',
44+
clone: {
45+
depth: 50,
46+
},
47+
services: [
48+
{
49+
name: 'nats',
50+
image: 'nats',
51+
pull: 'always',
52+
},
53+
],
54+
steps: [
55+
git_step,
56+
py_step('deps-3.6', ['make install'], version='3.6'),
57+
py_step('deps-3.7', ['make install']),
58+
py_step('lint-3.7', ['make lint']),
59+
py_step('test-3.6', ['make test'], version='3.6') {
60+
environment: {
61+
NATS_URL: 'nats://nats:4222',
62+
},
63+
},
64+
py_step('test-3.7', ['make test', 'make codecov']) {
65+
environment: {
66+
NATS_URL: 'nats://nats:4222',
67+
CODECOV_TOKEN: {
68+
from_secret: 'CODECOV_TOKEN',
69+
},
70+
},
71+
},
72+
notify_step('lint/test completed', |||
73+
{{#success build.status}}
74+
`{{repo.name}}` build {{build.number}} succeeded. Good job.
75+
{{else}}
76+
`{{repo.name}}` build {{build.number}} failed. Fix me please.
77+
{{/success}}
78+
|||) {
79+
when: {
80+
branch: ['master'],
81+
event: {
82+
exclude:
83+
['pull_request'],
84+
},
85+
status: [
86+
'success',
87+
'failure',
88+
],
89+
},
90+
},
91+
py_step('publish', ['make publish']) {
92+
environment: {
93+
PYPI_USERNAME: {
94+
from_secret: 'PYPI_USERNAME',
95+
},
96+
PYPI_PASSWORD: {
97+
from_secret: 'PYPI_PASSWORD',
98+
},
99+
},
100+
when: {
101+
event: ['tag'],
102+
},
103+
},
104+
notify_step('publish completed', |||
105+
{{#success build.status}}
106+
`{{repo.name}}` publish {{build.tag}} succeeded. Good job.
107+
{{else}}
108+
`{{repo.name}}` publish {{build.tag}} failed. Fix me please.
109+
{{/success}}
110+
|||) {
111+
when: {
112+
event: ['tag'],
113+
status: [
114+
'success',
115+
'failure',
116+
],
117+
},
118+
},
119+
],
120+
volumes: [
121+
{
122+
name: volume_cached_poetry,
123+
temp: {},
124+
},
125+
{
126+
name: volume_cached_deps,
127+
temp: {},
128+
},
129+
],
130+
}

.drone.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
---
2+
kind: pipeline
3+
name: default
4+
5+
platform:
6+
os: linux
7+
arch: amd64
8+
9+
clone:
10+
depth: 50
11+
12+
steps:
13+
- name: fetch
14+
image: docker:git
15+
commands:
16+
- git fetch --tags
17+
18+
- name: deps-3.6
19+
pull: always
20+
image: python:3.6
21+
commands:
22+
- make install
23+
volumes:
24+
- name: cached-poetry
25+
path: /root/.poetry
26+
- name: cached-deps
27+
path: /root/.cache/pypoetry/virtualenvs
28+
29+
- name: deps-3.7
30+
pull: always
31+
image: python:3.7
32+
commands:
33+
- make install
34+
volumes:
35+
- name: cached-poetry
36+
path: /root/.poetry
37+
- name: cached-deps
38+
path: /root/.cache/pypoetry/virtualenvs
39+
40+
- name: lint-3.7
41+
pull: always
42+
image: python:3.7
43+
commands:
44+
- make lint
45+
volumes:
46+
- name: cached-poetry
47+
path: /root/.poetry
48+
- name: cached-deps
49+
path: /root/.cache/pypoetry/virtualenvs
50+
51+
- name: test-3.6
52+
pull: always
53+
image: python:3.6
54+
commands:
55+
- make test
56+
environment:
57+
NATS_URL: nats://nats:4222
58+
volumes:
59+
- name: cached-poetry
60+
path: /root/.poetry
61+
- name: cached-deps
62+
path: /root/.cache/pypoetry/virtualenvs
63+
64+
- name: test-3.7
65+
pull: always
66+
image: python:3.7
67+
commands:
68+
- make test
69+
- make codecov
70+
environment:
71+
CODECOV_TOKEN:
72+
from_secret: CODECOV_TOKEN
73+
NATS_URL: nats://nats:4222
74+
volumes:
75+
- name: cached-poetry
76+
path: /root/.poetry
77+
- name: cached-deps
78+
path: /root/.cache/pypoetry/virtualenvs
79+
80+
- name: lint/test completed
81+
pull: always
82+
image: appleboy/drone-telegram
83+
environment:
84+
PLUGIN_MESSAGE: "{{#success build.status}}\n `{{repo.name}}` build {{build.number}} succeeded. Good job.\n{{else}}\n `{{repo.name}}` build {{build.number}} failed. Fix me please.\n{{/success}}\n"
85+
PLUGIN_TO:
86+
from_secret: TELEGRAM_CHAT_ID
87+
PLUGIN_TOKEN:
88+
from_secret: TELEGRAM_BOT_TOKEN
89+
when:
90+
branch:
91+
- master
92+
event:
93+
exclude:
94+
- pull_request
95+
status:
96+
- success
97+
- failure
98+
99+
- name: publish
100+
pull: always
101+
image: python:3.7
102+
commands:
103+
- make publish
104+
environment:
105+
PYPI_PASSWORD:
106+
from_secret: PYPI_PASSWORD
107+
PYPI_USERNAME:
108+
from_secret: PYPI_USERNAME
109+
volumes:
110+
- name: cached-poetry
111+
path: /root/.poetry
112+
- name: cached-deps
113+
path: /root/.cache/pypoetry/virtualenvs
114+
when:
115+
event:
116+
- tag
117+
118+
- name: publish completed
119+
pull: always
120+
image: appleboy/drone-telegram
121+
environment:
122+
PLUGIN_MESSAGE: "{{#success build.status}}\n `{{repo.name}}` publish {{build.tag}} succeeded. Good job.\n{{else}}\n `{{repo.name}}` publish {{build.tag}} failed. Fix me please.\n{{/success}}\n"
123+
PLUGIN_TO:
124+
from_secret: TELEGRAM_CHAT_ID
125+
PLUGIN_TOKEN:
126+
from_secret: TELEGRAM_BOT_TOKEN
127+
when:
128+
event:
129+
- tag
130+
status:
131+
- success
132+
- failure
133+
134+
services:
135+
- name: nats
136+
pull: always
137+
image: nats
138+
139+
volumes:
140+
- name: cached-poetry
141+
temp: {}
142+
- name: cached-deps
143+
temp: {}
144+
145+
...

.editorconfig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ end_of_line = lf
66
insert_final_newline = true
77
trim_trailing_whitespace = true
88

9-
[*.{py,md,ini,cfg,in}]
10-
indent_style = space
11-
indent_size = 4
12-
13-
[*.{json,yml}]
9+
[*.{jsonnet,md,toml,yml}]
1410
indent_style = space
1511
indent_size = 2
12+
13+
[Makefile]
14+
indent_style = tab
15+
indent_size = tab

.isort.cfg

Lines changed: 0 additions & 22 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)