refactor: rework ci and testing #3

Merged
xoxys merged 14 commits from refactor-ci into main 2023-01-31 19:09:30 +00:00
4 changed files with 113 additions and 24 deletions
Showing only changes of commit 5e347bf06b - Show all commits

View File

@ -7,7 +7,7 @@ local PythonVersion(pyversion='3.8') = {
commands: [
'pip install poetry -qq',
'poetry config experimental.new-installer false',
'poetry install',
'poetry install --all-extras',
'poetry run pytest',
],
depends_on: [
@ -15,6 +15,25 @@ local PythonVersion(pyversion='3.8') = {
],
};
local AnsibleVersion(version='devel') = {
local gitversion = if version == 'devel' then 'devel' else 'stable-' + version,
name: 'ansible-' + std.strReplace(version, '.', ''),
image: 'python:3.8',
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',
'ansible-test sanity --exclude .chglog/ --exclude .drone.yml --python 3.8',
],
depends_on: [
'clone',
],
};
local PipelineLint = {
kind: 'pipeline',
name: 'lint',
@ -33,7 +52,7 @@ local PipelineLint = {
'git fetch -tq',
'pip install poetry -qq',
'poetry config experimental.new-installer false',
'poetry install',
'poetry install --all-extras',
'poetry run yapf -dr ./plugins',
],
},
@ -47,7 +66,7 @@ local PipelineLint = {
'git fetch -tq',
'pip install poetry -qq',
'poetry config experimental.new-installer false',
'poetry install',
'poetry install --all-extras',
'poetry run ruff ./plugins',
],
},
@ -57,9 +76,9 @@ local PipelineLint = {
},
};
local PipelineTest = {
local PipelineUnitTest = {
kind: 'pipeline',
name: 'test',
name: 'unit-test',
platform: {
os: 'linux',
arch: 'amd64',
@ -78,6 +97,25 @@ local PipelineTest = {
},
};
local PipelineSanityTest = {
kind: 'pipeline',
name: 'sanity-test',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
AnsibleVersion(version='devel'),
AnsibleVersion(version='2.14'),
],
depends_on: [
'unit-test',
],
trigger: {
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineBuild = {
kind: 'pipeline',
name: 'build',
@ -94,7 +132,7 @@ local PipelineBuild = {
"sed -i 's/version: 0.0.0/version: '\"$${GALAXY_VERSION:-0.0.0}\"'/g' galaxy.yml",
'pip install poetry -qq',
'poetry config experimental.new-installer false',
'poetry install',
'poetry install --all-extras',
'poetry run ansible-galaxy collection build --output-path dist/',
],
},
@ -138,7 +176,7 @@ local PipelineBuild = {
},
],
depends_on: [
'test',
'sanity-test',
],
trigger: {
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
@ -209,7 +247,8 @@ local PipelineNotifications = {
[
PipelineLint,
PipelineTest,
PipelineUnitTest,
PipelineSanityTest,
PipelineBuild,
PipelineDocumentation,
PipelineNotifications,

View File

@ -13,7 +13,7 @@ steps:
- git fetch -tq
- pip install poetry -qq
- poetry config experimental.new-installer false
- poetry install
- poetry install --all-extras
- poetry run yapf -dr ./plugins
environment:
PY_COLORS: 1
@ -24,7 +24,7 @@ steps:
- git fetch -tq
- pip install poetry -qq
- poetry config experimental.new-installer false
- poetry install
- poetry install --all-extras
- poetry run ruff ./plugins
environment:
PY_COLORS: 1
@ -37,7 +37,7 @@ trigger:
---
kind: pipeline
name: test
name: unit-test
platform:
os: linux
@ -49,7 +49,7 @@ steps:
commands:
- pip install poetry -qq
- poetry config experimental.new-installer false
- poetry install
- poetry install --all-extras
- poetry run pytest
environment:
PY_COLORS: 1
@ -61,7 +61,7 @@ steps:
commands:
- pip install poetry -qq
- poetry config experimental.new-installer false
- poetry install
- poetry install --all-extras
- poetry run pytest
environment:
PY_COLORS: 1
@ -73,7 +73,7 @@ steps:
commands:
- pip install poetry -qq
- poetry config experimental.new-installer false
- poetry install
- poetry install --all-extras
- poetry run pytest
environment:
PY_COLORS: 1
@ -85,7 +85,7 @@ steps:
commands:
- pip install poetry -qq
- poetry config experimental.new-installer false
- poetry install
- poetry install --all-extras
- poetry run pytest
environment:
PY_COLORS: 1
@ -101,6 +101,50 @@ trigger:
depends_on:
- lint
---
kind: pipeline
name: sanity-test
platform:
os: linux
arch: amd64
steps:
- name: ansible-devel
image: python:3.8
commands:
- pip install poetry -qq
- poetry config experimental.new-installer false
- poetry install
- poetry run pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
- ansible-test sanity --exclude .chglog/ --exclude .drone.yml --python 3.8
environment:
PY_COLORS: 1
depends_on:
- clone
- name: ansible-214
image: python:3.8
commands:
- pip install poetry -qq
- poetry config experimental.new-installer false
- poetry install
- poetry run pip install https://github.com/ansible/ansible/archive/stable-2.14.tar.gz --disable-pip-version-check
- ansible-test sanity --exclude .chglog/ --exclude .drone.yml --python 3.8
environment:
PY_COLORS: 1
depends_on:
- clone
trigger:
ref:
- refs/heads/main
- refs/tags/**
- refs/pull/**
depends_on:
- unit-test
---
kind: pipeline
name: build
@ -117,7 +161,7 @@ steps:
- "sed -i 's/version: 0.0.0/version: '\"$${GALAXY_VERSION:-0.0.0}\"'/g' galaxy.yml"
- pip install poetry -qq
- poetry config experimental.new-installer false
- poetry install
- poetry install --all-extras
- poetry run ansible-galaxy collection build --output-path dist/
- name: checksum
@ -160,7 +204,7 @@ trigger:
- refs/pull/**
depends_on:
- test
- sanity-test
---
kind: pipeline
@ -226,6 +270,6 @@ depends_on:
---
kind: signature
hmac: 73306cf1a763c7ef338c1418bf53fc5155fe5f0681ede8b9c93dbd245e560194
hmac: f8056d1063e4f27d6d1b2395518a9654a462b0291c5425b375442873d5e3a740
...

13
poetry.lock generated
View File

@ -5,7 +5,7 @@ name = "ansible-core"
version = "2.13.7"
description = "Radically simple IT automation"
category = "main"
optional = false
optional = true
python-versions = ">=3.8"
files = [
{file = "ansible-core-2.13.7.tar.gz", hash = "sha256:a9d5f942ff0dcbeec3d7183a898ea4f656d233d6055d4bc8e22e37b013b1881a"},
@ -464,7 +464,7 @@ name = "jinja2"
version = "3.1.2"
description = "A very fast and expressive template engine."
category = "main"
optional = false
optional = true
python-versions = ">=3.7"
files = [
{file = "Jinja2-3.1.2-py3-none-any.whl", hash = "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61"},
@ -528,7 +528,7 @@ name = "markupsafe"
version = "2.1.2"
description = "Safely add untrusted strings to HTML/XML markup."
category = "main"
optional = false
optional = true
python-versions = ">=3.7"
files = [
{file = "MarkupSafe-2.1.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:665a36ae6f8f20a4676b53224e33d456a6f5a72657d9c83c2aa00765072f31f7"},
@ -886,7 +886,7 @@ name = "resolvelib"
version = "0.8.1"
description = "Resolve abstract dependencies into concrete ones"
category = "main"
optional = false
optional = true
python-versions = "*"
files = [
{file = "resolvelib-0.8.1-py2.py3-none-any.whl", hash = "sha256:d9b7907f055c3b3a2cfc56c914ffd940122915826ff5fb5b1de0c99778f4de98"},
@ -1134,7 +1134,10 @@ files = [
{file = "yapf-0.32.0.tar.gz", hash = "sha256:a3f5085d37ef7e3e004c4ba9f9b3e40c54ff1901cd111f05145ae313a7c67d1b"},
]
[extras]
ansible = ["ansible-core"]
[metadata]
lock-version = "2.0"
python-versions = "^3.8.0"
content-hash = "a0518f9a3a398dc6f5cdae9f83999d13d2e6dccaa92509ecff92fb80ccc4a0c1"
content-hash = "98070d85ac9a8d2718daf9130e63de51881f16453a59a5100a799492cc5ecdb4"

View File

@ -27,11 +27,14 @@ version = "0.0.0"
[tool.poetry.dependencies]
python = "^3.8.0"
ansible-core = "<=2.14.0"
ansible-core = { version = "<=2.14.0", optional = true }
pyopenssl = "23.0.0"
proxmoxer = "2.0.1"
hcloud = "1.18.2"
[tool.poetry.extras]
ansible = ["ansible-core"]
[tool.poetry.group.dev.dependencies]
ruff = "0.0.230"
pytest = "7.2.1"