[docs] added download artifacts badge (#1883)

* added download artifacts badge

* hotfix

* store badge images locally

* explicitly set the order
This commit is contained in:
Nikita Titov 2018-12-08 07:38:14 +03:00 коммит произвёл Qiwei Ye
Родитель f55e37d026
Коммит 47f0d5e806
5 изменённых файлов: 27 добавлений и 2 удалений

Просмотреть файл

@ -5,6 +5,8 @@ Here is the guide for the build of LightGBM CLI version.
For the build of Python-package and R-package, please refer to `Python-package`_ and `R-package`_ folders respectively.
Also you can download artifacts of the latest successful build in master branch: |download artifacts|.
**Contents**
- `Windows <#windows>`__
@ -643,6 +645,9 @@ On Linux Java wrapper of LightGBM can be built using **Java**, **SWIG**, **CMake
cmake -DUSE_SWIG=ON ..
make -j4
.. |download artifacts| image:: ./_static/images/artifacts-not-available.svg
:target: https://lightgbm.readthedocs.io/en/latest/Installation-Guide.html
.. _Python-package: https://github.com/Microsoft/LightGBM/tree/master/python-package
.. _R-package: https://github.com/Microsoft/LightGBM/tree/master/R-package

1
docs/_static/images/artifacts-download.svg поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="118" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="118" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h55v20H0z"/><path fill="#4c1" d="M55 0h63v20H55z"/><path fill="url(#b)" d="M0 0h118v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="285" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450">artifacts</text><text x="285" y="140" transform="scale(.1)" textLength="450">artifacts</text><text x="855" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">download</text><text x="855" y="140" transform="scale(.1)" textLength="530">download</text></g> </svg>

После

Ширина:  |  Высота:  |  Размер: 964 B

1
docs/_static/images/artifacts-fetching.svg поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="122" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="122" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h55v20H0z"/><path fill="#9f9f9f" d="M55 0h67v20H55z"/><path fill="url(#b)" d="M0 0h122v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="285" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450">artifacts</text><text x="285" y="140" transform="scale(.1)" textLength="450">artifacts</text><text x="875" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="570">fetching...</text><text x="875" y="140" transform="scale(.1)" textLength="570">fetching...</text></g> </svg>

После

Ширина:  |  Высота:  |  Размер: 973 B

1
docs/_static/images/artifacts-not-available.svg поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="302" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="302" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h55v20H0z"/><path fill="#9f9f9f" d="M55 0h247v20H55z"/><path fill="url(#b)" d="M0 0h302v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="285" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450">artifacts</text><text x="285" y="140" transform="scale(.1)" textLength="450">artifacts</text><text x="1775" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="2370">link is available only on Read the Docs site</text><text x="1775" y="140" transform="scale(.1)" textLength="2370">link is available only on Read the Docs site</text></g> </svg>

После

Ширина:  |  Высота:  |  Размер: 1.0 KiB

21
docs/_static/js/script.js поставляемый
Просмотреть файл

@ -1,7 +1,9 @@
$(function() {
$('a[href^="./"][href*=".rst"]').attr('href', (i, val) => { return val.replace('.rst', '.html'); }); /* Replace '.rst' with '.html' in all internal links like './[Something].rst[#anchor]' */
/* Replace '.rst' with '.html' in all internal links like './[Something].rst[#anchor]' */
$('a[href^="./"][href*=".rst"]').attr('href', (i, val) => { return val.replace('.rst', '.html'); });
$('.wy-nav-content').each(function () { this.style.setProperty('max-width', 'none', 'important'); }); /* Use wider container for the page content */
/* Use wider container for the page content */
$('.wy-nav-content').each(function() { this.style.setProperty('max-width', 'none', 'important'); });
/* Collapse specified sections in the installation guide */
if(window.location.pathname.toLocaleLowerCase().indexOf('installation-guide') != -1) {
@ -26,5 +28,20 @@ $(function() {
$('.wy-menu.wy-menu-vertical li a.reference.internal').click(function() {
uncollapse($($(this).attr('href')));
});
/* Modify src and href attrs of artifacts badge */
function modifyBadge(src, href) {
$('img[alt="download artifacts"]').each(function() {
this.src = src;
this.parentNode.href = href;
});
}
/* Initialize artifacts badge */
modifyBadge('./_static/images/artifacts-fetching.svg', '#');
/* Fetch latest buildId and construct artifacts badge */
$.getJSON('https://dev.azure.com/lightgbm-ci/lightgbm-ci/_apis/build/builds?branchName=refs/heads/master&resultFilter=succeeded&queryOrder=finishTimeDescending&%24top=1&api-version=5.0-preview.5', function(data) {
modifyBadge('./_static/images/artifacts-download.svg',
'https://dev.azure.com/lightgbm-ci/lightgbm-ci/_apis/build/builds/' + data['value'][0]['id'] + '/artifacts?artifactName=PackageAssets&api-version=5.0-preview.5&%24format=zip');
});
}
});