prepare pypi release

This commit is contained in:
Robert Kaussow 2020-04-11 19:28:56 +02:00
parent b110295dd5
commit 3abce0822e
4 changed files with 262 additions and 197 deletions

View File

@ -1,239 +1,271 @@
local PythonVersion(pyversion="3.5") = {
name: "python" + std.strReplace(pyversion, '.', '') + "-pytest",
image: "python:" + pyversion,
pull: "always",
environment: {
PY_COLORS: 1
},
commands: [
"pip install -r dev-requirements.txt -qq",
"pip install -qq .",
"git-batch --help",
],
depends_on: [
"clone",
],
local PythonVersion(pyversion='3.5') = {
name: 'python' + std.strReplace(pyversion, '.', '') + '-pytest',
image: 'python:' + pyversion,
pull: 'always',
environment: {
PY_COLORS: 1,
},
commands: [
'pip install -r dev-requirements.txt -qq',
'pip install -qq .',
'git-batch --help',
],
depends_on: [
'clone',
],
};
local PipelineLint = {
kind: "pipeline",
name: "lint",
platform: {
os: "linux",
arch: "amd64",
},
steps: [
{
name: "flake8",
image: "python:3.8",
pull: "always",
environment: {
PY_COLORS: 1
},
commands: [
"pip install -r dev-requirements.txt -qq",
"pip install -qq .",
"flake8 ./gitbatch",
],
},
],
trigger: {
ref: ["refs/heads/master", "refs/tags/**", "refs/pull/**"],
kind: 'pipeline',
name: 'lint',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'flake8',
image: 'python:3.8',
pull: 'always',
environment: {
PY_COLORS: 1,
},
commands: [
'pip install -r dev-requirements.txt -qq',
'pip install -qq .',
'flake8 ./gitbatch',
],
},
],
trigger: {
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineTest = {
kind: "pipeline",
name: "test",
platform: {
os: "linux",
arch: "amd64",
},
steps: [
PythonVersion(pyversion="3.5"),
PythonVersion(pyversion="3.6"),
PythonVersion(pyversion="3.7"),
PythonVersion(pyversion="3.8"),
],
trigger: {
ref: ["refs/heads/master", "refs/tags/**", "refs/pull/**"],
},
depends_on: [
"lint",
],
kind: 'pipeline',
name: 'test',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
PythonVersion(pyversion='3.5'),
PythonVersion(pyversion='3.6'),
PythonVersion(pyversion='3.7'),
PythonVersion(pyversion='3.8'),
],
trigger: {
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
},
depends_on: [
'lint',
],
};
local PipelineSecurity = {
kind: "pipeline",
name: "security",
platform: {
os: "linux",
arch: "amd64",
},
steps: [
{
name: "bandit",
image: "python:3.8",
pull: "always",
environment: {
PY_COLORS: 1
},
commands: [
"pip install -r dev-requirements.txt -qq",
"pip install -qq .",
"bandit -r ./gitbatch -x ./gitbatch/tests",
],
},
],
depends_on: [
"test",
],
trigger: {
ref: ["refs/heads/master", "refs/tags/**", "refs/pull/**"],
kind: 'pipeline',
name: 'security',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'bandit',
image: 'python:3.8',
pull: 'always',
environment: {
PY_COLORS: 1,
},
commands: [
'pip install -r dev-requirements.txt -qq',
'pip install -qq .',
'bandit -r ./gitbatch -x ./gitbatch/tests',
],
},
],
depends_on: [
'test',
],
trigger: {
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineBuildContainer(arch="amd64") = {
kind: "pipeline",
name: "build-container-" + arch,
local PipelineBuildPackage = {
kind: 'pipeline',
name: 'build-package',
platform: {
os: "linux",
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'build',
image: 'python:3.8',
commands: [
'python setup.py sdist bdist_wheel',
],
},
{
name: 'checksum',
image: 'alpine',
commands: [
'cd dist/ && sha256sum * > ../sha256sum.txt',
],
},
{
name: 'publish-github',
image: 'plugins/github-release',
settings: {
overwrite: true,
api_key: { from_secret: 'github_token' },
files: ['dist/*', 'sha256sum.txt'],
title: '${DRONE_TAG}',
note: 'CHANGELOG.md',
},
when: {
ref: ['refs/tags/**'],
},
},
{
name: 'publish-pypi',
image: 'plugins/pypi',
settings: {
username: { from_secret: 'pypi_username' },
password: { from_secret: 'pypi_password' },
repository: 'https://upload.pypi.org/legacy/',
skip_build: true,
},
when: {
ref: ['refs/tags/**'],
},
},
],
depends_on: [
'security',
],
trigger: {
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineBuildContainer(arch='amd64') = {
kind: 'pipeline',
name: 'build-container-' + arch,
platform: {
os: 'linux',
arch: arch,
},
steps: [
{
name: "build",
image: "python:3.8",
pull: "always",
name: 'build',
image: 'python:3.8',
pull: 'always',
commands: [
"python setup.py bdist_wheel",
]
'python setup.py bdist_wheel',
],
},
{
name: "dryrun",
image: "plugins/docker:18-linux-" + arch,
pull: "always",
name: 'dryrun',
image: 'plugins/docker:18-linux-' + arch,
pull: 'always',
settings: {
dry_run: true,
dockerfile: "Dockerfile",
repo: "xoxys/git-batch",
username: { "from_secret": "docker_username" },
password: { "from_secret": "docker_password" },
dockerfile: 'Dockerfile',
repo: 'xoxys/git-batch',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
when: {
ref: ["refs/pull/**"],
ref: ['refs/pull/**'],
},
},
{
name: "publish",
image: "plugins/docker:18-linux-" + arch,
pull: "always",
name: 'publish',
image: 'plugins/docker:18-linux-' + arch,
pull: 'always',
settings: {
auto_tag: true,
auto_tag_suffix: arch,
dockerfile: "Dockerfile",
repo: "xoxys/git-batch",
username: { "from_secret": "docker_username" },
password: { "from_secret": "docker_password" },
dockerfile: 'Dockerfile',
repo: 'xoxys/git-batch',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
when: {
ref: ["refs/heads/master", "refs/tags/**"],
ref: ['refs/heads/master', 'refs/tags/**'],
},
},
],
depends_on: [
"security",
'security',
],
trigger: {
ref: ["refs/heads/master", "refs/tags/**", "refs/pull/**"],
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineNotifications = {
kind: "pipeline",
name: "notifications",
kind: 'pipeline',
name: 'notifications',
platform: {
os: "linux",
arch: "amd64",
os: 'linux',
arch: 'amd64',
},
steps: [
{
image: "plugins/manifest",
name: "manifest",
pull: "always",
image: 'plugins/manifest',
name: 'manifest',
settings: {
ignore_missing: true,
auto_tag: true,
username: { from_secret: "docker_username" },
password: { from_secret: "docker_password" },
spec: "manifest.tmpl",
},
when: {
ref: [
'refs/heads/master',
'refs/tags/**',
],
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
spec: 'manifest.tmpl',
},
},
{
name: "readme",
image: "sheogorath/readme-to-dockerhub",
pull: "always",
name: 'readme',
image: 'sheogorath/readme-to-dockerhub',
environment: {
DOCKERHUB_USERNAME: { from_secret: "docker_username" },
DOCKERHUB_PASSWORD: { from_secret: "docker_password" },
DOCKERHUB_REPO_PREFIX: "xoxys",
DOCKERHUB_REPO_NAME: "git-batch",
README_PATH: "README.md",
SHORT_DESCRIPTION: "git-batch"
},
when: {
ref: [
'refs/heads/master',
'refs/tags/**',
],
DOCKERHUB_USERNAME: { from_secret: 'docker_username' },
DOCKERHUB_PASSWORD: { from_secret: 'docker_password' },
DOCKERHUB_REPO_PREFIX: 'xoxys',
DOCKERHUB_REPO_NAME: 'git-batch',
README_PATH: 'README.md',
SHORT_DESCRIPTION: 'git-batch - Automate cloning a single branch from a repo list',
},
},
{
name: "microbadger",
image: "plugins/webhook",
pull: "always",
name: 'matrix',
image: 'plugins/matrix',
settings: {
urls: { from_secret: "microbadger_url" },
},
},
{
name: "matrix",
image: "plugins/matrix",
settings: {
template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}",
roomid: { "from_secret": "matrix_roomid" },
homeserver: { "from_secret": "matrix_homeserver" },
username: { "from_secret": "matrix_username" },
password: { "from_secret": "matrix_password" },
},
when: {
status: [ "success", "failure" ],
homeserver: { from_secret: 'matrix_homeserver' },
roomid: { from_secret: 'matrix_roomid' },
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-container-amd64",
"build-container-arm64",
"build-container-arm"
'docs',
],
trigger: {
ref: ["refs/heads/master", "refs/tags/**"],
status: [ "success", "failure" ],
ref: ['refs/heads/master', 'refs/tags/**'],
status: ['success', 'failure'],
},
};
[
PipelineLint,
PipelineTest,
PipelineSecurity,
PipelineBuildContainer(arch="amd64"),
PipelineBuildContainer(arch="arm64"),
PipelineBuildContainer(arch="arm"),
PipelineNotifications,
PipelineLint,
PipelineTest,
PipelineSecurity,
PipelineBuildPackage,
PipelineBuildContainer(arch='amd64'),
PipelineBuildContainer(arch='arm64'),
PipelineBuildContainer(arch='arm'),
PipelineNotifications,
]

View File

@ -117,6 +117,62 @@ trigger:
depends_on:
- test
---
kind: pipeline
name: build-package
platform:
os: linux
arch: amd64
steps:
- name: build
image: python:3.8
commands:
- python setup.py sdist bdist_wheel
- name: checksum
image: alpine
commands:
- cd dist/ && sha256sum * > ../sha256sum.txt
- name: publish-github
image: plugins/github-release
settings:
api_key:
from_secret: github_token
files:
- dist/*
- sha256sum.txt
note: CHANGELOG.md
overwrite: true
title: ${DRONE_TAG}
when:
ref:
- refs/tags/**
- name: publish-pypi
image: plugins/pypi
settings:
password:
from_secret: pypi_password
repository: https://upload.pypi.org/legacy/
skip_build: true
username:
from_secret: pypi_username
when:
ref:
- refs/tags/**
trigger:
ref:
- refs/heads/master
- refs/tags/**
- refs/pull/**
depends_on:
- security
---
kind: pipeline
name: build-container-amd64
@ -295,7 +351,6 @@ platform:
steps:
- name: manifest
pull: always
image: plugins/manifest
settings:
auto_tag: true
@ -305,13 +360,8 @@ steps:
spec: manifest.tmpl
username:
from_secret: docker_username
when:
ref:
- refs/heads/master
- refs/tags/**
- name: readme
pull: always
image: sheogorath/readme-to-dockerhub
environment:
DOCKERHUB_PASSWORD:
@ -321,18 +371,7 @@ steps:
DOCKERHUB_USERNAME:
from_secret: docker_username
README_PATH: README.md
SHORT_DESCRIPTION: git-batch
when:
ref:
- refs/heads/master
- refs/tags/**
- name: microbadger
pull: always
image: plugins/webhook
settings:
urls:
from_secret: microbadger_url
SHORT_DESCRIPTION: git-batch - Automate cloning a single branch from a repo list
- name: matrix
image: plugins/matrix
@ -346,10 +385,6 @@ steps:
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
when:
status:
- success
- failure
trigger:
ref:
@ -360,12 +395,10 @@ trigger:
- failure
depends_on:
- build-container-amd64
- build-container-arm64
- build-container-arm
- docs
---
kind: signature
hmac: b0b80a9e961c9d56a25b583c0e5404b09039a725be5e635670d7c2ef346add5e
hmac: 3e6e5bc16fce1351d01113283724c7642644fa7be4726e77879986a08395080b
...

0
CHANGELOG.md Normal file
View File

View File

@ -2,7 +2,7 @@
__author__ = "Robert Kaussow"
__project__ = "git-batch"
__version__ = "0.1.0"
__version__ = "0.2.0"
__license__ = "MIT"
__maintainer__ = "Robert Kaussow"
__email__ = "mail@geeklabor.de"