Skip to content

Commit

Permalink
[ci] switch to Drone CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Gr1N committed Jul 31, 2019
1 parent d8ce2c0 commit 1ec1af9
Show file tree
Hide file tree
Showing 10 changed files with 400 additions and 161 deletions.
130 changes: 130 additions & 0 deletions .drone.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
local
volume_cached_poetry = 'cached-poetry',
volume_cached_deps = 'cached-deps',

git_step = {
name: 'fetch',
image: 'docker:git',
commands: ['git fetch --tags'],
},
py_step(name, commands, version='3.7') = {
name: name,
pull: 'always',
image: 'python:%s' % version,
commands: commands,
volumes: [
{
name: volume_cached_poetry,
path: '/root/.poetry',
},
{
name: volume_cached_deps,
path: '/root/.cache/pypoetry/virtualenvs',
},
],
},
notify_step(name, message) = {
name: name,
pull: 'always',
image: 'appleboy/drone-telegram',
environment: {
PLUGIN_TOKEN: {
from_secret: 'TELEGRAM_BOT_TOKEN',
},
PLUGIN_TO: {
from_secret: 'TELEGRAM_CHAT_ID',
},
PLUGIN_MESSAGE: message,
},
};

{
kind: 'pipeline',
name: 'default',
clone: {
depth: 50,
},
services: [
{
name: 'nats',
image: 'nats',
pull: 'always',
},
],
steps: [
git_step,
py_step('deps-3.6', ['make install'], version='3.6'),
py_step('deps-3.7', ['make install']),
py_step('lint-3.7', ['make lint']),
py_step('test-3.6', ['make test'], version='3.6') {
environment: {
NATS_URL: 'nats://nats:4222',
},
},
py_step('test-3.7', ['make test', 'make codecov']) {
environment: {
NATS_URL: 'nats://nats:4222',
CODECOV_TOKEN: {
from_secret: 'CODECOV_TOKEN',
},
},
},
notify_step('lint/test completed', |||
{{#success build.status}}
`{{repo.name}}` build {{build.number}} succeeded. Good job.
{{else}}
`{{repo.name}}` build {{build.number}} failed. Fix me please.
{{/success}}
|||) {
when: {
branch: ['master'],
event: {
exclude:
['pull_request'],
},
status: [
'success',
'failure',
],
},
},
py_step('publish', ['make publish']) {
environment: {
PYPI_USERNAME: {
from_secret: 'PYPI_USERNAME',
},
PYPI_PASSWORD: {
from_secret: 'PYPI_PASSWORD',
},
},
when: {
event: ['tag'],
},
},
notify_step('publish completed', |||
{{#success build.status}}
`{{repo.name}}` publish {{build.tag}} succeeded. Good job.
{{else}}
`{{repo.name}}` publish {{build.tag}} failed. Fix me please.
{{/success}}
|||) {
when: {
event: ['tag'],
status: [
'success',
'failure',
],
},
},
],
volumes: [
{
name: volume_cached_poetry,
temp: {},
},
{
name: volume_cached_deps,
temp: {},
},
],
}
145 changes: 145 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
---
kind: pipeline
name: default

platform:
os: linux
arch: amd64

clone:
depth: 50

steps:
- name: fetch
image: docker:git
commands:
- git fetch --tags

- name: deps-3.6
pull: always
image: python:3.6
commands:
- make install
volumes:
- name: cached-poetry
path: /root/.poetry
- name: cached-deps
path: /root/.cache/pypoetry/virtualenvs

- name: deps-3.7
pull: always
image: python:3.7
commands:
- make install
volumes:
- name: cached-poetry
path: /root/.poetry
- name: cached-deps
path: /root/.cache/pypoetry/virtualenvs

- name: lint-3.7
pull: always
image: python:3.7
commands:
- make lint
volumes:
- name: cached-poetry
path: /root/.poetry
- name: cached-deps
path: /root/.cache/pypoetry/virtualenvs

- name: test-3.6
pull: always
image: python:3.6
commands:
- make test
environment:
NATS_URL: nats://nats:4222
volumes:
- name: cached-poetry
path: /root/.poetry
- name: cached-deps
path: /root/.cache/pypoetry/virtualenvs

- name: test-3.7
pull: always
image: python:3.7
commands:
- make test
- make codecov
environment:
CODECOV_TOKEN:
from_secret: CODECOV_TOKEN
NATS_URL: nats://nats:4222
volumes:
- name: cached-poetry
path: /root/.poetry
- name: cached-deps
path: /root/.cache/pypoetry/virtualenvs

- name: lint/test completed
pull: always
image: appleboy/drone-telegram
environment:
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"
PLUGIN_TO:
from_secret: TELEGRAM_CHAT_ID
PLUGIN_TOKEN:
from_secret: TELEGRAM_BOT_TOKEN
when:
branch:
- master
event:
exclude:
- pull_request
status:
- success
- failure

- name: publish
pull: always
image: python:3.7
commands:
- make publish
environment:
PYPI_PASSWORD:
from_secret: PYPI_PASSWORD
PYPI_USERNAME:
from_secret: PYPI_USERNAME
volumes:
- name: cached-poetry
path: /root/.poetry
- name: cached-deps
path: /root/.cache/pypoetry/virtualenvs
when:
event:
- tag

- name: publish completed
pull: always
image: appleboy/drone-telegram
environment:
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"
PLUGIN_TO:
from_secret: TELEGRAM_CHAT_ID
PLUGIN_TOKEN:
from_secret: TELEGRAM_BOT_TOKEN
when:
event:
- tag
status:
- success
- failure

services:
- name: nats
pull: always
image: nats

volumes:
- name: cached-poetry
temp: {}
- name: cached-deps
temp: {}

...
10 changes: 5 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{py,md,ini,cfg,in}]
indent_style = space
indent_size = 4

[*.{json,yml}]
[*.{jsonnet,md,toml,yml}]
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab
indent_size = tab
22 changes: 0 additions & 22 deletions .isort.cfg

This file was deleted.

46 changes: 0 additions & 46 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 1ec1af9

Please sign in to comment.