2020-08-18 13:10:09 +00:00
|
|
|
local PythonVersion(pyversion='3.5') = {
|
|
|
|
name: 'python' + std.strReplace(pyversion, '.', '') + '-pytest',
|
|
|
|
image: 'python:' + pyversion,
|
|
|
|
environment: {
|
|
|
|
PY_COLORS: 1,
|
|
|
|
},
|
|
|
|
commands: [
|
|
|
|
'pip install -r dev-requirements.txt -qq',
|
|
|
|
'pip install -r test/unit/requirements.txt -qq',
|
|
|
|
'python -m pytest --cov --cov-append --no-cov-on-fail',
|
|
|
|
],
|
|
|
|
depends_on: [
|
|
|
|
'clone',
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
local PipelineLint = {
|
|
|
|
kind: 'pipeline',
|
|
|
|
name: 'lint',
|
|
|
|
platform: {
|
|
|
|
os: 'linux',
|
|
|
|
arch: 'amd64',
|
|
|
|
},
|
|
|
|
steps: [
|
|
|
|
{
|
|
|
|
name: 'flake8',
|
|
|
|
image: 'python:3.8',
|
|
|
|
environment: {
|
|
|
|
PY_COLORS: 1,
|
|
|
|
},
|
|
|
|
commands: [
|
|
|
|
'pip install -r dev-requirements.txt -qq',
|
|
|
|
'flake8',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
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'),
|
|
|
|
],
|
|
|
|
depends_on: [
|
|
|
|
'lint',
|
|
|
|
],
|
|
|
|
trigger: {
|
|
|
|
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
local PipelineBuild = {
|
|
|
|
kind: 'pipeline',
|
|
|
|
name: 'build',
|
|
|
|
platform: {
|
|
|
|
os: 'linux',
|
|
|
|
arch: 'amd64',
|
|
|
|
},
|
|
|
|
steps: [
|
|
|
|
{
|
|
|
|
name: 'build',
|
|
|
|
image: 'python:3.8',
|
|
|
|
commands: [
|
|
|
|
'pip install ansible -qq',
|
|
|
|
'ansible-galaxy collection build --output-path dist/',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'checksum',
|
|
|
|
image: 'alpine',
|
|
|
|
commands: [
|
|
|
|
'cd dist/ && sha256sum * > ../sha256sum.txt',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'publish-gitea',
|
|
|
|
image: 'plugins/gitea-release',
|
|
|
|
settings: {
|
|
|
|
overwrite: true,
|
|
|
|
api_key: { from_secret: 'gitea_token' },
|
|
|
|
files: ['dist/*', 'sha256sum.txt'],
|
|
|
|
base_url: 'https://gitea.rknet.org',
|
|
|
|
title: '${DRONE_TAG}',
|
|
|
|
note: 'CHANGELOG.md',
|
|
|
|
},
|
|
|
|
when: {
|
|
|
|
ref: ['refs/tags/**'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
depends_on: [
|
2020-08-18 13:12:23 +00:00
|
|
|
'test',
|
2020-08-18 13:10:09 +00:00
|
|
|
],
|
|
|
|
trigger: {
|
|
|
|
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
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' },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
depends_on: [
|
2020-08-18 13:13:13 +00:00
|
|
|
'build',
|
2020-08-18 13:10:09 +00:00
|
|
|
],
|
|
|
|
trigger: {
|
|
|
|
ref: ['refs/heads/master', 'refs/tags/**'],
|
|
|
|
status: ['success', 'failure'],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
[
|
|
|
|
PipelineLint,
|
|
|
|
PipelineTest,
|
|
|
|
PipelineBuild,
|
|
|
|
PipelineNotifications,
|
|
|
|
]
|