forked from reanahub/reana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli: add command to generate build status wiki
closes reanahub#435
- Loading branch information
1 parent
b962864
commit 80d3470
Showing
2 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of REANA. | ||
# Copyright (C) 2020 CERN. | ||
# | ||
# REANA is free software; you can redistribute it and/or modify it | ||
# under the terms of the MIT License; see LICENSE file for more details. | ||
|
||
"""`reana-dev`'s wiki commands.""" | ||
|
||
import click | ||
|
||
GITHUB_REANAHUB_URL = "https://github.com/reanahub" | ||
CODECOV_REANAHUB_URL = "https://codecov.io/gh/reanahub" | ||
|
||
|
||
@click.group() | ||
def wiki_commands(): | ||
"""Wiki commands group.""" | ||
|
||
|
||
@wiki_commands.command(name="wiki-create-build-status-page") | ||
def create_build_status_page(): | ||
"""Generate Markdown for the Build Status wiki page.""" | ||
sections = { | ||
"researchers": { | ||
"title": "For researchers", | ||
"description": "Find out how you can use REANA to describe, run, preserve and reuse your analyses.", | ||
"packages": { | ||
"reana-client": {}, | ||
"docs.reana.io": {"coverage": False, "docs": False}, | ||
"www.reana.io": {"coverage": False, "docs": False}, | ||
}, | ||
}, | ||
"administrators": { | ||
"title": "For administrators", | ||
"description": "Install and manage the REANA reusable analysis platform on your own compute cloud.", | ||
"packages": { | ||
"reana-commons": {}, | ||
"reana-db": {}, | ||
"reana-job-controller": {}, | ||
"reana-message-broker": {}, | ||
"reana-server": {}, | ||
"reana-ui": {}, | ||
"reana-workflow-controller": {}, | ||
"reana-workflow-engine-cwl": {}, | ||
"reana-workflow-engine-serial": {}, | ||
"reana-workflow-engine-yadage": {}, | ||
"reana-workflow-monitor": {}, | ||
}, | ||
}, | ||
"developers": { | ||
"title": "For developers", | ||
"description": "Understand REANA source code, adapt it to your needs, contribute changes back.", | ||
"packages": {"reana": {}, "pytest-reana": {}}, | ||
}, | ||
"environments": { | ||
"simple": True, | ||
"title": "Environments", | ||
"description": "Selected containerised environments.", | ||
"packages": { | ||
"reana-env-aliphysics": {}, | ||
"reana-env-jupyter": {}, | ||
"reana-env-root6": {}, | ||
"reana-auth-krb5": {}, | ||
"reana-auth-vomsproxy": {}, | ||
}, | ||
}, | ||
"examples": { | ||
"simple": True, | ||
"title": "Examples", | ||
"description": "Selected reusable analysis examples.", | ||
"packages": { | ||
"reana-demo-alice-lego-train-test-run": {}, | ||
"reana-demo-alice-pt-analysis": {}, | ||
"reana-demo-atlas-recast": {}, | ||
"reana-demo-bsm-search": {}, | ||
"reana-demo-cdci-crab-pulsar-integral-verification": {}, | ||
"reana-demo-cdci-integral-data-reduction": {}, | ||
"reana-demo-cms-h4l": {}, | ||
"reana-demo-cms-reco": {}, | ||
"reana-demo-cms-dimuon-mass-spectrum": {}, | ||
"reana-demo-fcchh-fullsim": {}, | ||
"reana-demo-helloworld": {}, | ||
"reana-demo-lhcb-d2pimumu": {}, | ||
"reana-demo-lhcb-mc-production": {}, | ||
"reana-demo-root6-roofit": {}, | ||
"reana-demo-worldpopulation": {}, | ||
}, | ||
}, | ||
} | ||
|
||
def _print_section(data): | ||
click.echo(f"### {data['title']}\n") | ||
click.echo(f"{data['description']}\n") | ||
_print_table(data["packages"], simple=data.get("simple")) | ||
click.echo() | ||
|
||
def _print_header(hs): | ||
header = separator = "|" | ||
for h in hs: | ||
header += f" {h} |" | ||
separator += f" {'-' * len(h)} |" | ||
click.echo(header) | ||
click.echo(separator) | ||
|
||
def _print_table(components, simple=False): | ||
if simple: | ||
headers = ["Package", "Build", "Version"] | ||
else: | ||
headers = [ | ||
"Package", | ||
"`maint-0.7`", | ||
"`master`", | ||
"Docs", | ||
"Coverage", | ||
"Version", | ||
] | ||
_print_header(headers) | ||
for c, options in components.items(): | ||
table_row = f"| [{c}]({GITHUB_REANAHUB_URL}/{c}) " | ||
if not simple: | ||
table_row += f"| [![maint-0.7]({GITHUB_REANAHUB_URL}/{c}/workflows/CI/badge.svg?branch=maint-0.7)]({GITHUB_REANAHUB_URL}/{c}/actions?query=branch:maint-0.7) " | ||
|
||
table_row += f"| [![master]({GITHUB_REANAHUB_URL}/{c}/workflows/CI/badge.svg?branch=master)]({GITHUB_REANAHUB_URL}/{c}/actions?query=branch:master) " | ||
|
||
if not simple: | ||
table_row += ( | ||
f"| [![Docs](https://readthedocs.org/projects/{c}/badge/?version=latest)](https://{c}.readthedocs.io/en/latest/?badge=latest) " | ||
if options.get("docs", True) | ||
else "| N/A " | ||
) + ( | ||
f"| [![Coverage]({CODECOV_REANAHUB_URL}/{c}/branch/master/graph/badge.svg)]({CODECOV_REANAHUB_URL}/{c}) " | ||
if options.get("coverage", True) | ||
else "| N/A " | ||
) | ||
|
||
table_row += f"| [![Tag](https://img.shields.io/github/tag/reanahub/{c}.svg)]({GITHUB_REANAHUB_URL}/{c}/releases) |" | ||
|
||
click.echo(table_row) | ||
click.echo() | ||
|
||
click.echo("# REANA build status\n") | ||
for section, data in sections.items(): | ||
_print_section(data) | ||
|
||
|
||
wiki_commands_list = list(wiki_commands.commands.values()) |