manga-dlp/.drone.yml
2022-05-10 22:13:29 +02:00

218 lines
4 KiB
YAML

---
######################
# sonarqube analysis #
######################
kind: pipeline
type: docker
name: sonarqube-analysis
platform:
os: linux
arch: amd64
trigger:
event:
- push
# test python code and upload analysis to sonarqube
steps:
- name: 'test code and generate coverage report'
image: 'cr.44net.ch/drone-plugins/test'
pull: if-not-exists
group: test
commands:
- pip install -r requirements.txt
- coverage erase
- coverage run -m pytest --verbose
- coverage xml -i
- name: 'sonarqube: analyse code'
image: 'cr.44net.ch/drone-plugins/sonarqube'
pull: if-not-exists
group: test
settings:
sonar_host: 'https://sonarqube.44net.ch'
sonar_token:
from_secret: sq-44net-token
usingProperties: true
---
################
# docker build #
################
kind: pipeline
type: docker
name: docker-build-arm64
platform:
os: linux
arch: arm64
trigger:
event:
- tag
# build steps arm64
steps:
- name: 'build and publish docker image'
image: plugins/docker
pull: if-not-exists
group: build
settings:
repo: olofvndrhr/manga-dlp
context: docker
dockerfile: docker/Dockerfile.arm64
auto_tag: true
auto_tag_suffix: linux-arm64
username:
from_secret: cr-dhub-username
password:
from_secret: cr-dhub-key
---
kind: pipeline
type: docker
name: docker-build-amd64
platform:
os: linux
arch: amd64
trigger:
event:
- tag
# build steps amd64
steps:
- name: 'build and publish docker image'
image: plugins/docker
pull: if-not-exists
group: build
settings:
repo: olofvndrhr/manga-dlp
context: docker
dockerfile: docker/Dockerfile.amd64
auto_tag: true
auto_tag_suffix: linux-amd64
username:
from_secret: cr-dhub-username
password:
from_secret: cr-dhub-key
---
kind: pipeline
type: docker
name: docker-publish-manifest
platform:
os: linux
arch: amd64
trigger:
event:
- tag
# build steps
steps:
- name: 'publish manifest'
image: plugins/manifest
settings:
spec: docker/manifest.tmpl
auto_tag: true
ignore_missing: true
username:
from_secret: cr-dhub-username
password:
from_secret: cr-dhub-key
depends_on:
- docker-build-amd64
- docker-build-arm64
---
###############
# git release #
###############
kind: pipeline
type: docker
name: git-release
platform:
os: linux
arch: amd64
trigger:
event:
- tag
# publish release on gitea and github
steps:
- name: 'create release tar'
image: 'cr.44net.ch/baseimages/debian-base'
pull: if-not-exists
group: publish
commands:
- tar -czf manga-dlp-${DRONE_TAG}.tar.gz --files-from=release-files.txt
- name: 'publish gitea release'
image: plugins/gitea-release
pull: if-not-exists
group: publish
settings:
api_key:
from_secret: gitea-token
base_url: https://git.44net.ch
files: manga-dlp-${DRONE_TAG}.tar.gz
title: 'manga-dlp release: ${DRONE_TAG}'
note: CHANGELOG.md
- name: 'publish github release'
image: plugins/github-release
pull: if-not-exists
group: publish
settings:
api_key:
from_secret: github-token
files: manga-dlp-${DRONE_TAG}.tar.gz
title: 'manga-dlp release: ${DRONE_TAG}'
note: CHANGELOG.md
#---
#################
## publish pypi #
#################
#kind: pipeline
#type: docker
#name: publish-pypi-package
#
#platform:
# os: linux
# arch: amd64
#
#trigger:
# event:
# - tag
#
## anchors
#pypi_secrets: &pypi_secrets
# username:
# from_secret: pypi-username
# password:
# from_secret: pypi-token
#
#pypi_plugin: &pypi_plugin
# image: plugins/pypi
# pull: if-not-exists
# group: publish
#
## publish package on pypi
#steps:
# - name: 'publish or update pypi package'
# <<: *pypi_plugin
# settings:
# # repository:
# setupfile: setup.py
# <<: *pypi_secrets