2021-01-01 22:39:20 +00:00
|
|
|
local PythonVersion(pyversion='3.6') = {
|
2020-04-19 15:57:48 +00:00
|
|
|
name: 'python' + std.strReplace(pyversion, '.', ''),
|
|
|
|
image: 'python:' + pyversion,
|
|
|
|
environment: {
|
|
|
|
PY_COLORS: 1,
|
|
|
|
},
|
|
|
|
commands: [
|
2021-01-01 22:39:20 +00:00
|
|
|
'pip install poetry poetry-dynamic-versioning -qq',
|
|
|
|
'poetry install -q',
|
|
|
|
'poetry run pytest',
|
|
|
|
'poetry version',
|
2020-04-19 15:57:48 +00:00
|
|
|
],
|
|
|
|
depends_on: [
|
2021-01-01 22:39:20 +00:00
|
|
|
'fetch',
|
2020-04-19 15:57:48 +00:00
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
local PipelineLint = {
|
|
|
|
kind: 'pipeline',
|
|
|
|
name: 'lint',
|
|
|
|
platform: {
|
|
|
|
os: 'linux',
|
|
|
|
arch: 'amd64',
|
|
|
|
},
|
|
|
|
steps: [
|
2021-01-01 22:39:20 +00:00
|
|
|
{
|
|
|
|
name: 'yapf',
|
|
|
|
image: 'python:3.9',
|
|
|
|
environment: {
|
|
|
|
PY_COLORS: 1,
|
|
|
|
},
|
|
|
|
commands: [
|
|
|
|
'git fetch -tq',
|
|
|
|
'pip install poetry poetry-dynamic-versioning -qq',
|
|
|
|
'poetry install -q',
|
|
|
|
'poetry run yapf -dr ./certbot_dns_corenetworks',
|
|
|
|
],
|
|
|
|
},
|
2020-04-19 15:57:48 +00:00
|
|
|
{
|
|
|
|
name: 'flake8',
|
2021-01-01 22:39:20 +00:00
|
|
|
image: 'python:3.9',
|
2020-04-19 15:57:48 +00:00
|
|
|
environment: {
|
|
|
|
PY_COLORS: 1,
|
|
|
|
},
|
|
|
|
commands: [
|
2021-01-01 22:39:20 +00:00
|
|
|
'git fetch -tq',
|
|
|
|
'pip install poetry poetry-dynamic-versioning -qq',
|
|
|
|
'poetry install -q',
|
|
|
|
'poetry run flake8 ./certbot_dns_corenetworks',
|
2020-04-19 15:57:48 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
trigger: {
|
2021-01-01 22:49:54 +00:00
|
|
|
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
|
2020-04-19 15:57:48 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
local PipelineTest = {
|
|
|
|
kind: 'pipeline',
|
|
|
|
name: 'test',
|
|
|
|
platform: {
|
|
|
|
os: 'linux',
|
|
|
|
arch: 'amd64',
|
|
|
|
},
|
|
|
|
steps: [
|
2021-01-01 22:39:20 +00:00
|
|
|
{
|
|
|
|
name: 'fetch',
|
|
|
|
image: 'python:3.9',
|
|
|
|
commands: [
|
|
|
|
'git fetch -tq',
|
|
|
|
],
|
|
|
|
},
|
2020-04-19 15:57:48 +00:00
|
|
|
PythonVersion(pyversion='3.6'),
|
|
|
|
PythonVersion(pyversion='3.7'),
|
|
|
|
PythonVersion(pyversion='3.8'),
|
2021-01-01 22:39:20 +00:00
|
|
|
PythonVersion(pyversion='3.9'),
|
2020-04-19 15:57:48 +00:00
|
|
|
{
|
|
|
|
name: 'codecov',
|
2021-01-01 22:39:20 +00:00
|
|
|
image: 'python:3.9',
|
2020-04-19 15:57:48 +00:00
|
|
|
environment: {
|
|
|
|
PY_COLORS: 1,
|
|
|
|
CODECOV_TOKEN: { from_secret: 'codecov_token' },
|
|
|
|
},
|
|
|
|
commands: [
|
|
|
|
'pip install codecov -qq',
|
|
|
|
'codecov --required -X gcov',
|
|
|
|
],
|
|
|
|
depends_on: [
|
|
|
|
'python36',
|
|
|
|
'python37',
|
|
|
|
'python38',
|
2021-01-01 22:39:20 +00:00
|
|
|
'python39',
|
2020-04-19 15:57:48 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
depends_on: [
|
|
|
|
'lint',
|
|
|
|
],
|
|
|
|
trigger: {
|
2021-01-01 22:49:54 +00:00
|
|
|
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
|
2020-04-19 15:57:48 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
local PipelineSecurity = {
|
|
|
|
kind: 'pipeline',
|
|
|
|
name: 'security',
|
|
|
|
platform: {
|
|
|
|
os: 'linux',
|
|
|
|
arch: 'amd64',
|
|
|
|
},
|
|
|
|
steps: [
|
|
|
|
{
|
|
|
|
name: 'bandit',
|
2021-01-01 22:39:20 +00:00
|
|
|
image: 'python:3.9',
|
2020-04-19 15:57:48 +00:00
|
|
|
environment: {
|
|
|
|
PY_COLORS: 1,
|
|
|
|
},
|
|
|
|
commands: [
|
2021-01-01 22:39:20 +00:00
|
|
|
'git fetch -tq',
|
|
|
|
'pip install poetry poetry-dynamic-versioning -qq',
|
|
|
|
'poetry install -q',
|
|
|
|
'poetry run bandit -r ./certbot_dns_corenetworks -x ./certbot_dns_corenetworks/test',
|
2020-04-19 15:57:48 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
depends_on: [
|
|
|
|
'test',
|
|
|
|
],
|
|
|
|
trigger: {
|
2021-01-01 22:49:54 +00:00
|
|
|
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
|
2020-04-19 15:57:48 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
local PipelineBuildPackage = {
|
|
|
|
kind: 'pipeline',
|
|
|
|
name: 'build-package',
|
|
|
|
platform: {
|
|
|
|
os: 'linux',
|
|
|
|
arch: 'amd64',
|
|
|
|
},
|
|
|
|
steps: [
|
|
|
|
{
|
|
|
|
name: 'build',
|
2021-01-01 22:39:20 +00:00
|
|
|
image: 'python:3.9',
|
2020-04-19 15:57:48 +00:00
|
|
|
commands: [
|
2021-01-01 22:39:20 +00:00
|
|
|
'git fetch -tq',
|
|
|
|
'pip install poetry poetry-dynamic-versioning -qq',
|
|
|
|
'poetry build',
|
2020-04-19 15:57:48 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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',
|
2021-01-01 22:39:20 +00:00
|
|
|
image: 'python:3.9',
|
|
|
|
commands: [
|
|
|
|
'git fetch -tq',
|
|
|
|
'pip install poetry poetry-dynamic-versioning -qq',
|
|
|
|
'poetry publish -n',
|
|
|
|
],
|
|
|
|
environment: {
|
|
|
|
POETRY_HTTP_BASIC_PYPI_USERNAME: { from_secret: 'pypi_username' },
|
|
|
|
POETRY_HTTP_BASIC_PYPI_PASSWORD: { from_secret: 'pypi_password' },
|
2020-04-19 15:57:48 +00:00
|
|
|
},
|
|
|
|
when: {
|
|
|
|
ref: ['refs/tags/**'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
depends_on: [
|
|
|
|
'security',
|
|
|
|
],
|
|
|
|
trigger: {
|
2021-01-01 22:49:54 +00:00
|
|
|
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
|
2020-04-19 15:57:48 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
local PipelineNotifications = {
|
|
|
|
kind: 'pipeline',
|
|
|
|
name: 'notifications',
|
|
|
|
platform: {
|
|
|
|
os: 'linux',
|
|
|
|
arch: 'amd64',
|
|
|
|
},
|
|
|
|
steps: [
|
|
|
|
{
|
|
|
|
name: 'matrix',
|
|
|
|
image: 'plugins/matrix',
|
|
|
|
settings: {
|
|
|
|
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' },
|
|
|
|
},
|
|
|
|
when: {
|
|
|
|
status: ['success', 'failure'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
depends_on: [
|
|
|
|
'build-package',
|
|
|
|
],
|
|
|
|
trigger: {
|
2021-01-01 22:49:54 +00:00
|
|
|
ref: ['refs/heads/main', 'refs/tags/**'],
|
2020-04-19 15:57:48 +00:00
|
|
|
status: ['success', 'failure'],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
[
|
|
|
|
PipelineLint,
|
|
|
|
PipelineTest,
|
|
|
|
PipelineSecurity,
|
|
|
|
PipelineBuildPackage,
|
|
|
|
PipelineNotifications,
|
|
|
|
]
|