From 6e1642670909f4c8fc3f82387acd7a16502a1e3a Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 25 Feb 2019 17:18:10 +0100 Subject: [PATCH] convert drone config to jsonnet --- .drone.1.yml | 153 ++++++++++++++++++++++++++ .drone.jsonnet | 129 ++++++++++++++++++++++ .drone.yml | 285 +++++++++++++++++++++++-------------------------- 3 files changed, 418 insertions(+), 149 deletions(-) create mode 100644 .drone.1.yml create mode 100644 .drone.jsonnet diff --git a/.drone.1.yml b/.drone.1.yml new file mode 100644 index 0000000..297ff11 --- /dev/null +++ b/.drone.1.yml @@ -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 }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
Message: {{ build.message }}" + username: + from_secret: matrix_username + password: + from_secret: matrix_password + depends_on: + - pypi_publish + when: + status: + - success + - failure diff --git a/.drone.jsonnet b/.drone.jsonnet new file mode 100644 index 0000000..0baf6f1 --- /dev/null +++ b/.drone.jsonnet @@ -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 }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
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, +] diff --git a/.drone.yml b/.drone.yml index 297ff11..9a13bc9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,153 +1,140 @@ --- kind: pipeline -name: default +name: testing + +platform: + os: linux + arch: amd64 + +steps: +- name: python2.7 + pull: always + image: python:2.7 + commands: + - pip install tox -q + - "tox -e $(tox -l | grep py27 | xargs | sed 's/ /,/g') -q" + depends_on: + - clone + +- name: python3.5 + pull: always + image: python:3.5 + commands: + - pip install tox -q + - "tox -e $(tox -l | grep py27 | xargs | sed 's/ /,/g') -q" + depends_on: + - clone + +- name: python3.6 + pull: always + image: python:3.6 + commands: + - pip install tox -q + - "tox -e $(tox -l | grep py27 | xargs | sed 's/ /,/g') -q" + depends_on: + - clone + +- name: python3.7 + pull: always + image: python:3.7 + commands: + - pip install tox -q + - "tox -e $(tox -l | grep py27 | xargs | sed 's/ /,/g') -q" + depends_on: + - clone + +--- +kind: pipeline +name: build + +platform: + os: linux + arch: amd64 + +steps: +- name: build + pull: always + image: python:3.7 + commands: + - python setup.py sdist bdist_wheel + +- name: checksum + pull: always + image: alpine + commands: + - apk add --no-cache coreutils + - "sha256sum -b dist/* > sha256sum.txt" + +- name: gpg-sign + pull: always + image: plugins/gpgsign:1 + settings: + detach_sign: true + files: + - "dist/*" + key: + from_secret: gpgsign_key + passphrase: + from_secret: gpgsign_passphrase + +- name: publish-github + pull: always + image: plugins/github-release + settings: + api_key: + from_secret: github_token + files: + - "dist/*" + - sha256sum.txt + when: + event: + - tag + +# - name: publish-pypi +# pull: always +# image: plugins/pypi +# settings: +# password: +# from_secret: pypi_password +# repository: https://upload.pypi.org/legacy/ +# skip_build: true +# username: +# from_secret: pypi_username +# when: +# event: +# - tag + +depends_on: +- testing + +--- +kind: pipeline +name: notifications + +platform: + os: linux + arch: amd64 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 }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
Message: {{ build.message }}" - username: - from_secret: matrix_username - password: - from_secret: matrix_password - depends_on: - - pypi_publish - when: - status: - - success - - failure +- image: plugins/matrix + settings: + homeserver: https://matrix.rknet.org + password: + from_secret: matrix_password + roomid: MtidqQXWWAtQcByBhH:rknet.org + template: "Status: **{{ build.status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
Message: {{ build.message }}" + username: + from_secret: matrix_username + +trigger: + event: + - push + - tag + status: + - success + - failure + +depends_on: +- build + +...