2021-12-06 15:42:26 +00:00
|
|
|
local PythonVersion(pyversion='3.8') = {
|
2020-08-18 13:10:09 +00:00
|
|
|
name: 'python' + std.strReplace(pyversion, '.', '') + '-pytest',
|
|
|
|
image: 'python:' + pyversion,
|
|
|
|
environment: {
|
|
|
|
PY_COLORS: 1,
|
|
|
|
},
|
|
|
|
commands: [
|
2023-01-31 19:09:29 +00:00
|
|
|
'pip install poetry -qq',
|
|
|
|
'poetry config experimental.new-installer false',
|
|
|
|
'poetry install --all-extras',
|
|
|
|
'poetry run pytest',
|
|
|
|
],
|
|
|
|
depends_on: [
|
|
|
|
'clone',
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
local AnsibleVersion(version='devel') = {
|
|
|
|
local gitversion = if version == 'devel' then 'devel' else 'stable-' + version,
|
|
|
|
name: 'ansible-' + std.strReplace(version, '.', ''),
|
|
|
|
image: 'python:3.9',
|
|
|
|
environment: {
|
|
|
|
PY_COLORS: 1,
|
|
|
|
},
|
|
|
|
commands: [
|
|
|
|
'pip install poetry -qq',
|
|
|
|
'poetry config experimental.new-installer false',
|
|
|
|
'poetry install',
|
|
|
|
'poetry run pip install https://github.com/ansible/ansible/archive/' + gitversion + '.tar.gz --disable-pip-version-check',
|
|
|
|
'poetry run ansible --version',
|
|
|
|
'poetry run ansible-test sanity --exclude .chglog/ --exclude .drone.yml --python 3.9',
|
2020-08-18 13:10:09 +00:00
|
|
|
],
|
|
|
|
depends_on: [
|
|
|
|
'clone',
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
local PipelineLint = {
|
|
|
|
kind: 'pipeline',
|
|
|
|
name: 'lint',
|
|
|
|
platform: {
|
|
|
|
os: 'linux',
|
|
|
|
arch: 'amd64',
|
|
|
|
},
|
|
|
|
steps: [
|
|
|
|
{
|
2023-01-31 19:09:29 +00:00
|
|
|
name: 'check-format',
|
|
|
|
image: 'python:3.11',
|
|
|
|
environment: {
|
|
|
|
PY_COLORS: 1,
|
|
|
|
},
|
|
|
|
commands: [
|
|
|
|
'git fetch -tq',
|
|
|
|
'pip install poetry -qq',
|
|
|
|
'poetry config experimental.new-installer false',
|
|
|
|
'poetry install --all-extras',
|
|
|
|
'poetry run yapf -dr ./plugins',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'check-coding',
|
|
|
|
image: 'python:3.11',
|
2020-08-18 13:10:09 +00:00
|
|
|
environment: {
|
|
|
|
PY_COLORS: 1,
|
|
|
|
},
|
|
|
|
commands: [
|
2023-01-31 19:09:29 +00:00
|
|
|
'git fetch -tq',
|
|
|
|
'pip install poetry -qq',
|
|
|
|
'poetry config experimental.new-installer false',
|
|
|
|
'poetry install --all-extras',
|
|
|
|
'poetry run ruff ./plugins',
|
2020-08-18 13:10:09 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
trigger: {
|
2022-06-20 20:22:58 +00:00
|
|
|
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
|
2020-08-18 13:10:09 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2023-01-31 19:09:29 +00:00
|
|
|
local PipelineUnitTest = {
|
2020-08-18 13:10:09 +00:00
|
|
|
kind: 'pipeline',
|
2023-01-31 19:09:29 +00:00
|
|
|
name: 'unit-test',
|
2020-08-18 13:10:09 +00:00
|
|
|
platform: {
|
|
|
|
os: 'linux',
|
|
|
|
arch: 'amd64',
|
|
|
|
},
|
|
|
|
steps: [
|
|
|
|
PythonVersion(pyversion='3.8'),
|
2021-02-19 12:47:26 +00:00
|
|
|
PythonVersion(pyversion='3.9'),
|
2021-12-06 15:42:26 +00:00
|
|
|
PythonVersion(pyversion='3.10'),
|
2023-01-31 19:09:29 +00:00
|
|
|
PythonVersion(pyversion='3.11'),
|
2020-08-18 13:10:09 +00:00
|
|
|
],
|
|
|
|
depends_on: [
|
|
|
|
'lint',
|
|
|
|
],
|
|
|
|
trigger: {
|
2022-06-20 20:22:58 +00:00
|
|
|
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
|
2020-08-18 13:10:09 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2023-01-31 19:09:29 +00:00
|
|
|
local PipelineSanityTest = {
|
|
|
|
kind: 'pipeline',
|
|
|
|
name: 'sanity-test',
|
|
|
|
platform: {
|
|
|
|
os: 'linux',
|
|
|
|
arch: 'amd64',
|
|
|
|
},
|
|
|
|
workspace: {
|
|
|
|
path: '/drone/src/ansible_collections/${DRONE_REPO_NAME/./\\/}',
|
|
|
|
},
|
|
|
|
steps: [
|
|
|
|
AnsibleVersion(version='devel'),
|
|
|
|
AnsibleVersion(version='2.14'),
|
|
|
|
AnsibleVersion(version='2.13'),
|
|
|
|
],
|
|
|
|
depends_on: [
|
|
|
|
'unit-test',
|
|
|
|
],
|
|
|
|
trigger: {
|
|
|
|
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-08-18 13:10:09 +00:00
|
|
|
local PipelineBuild = {
|
|
|
|
kind: 'pipeline',
|
|
|
|
name: 'build',
|
|
|
|
platform: {
|
|
|
|
os: 'linux',
|
|
|
|
arch: 'amd64',
|
|
|
|
},
|
|
|
|
steps: [
|
|
|
|
{
|
|
|
|
name: 'build',
|
2023-01-31 19:09:29 +00:00
|
|
|
image: 'python:3.11',
|
2020-08-18 13:10:09 +00:00
|
|
|
commands: [
|
2021-03-28 11:26:38 +00:00
|
|
|
'GALAXY_VERSION=${DRONE_TAG##v}',
|
2021-03-27 14:00:02 +00:00
|
|
|
"sed -i 's/version: 0.0.0/version: '\"$${GALAXY_VERSION:-0.0.0}\"'/g' galaxy.yml",
|
2023-01-31 19:09:29 +00:00
|
|
|
'pip install poetry -qq',
|
|
|
|
'poetry config experimental.new-installer false',
|
|
|
|
'poetry install --all-extras',
|
|
|
|
'poetry run ansible-galaxy collection build --output-path dist/',
|
2020-08-18 13:10:09 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'checksum',
|
|
|
|
image: 'alpine',
|
|
|
|
commands: [
|
|
|
|
'cd dist/ && sha256sum * > ../sha256sum.txt',
|
|
|
|
],
|
|
|
|
},
|
2021-02-19 12:38:30 +00:00
|
|
|
{
|
2021-05-10 20:21:26 +00:00
|
|
|
name: 'changelog-generate',
|
2021-02-19 12:38:30 +00:00
|
|
|
image: 'thegeeklab/git-chglog',
|
|
|
|
commands: [
|
|
|
|
'git fetch -tq',
|
|
|
|
'git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}',
|
|
|
|
],
|
|
|
|
},
|
2021-05-10 20:21:26 +00:00
|
|
|
{
|
|
|
|
name: 'changelog-format',
|
|
|
|
image: 'thegeeklab/alpine-tools',
|
|
|
|
commands: [
|
|
|
|
'prettier CHANGELOG.md',
|
|
|
|
'prettier -w CHANGELOG.md',
|
|
|
|
],
|
|
|
|
},
|
2020-08-18 13:10:09 +00:00
|
|
|
{
|
|
|
|
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: [
|
2023-01-31 19:09:29 +00:00
|
|
|
'sanity-test',
|
2020-08-18 13:10:09 +00:00
|
|
|
],
|
|
|
|
trigger: {
|
2022-06-20 20:22:58 +00:00
|
|
|
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
|
2020-08-18 13:10:09 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-08-22 18:07:48 +00:00
|
|
|
local PipelineDocumentation = {
|
|
|
|
kind: 'pipeline',
|
|
|
|
name: 'documentation',
|
|
|
|
platform: {
|
|
|
|
os: 'linux',
|
|
|
|
arch: 'amd64',
|
|
|
|
},
|
|
|
|
steps: [
|
|
|
|
{
|
|
|
|
name: 'publish',
|
|
|
|
image: 'plugins/gh-pages',
|
|
|
|
settings: {
|
|
|
|
netrc_machine: 'gitea.rknet.org',
|
|
|
|
pages_directory: 'docs/',
|
|
|
|
password: {
|
|
|
|
from_secret: 'gitea_token',
|
|
|
|
},
|
|
|
|
remote_url: 'https://gitea.rknet.org/ansible/${DRONE_REPO_NAME}',
|
|
|
|
target_branch: 'docs',
|
|
|
|
username: {
|
|
|
|
from_secret: 'gitea_username',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
depends_on: [
|
|
|
|
'build',
|
|
|
|
],
|
|
|
|
trigger: {
|
2022-06-20 20:22:58 +00:00
|
|
|
ref: ['refs/heads/main', 'refs/tags/**'],
|
2020-08-22 18:07:48 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-08-18 13:10:09 +00:00
|
|
|
local PipelineNotifications = {
|
|
|
|
kind: 'pipeline',
|
|
|
|
name: 'notifications',
|
|
|
|
platform: {
|
|
|
|
os: 'linux',
|
|
|
|
arch: 'amd64',
|
|
|
|
},
|
|
|
|
steps: [
|
|
|
|
{
|
|
|
|
name: 'matrix',
|
2021-09-22 07:08:41 +00:00
|
|
|
image: 'thegeeklab/drone-matrix',
|
2020-08-18 13:10:09 +00:00
|
|
|
settings: {
|
|
|
|
homeserver: { from_secret: 'matrix_homeserver' },
|
|
|
|
roomid: { from_secret: 'matrix_roomid' },
|
2023-02-08 20:27:04 +00:00
|
|
|
template: 'Status: **{{ .Build.Status }}**<br/> Build: [{{ .Repo.Owner }}/{{ .Repo.Name }}]({{ .Build.Link }}){{ if .Build.Branch }} ({{ .Build.Branch }}){{ end }} by {{ .Commit.Author }}<br/> Message: {{ .Commit.Message.Title }}',
|
2020-08-18 13:10:09 +00:00
|
|
|
username: { from_secret: 'matrix_username' },
|
|
|
|
password: { from_secret: 'matrix_password' },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
depends_on: [
|
2020-08-22 18:07:48 +00:00
|
|
|
'documentation',
|
2020-08-18 13:10:09 +00:00
|
|
|
],
|
|
|
|
trigger: {
|
2022-06-20 20:22:58 +00:00
|
|
|
ref: ['refs/heads/main', 'refs/tags/**'],
|
2020-08-18 13:10:09 +00:00
|
|
|
status: ['success', 'failure'],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
[
|
|
|
|
PipelineLint,
|
2023-01-31 19:09:29 +00:00
|
|
|
PipelineUnitTest,
|
|
|
|
PipelineSanityTest,
|
2020-08-18 13:10:09 +00:00
|
|
|
PipelineBuild,
|
2020-08-22 18:07:48 +00:00
|
|
|
PipelineDocumentation,
|
2020-08-18 13:10:09 +00:00
|
|
|
PipelineNotifications,
|
|
|
|
]
|