This repository has been archived on 2023-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
drone-cleanup-agents/.drone.jsonnet

152 lines
2.8 KiB
Plaintext
Raw Normal View History

local PythonVersion(pyversion='3.7') = {
2021-12-21 09:29:13 +00:00
name: 'python' + std.strReplace(pyversion, '.', '') + '-pytest',
image: 'python:' + pyversion,
pull: 'always',
environment: {
PY_COLORS: 1,
},
commands: [
'pip install -r test-requirements.txt -qq',
'pip install -qq .',
'drone-cleanup-agents --help',
],
depends_on: [
'clone',
],
2019-12-18 19:24:58 +00:00
};
local PipelineLint = {
2021-12-21 09:29:13 +00:00
kind: 'pipeline',
name: 'lint',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'flake8',
image: 'python:3.10',
2021-12-21 09:29:13 +00:00
pull: 'always',
environment: {
PY_COLORS: 1,
},
commands: [
'pip install -r test-requirements.txt -qq',
'pip install -qq .',
'flake8 ./cleanupagents',
],
2019-12-18 19:24:58 +00:00
},
2021-12-21 09:29:13 +00:00
],
trigger: {
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
},
2019-12-18 19:24:58 +00:00
};
local PipelineTest = {
2021-12-21 09:29:13 +00:00
kind: 'pipeline',
name: 'test',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
PythonVersion(pyversion='3.7'),
PythonVersion(pyversion='3.8'),
PythonVersion(pyversion='3.9'),
PythonVersion(pyversion='3.10'),
2021-12-21 09:29:13 +00:00
],
trigger: {
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
},
depends_on: [
'lint',
],
2019-12-18 19:24:58 +00:00
};
local PipelineSecurity = {
2021-12-21 09:29:13 +00:00
kind: 'pipeline',
name: 'security',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'bandit',
image: 'python:3.10',
2021-12-21 09:29:13 +00:00
pull: 'always',
environment: {
PY_COLORS: 1,
},
commands: [
'pip install -r test-requirements.txt -qq',
'pip install -qq .',
'bandit -r ./cleanupagents -x ./cleanupagents/tests',
],
2019-12-18 19:24:58 +00:00
},
2021-12-21 09:29:13 +00:00
],
depends_on: [
'test',
],
trigger: {
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
},
2019-12-18 19:24:58 +00:00
};
local PipelineBuild = {
2021-12-21 09:29:13 +00:00
kind: 'pipeline',
name: 'build',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'build',
image: 'python:3.10',
2021-12-21 09:29:13 +00:00
pull: 'always',
commands: [
'python setup.py sdist bdist_wheel',
],
},
{
name: 'checksum',
image: 'alpine',
pull: 'always',
commands: [
'cd dist/ && sha256sum * > sha256sum.txt',
],
2019-12-18 19:24:58 +00:00
},
2021-12-21 09:29:13 +00:00
{
name: 'publish-gitea',
image: 'plugins/gitea-release',
pull: 'always',
settings: {
2022-10-25 10:24:44 +00:00
api_key: {
from_secret: 'gitea_token',
},
2022-10-25 09:34:47 +00:00
base_url: 'https://gitea.rknet.org',
2021-12-21 09:29:13 +00:00
files: ['dist/*', 'sha256sum.txt'],
title: '${DRONE_TAG}',
note: 'CHANGELOG.md',
},
when: {
ref: ['refs/tags/**'],
},
2019-12-18 19:24:58 +00:00
},
2021-12-21 09:29:13 +00:00
],
depends_on: [
'security',
],
trigger: {
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
},
2019-12-18 19:24:58 +00:00
};
[
2021-12-21 09:29:13 +00:00
PipelineLint,
PipelineTest,
PipelineSecurity,
PipelineBuild,
2019-12-18 19:24:58 +00:00
]