Skip to content

Commit 02b6193

Browse files
authored
Fix docs CI after version updates (#23)
* update actions versions * check what line is causing the error * reenable without tab * remove caching * install docs requirements * source common * activate bioconda * init conda * readd other activate * update deprecated status_iterator * update extlinks conf for new sphinx version * remove jquery * improve error messages * fix typo * fix a few minor errors
1 parent c9034f3 commit 02b6193

File tree

7 files changed

+95
-52
lines changed

7 files changed

+95
-52
lines changed

.github/workflows/docs.yml

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,26 @@ jobs:
1515
build-and-test:
1616
runs-on: "ubuntu-latest"
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919

2020
- name: set path
2121
run: echo "/opt/mambaforge/bin" >> $GITHUB_PATH
2222

2323
- name: Fetch conda install script
2424
run: |
25-
wget https://raw.githubusercontent.com/bioconda/bioconda-common/bulk/{common,install-and-set-up-conda,configure-conda}.sh
26-
27-
- name: Restore cache
28-
id: cache
29-
uses: actions/cache@v3
30-
with:
31-
path: /opt/mambaforge
32-
key: ${{ runner.os }}--bulk--${{ hashFiles('install-and-set-up-conda.sh', 'common.sh', 'configure-conda.sh') }}
25+
wget https://raw.githubusercontent.com/bioconda/bioconda-common/master/{common,install-and-set-up-conda,configure-conda}.sh
3326
3427
- name: Set up bioconda-utils
35-
if: steps.cache.outputs.cache-hit != 'true'
3628
run: bash install-and-set-up-conda.sh
3729

30+
- name: Install docs requirements
31+
run: |
32+
source common.sh
33+
eval "$(conda shell.bash hook)"
34+
conda activate bioconda
35+
conda install -y --file https://raw.githubusercontent.com/bioconda/bioconda-utils/$BIOCONDA_UTILS_TAG/bioconda_utils/bioconda_utils-requirements-docs.txt
36+
3837
# This script can be used to reconfigure conda to use the right channel setup.
39-
# This has to be done after the cache is restored, because
40-
# the channel setup is not cached as it resides in the home directory.
41-
# We could use a system-wide (and therefore cached) channel setup,
42-
# but mamba does not support that at the time of implementation
43-
# (it ignores settings made with --system).
4438
- name: Configure conda
4539
run: bash configure-conda.sh
4640

@@ -74,7 +68,7 @@ jobs:
7468
# Upload the built docs as an artifact for inspection (even on PRs). This
7569
# will show up in the Actions web interface.
7670
- name: push artifact
77-
uses: actions/upload-artifact@v3
71+
uses: actions/upload-artifact@v4
7872
with:
7973
name: doc
8074
path: docs.tar

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ BUILDDIR = build
99

1010
# User-friendly check for sphinx-build
1111
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12-
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don\'t have Sphinx installed, grab it from http://sphinx-doc.org/)
12+
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don\'t have Sphinx installed, grab it from http://sphinx-doc.org/)
1313
endif
1414

1515
# Internal variables.

source/_ext/bioconda_sphinx_ext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from sphinx.environment import BuildEnvironment
3838
from sphinx.roles import XRefRole
3939
from sphinx.util import logging as sphinx_logging
40-
from sphinx.util import status_iterator
40+
from sphinx.util.display import status_iterator
4141
from sphinx.util.docfields import Field, GroupedField
4242
from sphinx.util.nodes import make_refnode
4343
from sphinx.util.parallel import ParallelTasks, parallel_available, make_chunks

source/conf.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,14 @@ def setup(app):
308308

309309
# We are using the `extlinks` extension to render links for identifiers:
310310
extlinks = {
311-
"biotools": ("https://bio.tools/%s", ""),
312-
"doi": ("https://doi.org/%s", ""),
313-
"debian": ("https://tracker.debian.org/pkg/%s", ""),
314-
"pmid": ("https://www.ncbi.nlm.nih.gov/pubmed/%s", ""),
315-
"rrid": ("https://scicrunch.org/resolver/%s", ""),
316-
"usegalaxy-eu": ("https://usegalaxy.eu/?tool_id=%s", ""),
317-
"usegalaxy-org": ("https://usegalaxy.org/?tool_id=%s", ""),
318-
"usegalaxy-org.au": ("https://usegalaxy.org.au/?tool_id=%s", ""),
311+
"biotools": ("https://bio.tools/%s", "%s"),
312+
"doi": ("https://doi.org/%s", "%s"),
313+
"debian": ("https://tracker.debian.org/pkg/%s", "%s"),
314+
"pmid": ("https://www.ncbi.nlm.nih.gov/pubmed/%s", "%s"),
315+
"rrid": ("https://scicrunch.org/resolver/%s", "%s"),
316+
"usegalaxy-eu": ("https://usegalaxy.eu/?tool_id=%s", "%s"),
317+
"usegalaxy-org": ("https://usegalaxy.org/?tool_id=%s", "%s"),
318+
"usegalaxy-org.au": ("https://usegalaxy.org.au/?tool_id=%s", "%s"),
319319
}
320320

321321
# add document name before automatic section title reference

source/templates/dashboard.html

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
<div style="width: 100%" id="package_plot"></div>
33

44
<script>
5-
window.onload = function () {
6-
// Download download plot data
7-
$.get("https://raw.githubusercontent.com/bioconda/bioconda-stats/data/package-downloads/anaconda.org/bioconda/channel.tsv", function (bioconda_data) {
5+
window.onload = async function () {
86

7+
function buildDownloadsPlot(bioconda_data) {
98
let spec = {
109
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
1110
"description": "Total bioconda downloads.",
@@ -52,11 +51,21 @@
5251
};
5352

5453
vegaEmbed('#download_plot', spec);
55-
});
54+
}
5655

5756
// Download download plot data
58-
$.get("https://raw.githubusercontent.com/bioconda/bioconda-stats/data/package-downloads/anaconda.org/bioconda/packages.tsv", function (package_data) {
57+
try {
58+
const bioconda_resp = await fetch("https://raw.githubusercontent.com/bioconda/bioconda-stats/data/package-downloads/anaconda.org/bioconda/channel.tsv")
59+
if (!bioconda_resp.ok) {
60+
throw new Error(`Fetching failed with HTTP code ${bioconda_resp.status}.`);
61+
}
62+
const bioconda_data = await bioconda_resp.text();
63+
buildDownloadsPlot(bioconda_data);
64+
} catch (err) {
65+
console.error("An error occurred while building channel downloads plot: ", err)
66+
}
5967

68+
function buildTopPackagesPlot(package_data) {
6069
let package_spec = {
6170
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
6271
"description": "Top downloaded packages.",
@@ -85,6 +94,20 @@
8594
};
8695

8796
vegaEmbed('#package_plot', package_spec);
88-
});
97+
};
98+
99+
100+
// Download package plot data
101+
try {
102+
const package_resp = await fetch("https://raw.githubusercontent.com/bioconda/bioconda-stats/data/package-downloads/anaconda.org/bioconda/packages.tsv")
103+
if (!package_resp.ok) {
104+
throw new Error(`Fetching failed with HTTP code ${package_resp.status}.`);
105+
}
106+
const package_data = await package_resp.text();
107+
buildTopPackagesPlot(package_data);
108+
} catch (err) {
109+
console.error("An error occurred while building top packages plot: ", err)
110+
}
111+
89112
}
90113
</script>

source/templates/layout.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<meta name="msapplication-TileColor" content="#ffffff">
2424
<meta name="msapplication-TileImage" content="{{pathto('_static/ms-icon-144x144.png', 1)}}">
2525

26-
<link rel="manifest" href="/manifest.json">
26+
<link rel="manifest" href="{{pathto('_static/manifest.json', 1)}}">
2727
<meta name="theme-color" content="#ffffff">
2828
{{ super() }}
2929
{% endblock %}
@@ -38,7 +38,7 @@
3838
if (elem != null) {
3939
// Get the closest "details" element and open it
4040
closest = elem.closest("details");
41-
closest.open = true;
41+
if (closest) closest.open = true;
4242
}
4343
</script>
4444

source/templates/package_dashboard.html

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,49 @@
33

44
<script>
55
window.onload = async function() {
6-
$.get(`https://raw.githubusercontent.com/bioconda/bioconda-plots/main/resources/cdf.vl.json`, function( data ) {
7-
let spec = JSON.parse(data);
8-
$.get(`https://raw.githubusercontent.com/bioconda/bioconda-plots/main/plots/cdf.json`, function( plot_data ) {
9-
$.get(`https://raw.githubusercontent.com/bioconda/bioconda-plots/main/plots/${package}/cdf.json`, function( single_point ) {
10-
spec.data.values = JSON.parse(plot_data);
11-
spec.data.values.push(JSON.parse(single_point).pop());
12-
vegaEmbed('#cdf_plot', spec);
13-
});
14-
});
15-
});
16-
17-
$.get(`https://raw.githubusercontent.com/bioconda/bioconda-plots/main/resources/versions.vl.json`, function( data ) {
18-
let spec = JSON.parse(data);
19-
$.get(`https://raw.githubusercontent.com/bioconda/bioconda-plots/main/plots/${package}/versions.json`, function( plot_data ) {
20-
spec.data.values = JSON.parse(plot_data);
21-
vegaEmbed('#download_plot', spec);
22-
});
23-
});
6+
7+
// Build cdf plot
8+
try {
9+
const cdf_spec_resp = await fetch("https://raw.githubusercontent.com/bioconda/bioconda-plots/main/resources/cdf.vl.json")
10+
if (!cdf_spec_resp.ok) {
11+
throw new Error(`Fetching failed with HTTP code ${cdf_spec_resp.status}.`);
12+
}
13+
const cdf_spec = await cdf_spec_resp.json();
14+
const cdf_data_resp = await fetch("https://raw.githubusercontent.com/bioconda/bioconda-plots/main/plots/cdf.json")
15+
if (!cdf_data_resp.ok) {
16+
throw new Error(`Fetching failed with HTTP code ${cdf_data_resp.status}.`);
17+
}
18+
const cdf_plot_data = await cdf_data_resp.json();
19+
const point_data_resp = await fetch(`https://raw.githubusercontent.com/bioconda/bioconda-plots/main/plots/${package}/cdf.json`)
20+
if (!point_data_resp.ok) {
21+
throw new Error(`Fetching failed with HTTP code ${point_data_resp.status}.`);
22+
}
23+
const single_point = await point_data_resp.json();
24+
25+
cdf_spec.data.values = cdf_plot_data;
26+
cdf_spec.data.values.push(single_point.pop());
27+
vegaEmbed('#cdf_plot', cdf_spec);
28+
} catch (err) {
29+
console.error("An error occurred while building CDF plot: ", err)
30+
}
31+
32+
// Build download plot
33+
try {
34+
const spec_resp = await fetch("https://raw.githubusercontent.com/bioconda/bioconda-plots/main/resources/versions.vl.json")
35+
if (!spec_resp.ok) {
36+
throw new Error(`Fetching failed with HTTP code ${spec_resp.status}.`);
37+
}
38+
const spec = await spec_resp.json();
39+
const version_data_resp = await fetch(`https://raw.githubusercontent.com/bioconda/bioconda-plots/main/plots/${package}/versions.json`)
40+
if (!version_data_resp.ok) {
41+
throw new Error(`Fetching failed with HTTP code ${version_data_resp.status}.`);
42+
}
43+
const plot_data = await version_data_resp.json();
44+
spec.data.values = plot_data;
45+
vegaEmbed('#download_plot', spec);
46+
} catch (err) {
47+
console.error("An error occurred while building downloads plot: ", err)
48+
}
49+
2450
}
2551
</script>

0 commit comments

Comments
 (0)