convert drone config to jsonnet

This commit is contained in:
Robert Kaussow 2019-02-25 17:18:10 +01:00
parent 2986f8771e
commit 6e16426709
3 changed files with 409 additions and 140 deletions

153
.drone.1.yml Normal file
View File

@ -0,0 +1,153 @@
---
kind: pipeline
name: default
steps:
- name: test2.7
image: python:2.7-stretch
pull: always
environment:
PY_COLORS: "1"
commands:
- pip install tox -q
- tox -e $(tox -l | grep py27 | xargs | sed 's/ /,/g') -q
when:
event:
- push
- tag
- name: test3.5
image: python:3.5-stretch
pull: always
environment:
PY_COLORS: "1"
commands:
- pip install tox -q
- tox -e $(tox -l | grep py35 | xargs | sed 's/ /,/g') -q
when:
event:
- push
- tag
- name: test3.6
image: python:3.6-stretch
pull: always
environment:
PY_COLORS: "1"
commands:
- pip install tox -q
- tox -e $(tox -l | grep py36 | xargs | sed 's/ /,/g') -q
when:
event:
- push
- tag
- name: test3.7
image: python:3.7-stretch
pull: always
environment:
PY_COLORS: "1"
commands:
- pip install tox -q
- tox -e $(tox -l | grep py37 | xargs | sed 's/ /,/g') -q
when:
event:
- push
- tag
- name: build
image: python:3.7-alpine
pull: true
commands:
- python setup.py sdist bdist_wheel
when:
event:
- push
- tag
depends_on:
- test2.7
- test3.5
- test3.6
- test3.7
- name: checksum
image: alpine
pull: always
commands:
- apk add --no-cache coreutils
# exclude files
# - sha256sum -b files/!(*.out) > CHECKSUMFILE
- sha256sum -b dist/* > sha256sum.txt
depends_on:
- build
when:
event:
- push
- tag
- name: gpgsign
image: plugins/gpgsign:1
pull: always
settings:
key:
from_secret: gpgsign_key
passphrase:
from_secret: gpgsign_passphrase
detach_sign: true
files:
- dist/*
depends_on:
- checksum
when:
event:
- push
- tag
- name: publish
image: plugins/github-release
settings:
api_key:
from_secret: github_token
files:
- dist/*
- sha256sum.txt
title: $${DRONE_TAG}
note: CHANGELOG.md
depends_on:
- gpgsign
when:
event:
- tag
- name: pypi_publish
image: xoxys/drone-pypi:0.1.0
pull: always
settings:
username:
from_secret: pypi_username
password:
from_secret: pypi_password
repository: https://upload.pypi.org/legacy/
skip_build: true
depends_on:
- publish
when:
event:
- tag
- name: notify
image: plugins/matrix
settings:
homeserver: https://matrix.rknet.org
roomid: MtidqQXWWAtQcByBhH:rknet.org
template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}"
username:
from_secret: matrix_username
password:
from_secret: matrix_password
depends_on:
- pypi_publish
when:
status:
- success
- failure

129
.drone.jsonnet Normal file
View File

@ -0,0 +1,129 @@
local PythonVersions(pyversion="2.7", py="27") = {
name: "python" + pyversion,
image: "python:" + pyversion,
pull: "always",
commands: [
"pip install tox -q",
"tox -e $(tox -l | grep py" + py + " | xargs | sed 's/ /,/g') -q",
],
depends_on: [
"clone",
],
};
local PipelineTesting = {
kind: "pipeline",
name: "testing",
platform: {
os: "linux",
arch: "amd64",
},
steps: [
PythonVersions(pyversion="2.7"),
PythonVersions(pyversion="3.5"),
PythonVersions(pyversion="3.6"),
PythonVersions(pyversion="3.7"),
],
};
local PipelineBuild = {
kind: "pipeline",
name: "build",
platform: {
os: "linux",
arch: "amd64",
},
steps: [
{
name: "build",
image: "python:3.7",
pull: "always",
commands: [
"python setup.py sdist bdist_wheel",
]
},
{
name: "checksum",
image: "alpine",
pull: "always",
commands: [
"apk add --no-cache coreutils",
"sha256sum -b dist/* > sha256sum.txt"
],
},
{
name: "gpg-sign",
image: "plugins/gpgsign:1",
pull: "always",
settings: {
key: { "from_secret": "gpgsign_key" },
passphrase: { "from_secret": "gpgsign_passphrase" },
detach_sign: true,
files: [ "dist/*" ],
},
},
{
name: "publish-github",
image: "plugins/github-release",
pull: "always",
settings: {
api_key: { "from_secret": "github_token"},
files: ["dist/*", "sha256sum.txt"],
},
when: {
event: [ "tag" ],
},
},
{
name: "publish-pypi",
image: "plugins/pypi",
pull: "always",
settings: {
username: { "from_secret": "pypi_username" },
password: { "from_secret": "pypi_password" },
repository: "https://upload.pypi.org/legacy/",
skip_build: true
},
when: {
event: [ "tag" ],
},
},
],
depends_on: [
"testing",
],
};
local PipelineNotifications = {
kind: "pipeline",
name: "notifications",
platform: {
os: "linux",
arch: "amd64",
},
steps: [
{
image: "plugins/matrix",
settings: {
homeserver: "https://matrix.rknet.org",
roomid: "MtidqQXWWAtQcByBhH:rknet.org",
template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}",
username: { "from_secret": "matrix_username" },
password: { "from_secret": "matrix_password" },
},
},
],
depends_on: [
"build",
],
trigger: {
event: [ "push", "tag" ],
status: [ "success", "failure" ],
},
};
[
PipelineTesting,
PipelineBuild,
PipelineNotifications,
]

View File

@ -1,153 +1,140 @@
--- ---
kind: pipeline kind: pipeline
name: default name: testing
platform:
os: linux
arch: amd64
steps: steps:
- name: test2.7 - name: python2.7
image: python:2.7-stretch
pull: always pull: always
environment: image: python:2.7
PY_COLORS: "1"
commands: commands:
- pip install tox -q - pip install tox -q
- tox -e $(tox -l | grep py27 | xargs | sed 's/ /,/g') -q - "tox -e $(tox -l | grep py27 | xargs | sed 's/ /,/g') -q"
when: depends_on:
event: - clone
- push
- tag
- name: test3.5 - name: python3.5
image: python:3.5-stretch
pull: always pull: always
environment: image: python:3.5
PY_COLORS: "1"
commands: commands:
- pip install tox -q - pip install tox -q
- tox -e $(tox -l | grep py35 | xargs | sed 's/ /,/g') -q - "tox -e $(tox -l | grep py27 | xargs | sed 's/ /,/g') -q"
when: depends_on:
event: - clone
- push
- tag
- name: test3.6 - name: python3.6
image: python:3.6-stretch
pull: always pull: always
environment: image: python:3.6
PY_COLORS: "1"
commands: commands:
- pip install tox -q - pip install tox -q
- tox -e $(tox -l | grep py36 | xargs | sed 's/ /,/g') -q - "tox -e $(tox -l | grep py27 | xargs | sed 's/ /,/g') -q"
when: depends_on:
event: - clone
- push
- tag
- name: test3.7 - name: python3.7
image: python:3.7-stretch
pull: always pull: always
environment: image: python:3.7
PY_COLORS: "1"
commands: commands:
- pip install tox -q - pip install tox -q
- tox -e $(tox -l | grep py37 | xargs | sed 's/ /,/g') -q - "tox -e $(tox -l | grep py27 | xargs | sed 's/ /,/g') -q"
when: depends_on:
event: - clone
- push
- tag
- name: build ---
image: python:3.7-alpine kind: pipeline
pull: true name: build
platform:
os: linux
arch: amd64
steps:
- name: build
pull: always
image: python:3.7
commands: commands:
- python setup.py sdist bdist_wheel - python setup.py sdist bdist_wheel
when:
event:
- push
- tag
depends_on:
- test2.7
- test3.5
- test3.6
- test3.7
- name: checksum - name: checksum
image: alpine
pull: always pull: always
image: alpine
commands: commands:
- apk add --no-cache coreutils - apk add --no-cache coreutils
# exclude files - "sha256sum -b dist/* > sha256sum.txt"
# - sha256sum -b files/!(*.out) > CHECKSUMFILE
- sha256sum -b dist/* > sha256sum.txt
depends_on:
- build
when:
event:
- push
- tag
- name: gpgsign - name: gpg-sign
image: plugins/gpgsign:1
pull: always pull: always
image: plugins/gpgsign:1
settings: settings:
detach_sign: true
files:
- "dist/*"
key: key:
from_secret: gpgsign_key from_secret: gpgsign_key
passphrase: passphrase:
from_secret: gpgsign_passphrase from_secret: gpgsign_passphrase
detach_sign: true
files:
- dist/*
depends_on:
- checksum
when:
event:
- push
- tag
- name: publish - name: publish-github
pull: always
image: plugins/github-release image: plugins/github-release
settings: settings:
api_key: api_key:
from_secret: github_token from_secret: github_token
files: files:
- dist/* - "dist/*"
- sha256sum.txt - sha256sum.txt
title: $${DRONE_TAG}
note: CHANGELOG.md
depends_on:
- gpgsign
when: when:
event: event:
- tag - tag
- name: pypi_publish # - name: publish-pypi
image: xoxys/drone-pypi:0.1.0 # pull: always
pull: always # image: plugins/pypi
settings: # settings:
username: # password:
from_secret: pypi_username # from_secret: pypi_password
password: # repository: https://upload.pypi.org/legacy/
from_secret: pypi_password # skip_build: true
repository: https://upload.pypi.org/legacy/ # username:
skip_build: true # from_secret: pypi_username
depends_on: # when:
- publish # event:
when: # - tag
event:
- tag
- name: notify depends_on:
image: plugins/matrix - testing
---
kind: pipeline
name: notifications
platform:
os: linux
arch: amd64
steps:
- image: plugins/matrix
settings: settings:
homeserver: https://matrix.rknet.org homeserver: https://matrix.rknet.org
password:
from_secret: matrix_password
roomid: MtidqQXWWAtQcByBhH:rknet.org roomid: MtidqQXWWAtQcByBhH:rknet.org
template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}" template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}"
username: username:
from_secret: matrix_username from_secret: matrix_username
password:
from_secret: matrix_password trigger:
depends_on: event:
- pypi_publish - push
when: - tag
status: status:
- success - success
- failure - failure
depends_on:
- build
...