2021-12-19 17:22:41 +01:00
|
|
|
---
|
|
|
|
######################
|
|
|
|
# sonarqube analysis #
|
|
|
|
######################
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: sonarqube-analysis
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
2022-05-09 21:07:37 +02:00
|
|
|
- push
|
2021-12-19 17:22:41 +01:00
|
|
|
|
|
|
|
# anchors
|
|
|
|
sq_secrets: &sq_secrets
|
|
|
|
sonar_host: 'https://sonarqube.44net.ch'
|
|
|
|
sonar_token:
|
|
|
|
from_secret: sq-44net-token
|
|
|
|
|
|
|
|
sq_analysis: &sq_analysis
|
|
|
|
image: 'cr.44net.ch/drone-plugins/sonarqube'
|
|
|
|
pull: if-not-exists
|
2022-05-10 16:38:14 +02:00
|
|
|
group: test
|
2021-12-19 17:22:41 +01:00
|
|
|
|
2022-05-10 16:38:14 +02:00
|
|
|
test_plugin: &test_plugin
|
|
|
|
image: 'cr.44net.ch/drone-plugins/test'
|
|
|
|
pull: if-not-exists
|
|
|
|
group: publish
|
|
|
|
|
|
|
|
# steps
|
2021-12-19 17:22:41 +01:00
|
|
|
steps:
|
2022-05-10 16:38:14 +02:00
|
|
|
# test python code
|
|
|
|
- name: 'test code and generate coverage report'
|
|
|
|
<<: *test_plugin
|
|
|
|
commands:
|
2022-05-10 16:43:01 +02:00
|
|
|
- pip install -r requirements.txt
|
2022-05-10 16:38:14 +02:00
|
|
|
- coverage erase
|
2022-05-10 16:58:01 +02:00
|
|
|
- coverage run -m pytest --verbose
|
2022-05-10 16:38:14 +02:00
|
|
|
- coverage xml -i
|
|
|
|
|
|
|
|
# upload analysis to sonarqube
|
2022-05-09 21:07:37 +02:00
|
|
|
- name: 'sonarqube: analyse code'
|
|
|
|
<<: *sq_analysis
|
|
|
|
settings:
|
|
|
|
<<: *sq_secrets
|
2022-05-10 16:38:14 +02:00
|
|
|
exclusions: contrib/**, docker/**
|
2021-12-24 16:30:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
################
|
|
|
|
# docker build #
|
|
|
|
################
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: docker-build-arm64
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: arm64
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
2022-05-09 21:07:37 +02:00
|
|
|
- tag
|
2021-12-24 16:30:50 +01:00
|
|
|
|
|
|
|
# anchors
|
|
|
|
cr_secrets: &cr_secrets
|
|
|
|
username:
|
|
|
|
from_secret: cr-dhub-username
|
|
|
|
password:
|
|
|
|
from_secret: cr-dhub-key
|
|
|
|
|
|
|
|
docker_build: &docker_build
|
|
|
|
image: plugins/docker
|
|
|
|
pull: if-not-exists
|
|
|
|
group: build
|
|
|
|
|
|
|
|
# build steps arm64
|
|
|
|
steps:
|
2022-05-09 21:07:37 +02:00
|
|
|
- name: 'build and publish docker image'
|
|
|
|
<<: *docker_build
|
|
|
|
settings:
|
|
|
|
repo: olofvndrhr/manga-dlp
|
|
|
|
context: docker
|
|
|
|
dockerfile: docker/Dockerfile.arm64
|
|
|
|
auto_tag: true
|
|
|
|
auto_tag_suffix: linux-arm64
|
|
|
|
<<: *cr_secrets
|
2021-12-24 16:30:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: docker-build-amd64
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
2022-05-09 21:07:37 +02:00
|
|
|
- tag
|
2021-12-24 16:30:50 +01:00
|
|
|
|
|
|
|
# anchors
|
|
|
|
cr_secrets: &cr_secrets
|
|
|
|
username:
|
|
|
|
from_secret: cr-dhub-username
|
|
|
|
password:
|
|
|
|
from_secret: cr-dhub-key
|
|
|
|
|
|
|
|
docker_build: &docker_build
|
|
|
|
image: plugins/docker
|
|
|
|
pull: if-not-exists
|
|
|
|
group: build
|
|
|
|
|
|
|
|
# build steps amd64
|
|
|
|
steps:
|
2022-05-09 21:07:37 +02:00
|
|
|
- name: 'build and publish docker image'
|
|
|
|
<<: *docker_build
|
|
|
|
settings:
|
|
|
|
repo: olofvndrhr/manga-dlp
|
|
|
|
context: docker
|
|
|
|
dockerfile: docker/Dockerfile.amd64
|
|
|
|
auto_tag: true
|
|
|
|
auto_tag_suffix: linux-amd64
|
|
|
|
<<: *cr_secrets
|
2021-12-24 16:30:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: docker-publish-manifest
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
2022-05-09 21:07:37 +02:00
|
|
|
- tag
|
2021-12-24 16:30:50 +01:00
|
|
|
|
|
|
|
# anchors
|
|
|
|
cr_secrets: &cr_secrets
|
|
|
|
username:
|
|
|
|
from_secret: cr-dhub-username
|
|
|
|
password:
|
|
|
|
from_secret: cr-dhub-key
|
|
|
|
|
|
|
|
# build steps
|
|
|
|
steps:
|
2022-05-09 21:07:37 +02:00
|
|
|
- name: 'publish manifest'
|
|
|
|
image: plugins/manifest
|
|
|
|
settings:
|
|
|
|
spec: docker/manifest.tmpl
|
|
|
|
auto_tag: true
|
|
|
|
ignore_missing: true
|
|
|
|
<<: *cr_secrets
|
2021-12-24 16:30:50 +01:00
|
|
|
|
|
|
|
depends_on:
|
|
|
|
- docker-build-amd64
|
|
|
|
- docker-build-arm64
|
|
|
|
|
2022-05-10 16:38:14 +02:00
|
|
|
---
|
|
|
|
#################
|
|
|
|
# gitea release #
|
|
|
|
#################
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: gitea-release
|
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- tag
|
|
|
|
|
|
|
|
# anchors
|
|
|
|
gitea_secrets: &gitea_secrets
|
|
|
|
api_key:
|
|
|
|
from_secret: gitea-token
|
|
|
|
|
|
|
|
gitea_plugin: &gitea_plugin
|
|
|
|
image: plugins/gitea-release
|
|
|
|
pull: if-not-exists
|
|
|
|
group: publish
|
|
|
|
|
|
|
|
# publish release on gitea
|
|
|
|
steps:
|
|
|
|
- name: 'publish or update pypi package'
|
|
|
|
<<: *gitea_plugin
|
|
|
|
settings:
|
|
|
|
base_url: https://git.44net.ch
|
|
|
|
files: ./*
|
|
|
|
title: 'manga-dlp release: ${DRONE_TAG}'
|
|
|
|
note: CHANGELOG.md
|
|
|
|
<<: *gitea_secrets
|
|
|
|
|
2022-05-09 21:07:37 +02:00
|
|
|
#---
|
|
|
|
#################
|
|
|
|
## publish pypi #
|
|
|
|
#################
|
|
|
|
#kind: pipeline
|
|
|
|
#type: docker
|
|
|
|
#name: publish-pypi-package
|
|
|
|
#
|
|
|
|
#platform:
|
|
|
|
# os: linux
|
2022-05-10 16:38:14 +02:00
|
|
|
# arch: amd64
|
2022-05-09 21:07:37 +02:00
|
|
|
#
|
|
|
|
#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
|
2022-05-10 16:38:14 +02:00
|
|
|
# group: publish
|
2022-05-09 21:07:37 +02:00
|
|
|
#
|
2022-05-10 16:38:14 +02:00
|
|
|
## publish package on pypi
|
2022-05-09 21:07:37 +02:00
|
|
|
#steps:
|
|
|
|
# - name: 'publish or update pypi package'
|
|
|
|
# <<: *pypi_plugin
|
|
|
|
# settings:
|
|
|
|
# # repository:
|
|
|
|
# setupfile: setup.py
|
|
|
|
# <<: *pypi_secrets
|