ci: add dev deploy job
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c8c7961e1c
commit
1ee3b01f9a
6 changed files with 131 additions and 2 deletions
23
.drone.yml
23
.drone.yml
|
|
@ -37,7 +37,7 @@ steps:
|
|||
commands:
|
||||
- apk add linux-headers cargo
|
||||
- poetry config virtualenvs.in-project 1
|
||||
- poetry install --with linters,test
|
||||
- poetry install --with linters,test,ci
|
||||
- .venv/bin/pre-commit install-hooks
|
||||
depends_on:
|
||||
- restore_cache
|
||||
|
|
@ -58,6 +58,27 @@ steps:
|
|||
depends_on:
|
||||
- install_deps
|
||||
|
||||
- name: deploy-dev
|
||||
pull: true
|
||||
image: git.roboces.dev/catalin/poetry:beta
|
||||
commands:
|
||||
- python ci/bump_dev.py
|
||||
- poetry build
|
||||
- poetry config repositories.roboces https://git.roboces.dev/api/packages/catalin/pypi
|
||||
- poetry config http-basic.roboces "$REGISTRY_USERNAME" "$REGISTRY_PASSWORD"
|
||||
- poetry publish --repository roboces
|
||||
environment:
|
||||
REGISTRY_USERNAME:
|
||||
from_secret: REGISTRY_USERNAME
|
||||
REGISTRY_PASSWORD:
|
||||
from_secret: REGISTRY_PASSWORD
|
||||
when:
|
||||
ref:
|
||||
- main
|
||||
depends_on:
|
||||
- lint
|
||||
- tests
|
||||
|
||||
- name: deploy
|
||||
pull: true
|
||||
image: git.roboces.dev/catalin/poetry:beta
|
||||
|
|
|
|||
|
|
@ -71,6 +71,9 @@ repos:
|
|||
- typer
|
||||
- psutil
|
||||
- rich
|
||||
- pip_versions
|
||||
- sh
|
||||
- python-decouple
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v0.971
|
||||
|
|
|
|||
0
ci/__init__.py
Normal file
0
ci/__init__.py
Normal file
49
ci/bump_dev.py
Normal file
49
ci/bump_dev.py
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import os
|
||||
from pip_versions import core
|
||||
from sh import poetry # pylint: disable=no-name-in-module
|
||||
from decouple import config
|
||||
|
||||
username = config("REGISTRY_USERNAME")
|
||||
password = config("REGISTRY_PASSWORD")
|
||||
package_name = config("PACKAGE_NAME", "ports")
|
||||
if not (index_url := os.getenv("EXTRA_INDEX_URL")):
|
||||
os.environ[
|
||||
"EXTRA_INDEX_URL"
|
||||
] = "https://git.roboces.dev/api/packages/catalin/pypi/simple"
|
||||
|
||||
|
||||
def main(): # pylint: disable=missing-function-docstring
|
||||
current_version = poetry("version", _tty_out=False).split()[-1]
|
||||
if "dev" in current_version:
|
||||
print("Already on dev version")
|
||||
sys.exit(1)
|
||||
|
||||
dev_versions_of_current_version = sorted(
|
||||
x.version.dev
|
||||
for x in core.find_versions(package_name=package_name)
|
||||
if x.version.base_version == current_version and x
|
||||
)
|
||||
# dev_versions_of_current_version = sorted(
|
||||
# filter(
|
||||
# lambda x: x,
|
||||
# map(
|
||||
# lambda x: x.version.dev,
|
||||
# filter(
|
||||
# lambda x: x.version.base_version == current_version,
|
||||
# core.find_versions(package_name=package_name),
|
||||
# ),
|
||||
# ),
|
||||
# )
|
||||
# )
|
||||
if not dev_versions_of_current_version:
|
||||
dev_versions_of_current_version = [0]
|
||||
last_dev_version = max(dev_versions_of_current_version)
|
||||
new_version = f"{current_version}.dev{last_dev_version + 1}"
|
||||
poetry("version", new_version)
|
||||
print(f"Bumped version to {new_version}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
52
poetry.lock
generated
52
poetry.lock
generated
|
|
@ -28,6 +28,14 @@ category = "dev"
|
|||
optional = false
|
||||
python-versions = ">=3.6.1"
|
||||
|
||||
[[package]]
|
||||
name = "cliar"
|
||||
version = "1.3.5"
|
||||
description = "Create CLIs with classes and type hints."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6,<4.0"
|
||||
|
||||
[[package]]
|
||||
name = "click"
|
||||
version = "8.1.3"
|
||||
|
|
@ -185,6 +193,17 @@ category = "dev"
|
|||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
|
||||
[[package]]
|
||||
name = "pip-versions"
|
||||
version = "0.1.0"
|
||||
description = "Show pip version information from pypi"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7,<4.0"
|
||||
|
||||
[package.dependencies]
|
||||
cliar = ">=1.3.4,<2.0.0"
|
||||
|
||||
[[package]]
|
||||
name = "platformdirs"
|
||||
version = "2.5.2"
|
||||
|
|
@ -255,6 +274,14 @@ python-versions = ">=3.6"
|
|||
[package.extras]
|
||||
plugins = ["importlib-metadata"]
|
||||
|
||||
[[package]]
|
||||
name = "python-decouple"
|
||||
version = "3.6"
|
||||
description = "Strict separation of settings from code."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "PyYAML"
|
||||
version = "6.0"
|
||||
|
|
@ -291,6 +318,14 @@ docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-g
|
|||
testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8 (<5)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "mock", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"]
|
||||
testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"]
|
||||
|
||||
[[package]]
|
||||
name = "sh"
|
||||
version = "1.14.3"
|
||||
description = "Python subprocess replacement"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "shellingham"
|
||||
version = "1.5.0"
|
||||
|
|
@ -399,7 +434,7 @@ ward = ">=0.66.0-beta.0,<0.67.0"
|
|||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.9"
|
||||
content-hash = "52dad1113a2bff737898e734b00f120dcdecf4bff9de21d5ca711b49df0d9c96"
|
||||
content-hash = "8accb359649724234610590f2afee396f4be51df3fd5490a8ee8fcb1a007e201"
|
||||
|
||||
[metadata.files]
|
||||
black = [
|
||||
|
|
@ -431,6 +466,10 @@ cfgv = [
|
|||
{file = "cfgv-3.3.1-py2.py3-none-any.whl", hash = "sha256:c6a0883f3917a037485059700b9e75da2464e6c27051014ad85ba6aaa5884426"},
|
||||
{file = "cfgv-3.3.1.tar.gz", hash = "sha256:f5a830efb9ce7a445376bb66ec94c638a9787422f96264c98edc6bdeed8ab736"},
|
||||
]
|
||||
cliar = [
|
||||
{file = "cliar-1.3.5-py3-none-any.whl", hash = "sha256:f6983c9a34c7be69f9679e7dce5aa05bd77ef61ec9dc85733d9d59a3c0b832be"},
|
||||
{file = "cliar-1.3.5.tar.gz", hash = "sha256:5ff471cb78f1a191d62589f9722c2dd93fa50b803063a411e4fa28741e591633"},
|
||||
]
|
||||
click = [
|
||||
{file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"},
|
||||
{file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"},
|
||||
|
|
@ -574,6 +613,10 @@ pathspec = [
|
|||
{file = "pathspec-0.10.1-py3-none-any.whl", hash = "sha256:46846318467efc4556ccfd27816e004270a9eeeeb4d062ce5e6fc7a87c573f93"},
|
||||
{file = "pathspec-0.10.1.tar.gz", hash = "sha256:7ace6161b621d31e7902eb6b5ae148d12cfd23f4a249b9ffb6b9fee12084323d"},
|
||||
]
|
||||
pip-versions = [
|
||||
{file = "pip-versions-0.1.0.tar.gz", hash = "sha256:49883b10b8fe302ad13821935c12ffeb56518f1e20abf992f0c1f57dcea5f974"},
|
||||
{file = "pip_versions-0.1.0-py3-none-any.whl", hash = "sha256:9404eb8a9dc91562023d31ef3bcda1a8d0a14525038b27305e59e5427c417d07"},
|
||||
]
|
||||
platformdirs = [
|
||||
{file = "platformdirs-2.5.2-py3-none-any.whl", hash = "sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788"},
|
||||
{file = "platformdirs-2.5.2.tar.gz", hash = "sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19"},
|
||||
|
|
@ -628,6 +671,10 @@ Pygments = [
|
|||
{file = "Pygments-2.13.0-py3-none-any.whl", hash = "sha256:f643f331ab57ba3c9d89212ee4a2dabc6e94f117cf4eefde99a0574720d14c42"},
|
||||
{file = "Pygments-2.13.0.tar.gz", hash = "sha256:56a8508ae95f98e2b9bdf93a6be5ae3f7d8af858b43e02c5a2ff083726be40c1"},
|
||||
]
|
||||
python-decouple = [
|
||||
{file = "python-decouple-3.6.tar.gz", hash = "sha256:2838cdf77a5cf127d7e8b339ce14c25bceb3af3e674e039d4901ba16359968c7"},
|
||||
{file = "python_decouple-3.6-py3-none-any.whl", hash = "sha256:6cf502dc963a5c642ea5ead069847df3d916a6420cad5599185de6bab11d8c2e"},
|
||||
]
|
||||
PyYAML = [
|
||||
{file = "PyYAML-6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53"},
|
||||
{file = "PyYAML-6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c"},
|
||||
|
|
@ -671,6 +718,9 @@ setuptools = [
|
|||
{file = "setuptools-65.4.1-py3-none-any.whl", hash = "sha256:1b6bdc6161661409c5f21508763dc63ab20a9ac2f8ba20029aaaa7fdb9118012"},
|
||||
{file = "setuptools-65.4.1.tar.gz", hash = "sha256:3050e338e5871e70c72983072fe34f6032ae1cdeeeb67338199c2f74e083a80e"},
|
||||
]
|
||||
sh = [
|
||||
{file = "sh-1.14.3.tar.gz", hash = "sha256:e4045b6c732d9ce75d571c79f5ac2234edd9ae4f5fa9d59b09705082bdca18c7"},
|
||||
]
|
||||
shellingham = [
|
||||
{file = "shellingham-1.5.0-py2.py3-none-any.whl", hash = "sha256:a8f02ba61b69baaa13facdba62908ca8690a94b8119b69f5ec5873ea85f7391b"},
|
||||
{file = "shellingham-1.5.0.tar.gz", hash = "sha256:72fb7f5c63103ca2cb91b23dee0c71fe8ad6fbfd46418ef17dbe40db51592dad"},
|
||||
|
|
|
|||
|
|
@ -25,6 +25,12 @@ ward = "^0.66.1b0"
|
|||
ward-coverage = "^0.1.5"
|
||||
|
||||
|
||||
|
||||
[tool.poetry.group.ci.dependencies]
|
||||
pip-versions = "^0.1.0"
|
||||
sh = "^1.14.3"
|
||||
python-decouple = "^3.6"
|
||||
|
||||
[tool.ward]
|
||||
hook_module = ["ward_coverage"]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue