ports/.drone.yml
cătălin 1ee3b01f9a
All checks were successful
continuous-integration/drone/push Build is passing
ci: add dev deploy job
2022-10-17 17:37:43 +02:00

125 lines
3 KiB
YAML

---
kind: pipeline
type: docker
name: build and test
trigger:
ref:
- refs/heads/**
- refs/tags/v*
environment:
REGISTRY_HOST: https://git.roboces.dev
DESTINATION_PREFIX: git.roboces.dev/catalin/ports
PRE_COMMIT_HOME: /drone/src/.cache/.pre-commit
steps:
- name: restore_cache
image: meltwater/drone-cache
pull: true
environment:
AWS_ACCESS_KEY_ID:
from_secret: AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: AWS_SECRET_ACCESS_KEY
settings:
restore: true
bucket: ports-cache
endpoint: https://s3.fukurokuju.dev
region: us-east-1
path_style: true
mount:
- .venv
- .cache/.pre-commit
- name: install_deps
pull: true
image: git.roboces.dev/catalin/poetry:beta
commands:
- apk add linux-headers cargo
- poetry config virtualenvs.in-project 1
- poetry install --with linters,test,ci
- .venv/bin/pre-commit install-hooks
depends_on:
- restore_cache
- name: lint
pull: true
image: git.roboces.dev/catalin/poetry:beta
commands:
- .venv/bin/pre-commit run --all-files --color always
depends_on:
- install_deps
- name: tests
pull: true
image: git.roboces.dev/catalin/poetry:beta
commands:
- .venv/bin/ward --path tests
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
commands:
- 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:
- refs/tags/v*
depends_on:
- lint
- tests
- name: rebuild cache
image: meltwater/drone-cache
pull: true
environment:
AWS_ACCESS_KEY_ID:
from_secret: AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: AWS_SECRET_ACCESS_KEY
settings:
rebuild: true
path_style: true
bucket: ports-cache
endpoint: https://s3.fukurokuju.dev
region: us-east-1
mount:
- .venv
- .cache/.pre-commit
when:
status:
- failure
- success
depends_on:
- lint
- tests