Skip to content

Commit

Permalink
Merge branch 'release/1.14'
Browse files Browse the repository at this point in the history
  • Loading branch information
denis-yuen committed May 31, 2023
2 parents 5de848d + d26422b commit 3a3bed3
Show file tree
Hide file tree
Showing 126 changed files with 1,531 additions and 234 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docs/dictionary.rst linguist-generated=true
docs/_attic/glossary_entries_list_dynamic.txt linguist-generated=true
37 changes: 37 additions & 0 deletions .github/workflows/add-discourse-topic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Add discourse topic
on:
workflow_dispatch:
jobs:
add-discourse-topic:
runs-on: ubuntu-latest
steps:

# Get the branch
- name: Get the branch
uses: actions/checkout@v3

# Abort if the branch is master or develop
- name: Abort if master or develop
run: |
branch=$(git rev-parse --abbrev-ref HEAD)
echo "Branch: ${branch}"
case ${branch} in master|develop) echo 'Aborting.'; exit 1;; esac
# Identify the action
- name: Identify the action
run: |
git config --global user.name "GitHub Action (Add discourse topic)"
git config --global user.email "<support@dockstore.org>"
# Add any missing discourse topics
- name: Add topics
env:
DISCOURSE_API_KEY: ${{ secrets.DISCOURSE_API_KEY }}
run: |
./add-discourse-topic-to-all.sh
# Commit and push, should do nothing if there were no changes.
- name: Commit and push
run: |
git commit -a -m "add discourse topic"
git push
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
https://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

Expand Down Expand Up @@ -192,7 +192,7 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
25 changes: 25 additions & 0 deletions add-discourse-topic-to-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
#
# Copyright 2022 OICR and UCSC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Adds a discourse topic to all RSTs that need it.

source helpers.sh

for file in $(find . -name '*.rst' | sed 's/^.\///' | grep -Fvxf no-discourse-topic-required.txt); do
if ! containsDiscourseTopic "$file"; then
./add-discourse-topic.sh "$file"
fi
done
123 changes: 123 additions & 0 deletions add-discourse-topic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#!/bin/bash
#
# Copyright 2022 OICR and UCSC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This script determines if a specified RST references a discourse topic, and if not, it attempts to
# extract some information from the RST, create a Discourse topic, and modify the RST to reference the new topic.

set -e
set -u

source helpers.sh

DOCS_URL="https://docs.dockstore.org/en/stable"
DISCOURSE_URL="https://discuss.dockstore.org/posts.json"
DISCOURSE_CATEGORY=8

file=$1

# Check if the file exists.
if ! [ -f "$file" ]; then
echo "${file} does not exist."
echo "No action taken."
exit 1
fi

# Make sure this is a file with suffix 'rst' that is referenced from the root of the repo.
if ! [[ "$file" =~ ^docs/.*\.rst$ ]]; then
echo "${file} should have suffix 'rst' and be referenced relative to the root of the documentation repo."
echo "Example: docs/some-category/some-documentation.rst"
echo "No action taken."
exit 1
fi

# Check if the file already contains a discourse topic.
if containsDiscourseTopic "$file"; then
echo "${file} has a discourse topic."
echo "No action taken."
exit 1
fi

# Check if the file contains a top-level RST header.
# If not, abort, because the file is probably meant to be included in another file.
if ! grep -q '^[#*=]' "$file"; then
echo "${file} does not contain a top-level RST header."
echo "No action taken."
exit 1
fi

# Extract some information from the file.
echo "Extracting information from ${file}."
# Title is calculated as the first non-blank line that does not begin with a space directly precedes a line starting with one of '#*=-~'.
title=$(cat "$file" | tac | grep -A1 '^[^#*=~-]' | grep '^[^#*=~-]' | tac | grep -v '^\.\. ' | grep -v '^ ' | grep '.' | head -1 )
# Summary is calculated as the first block of regular non-indented text starting with a letter or backquote, with newlines converted to spaces, some common RST markup stripped out, and consecutive spaces condensed to one.
summary=$(cat "$file" | tac | sed '/^[#*=~-]\{2\}/,/^/d' | grep -v '^\.\.' | tac | \
sed -n '/^[`A-Za-z]/,$p' | sed '/^\s*$/,$d' | tr '\n' ' ' | \
sed 's/:[^:]*:`/`/g' | sed 's/`\([^<]*\) <[^>]*>`/\1/g' | tr -d '_' | tr -d '`' | sed 's/ */ /g' )

# Compute the documentation site URL
html_path="$(echo "$file" | sed 's/^docs\///' | sed 's/\.rst$//').html"
docs_url="${DOCS_URL}/${html_path}"

# Echo the inputs to the Discouse topic creation request.
echo "Title: ${title}"
echo "Summary: ${summary}"
echo "Embed URL: ${docs_url}"
echo "Discourse URL: ${DISCOURSE_URL}"
echo "Discourse Category: ${DISCOURSE_CATEGORY}"

# Check that all computed values are reasonable
if [ -z "$title" ] || [ -z "$summary" ]; then
echo "Empty title or summary."
echo "No action taken."
exit 1
fi

# Create a new discourse topic.
echo "Creating a discourse topic."
response=$(curl -s -X POST "${DISCOURSE_URL}" \
-H "Api-Key: ${DISCOURSE_API_KEY}" \
-H "Api-Username: system" \
-H "cache-control: no-cache" \
-F "title=${title}" \
-F "raw=${summary}" \
-F "embed_url=${docs_url}" \
-F "category=${DISCOURSE_CATEGORY}")
echo "Response: ${response}"

# Process the response.
topic_id=$(echo "$response" | jq .topic_id)
echo "Topic ID: ${topic_id}"

# Make sure that the extracted topic ID is a number.
if ! [[ "$topic_id" =~ ^[0-9]+$ ]]; then
echo "Missing or non-numeric topic ID in response."
echo "Aborting.";
exit 1
fi

# Print a confirmation and the topic ID.
echo "Created discourse topic."
echo "Topic ID: ${topic_id}"

# Add the topic ID to the RST file.
echo "Adding reference to new topic to ${file}."
sed -i- -e '/.$/a\' "$file"
echo "" >> "$file"
echo ".. discourse::" >> "$file"
echo " :topic_identifier: ${topic_id}" >> "$file"

# Signal success.
echo "Success."
28 changes: 10 additions & 18 deletions discourse-topic-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -15,19 +15,7 @@

# This script determines if all changed files rst files in a PR have a discourse topic
source base-branch.sh

# Determines if a file has a discourse topic

function containsDiscourseTopic {
grep -A1 "^.. discourse::" $fileToCheck | tail -n1 | grep -E "^( )*:topic_identifier:( )*[0-9]+" > /dev/null
if [ $? != 0 ]
then
echo "${fileToCheck} does not have a discourse topic"
return 1
else
return 0
fi
}
source helpers.sh

RETURN_VALUE=0
DOES_NOT_REQUIRE_DISCOURSE_TOPIC=no-discourse-topic-required.txt
Expand All @@ -41,12 +29,16 @@ then
baseBranch="$(curl -s $pr | jq -r '.base.ref')"
fi

for file in $(git diff --name-only "$baseBranch".. | grep -E "*\.rst" | grep -Fvxf $DOES_NOT_REQUIRE_DISCOURSE_TOPIC)
for file in $(git diff --name-only "$baseBranch".. | grep "\.rst$" | grep -Fvxf $DOES_NOT_REQUIRE_DISCOURSE_TOPIC)
do
fileToCheck=$file
if ! containsDiscourseTopic
# The file may be in the base branch but not the current branch. Skip in that case.
if [[ -f "$file" ]]
then
RETURN_VALUE=1
if ! containsDiscourseTopic "$file"
then
echo "${file} does not have a discourse topic"
RETURN_VALUE=1
fi
fi
done

Expand Down
46 changes: 36 additions & 10 deletions docs/_attic/glossary_entries.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# This file is called by _attic/glossary_generator.py to generate a glossary in RST format.
# Its dependency, glossarpy, is currently managed by Ash O'Farrell/Team Lighthouse Point.
# _attic/glossary_generator.py will alphabetize entries before putting rendering the RST, but please try to keep this list in alphabetical order for the sake of organization.
# Its dependency, glossarpy, is currently maintained by Ash O'Farrell.
#
# To reference any entry here elsewhere in our documentation, use :ref:`dict x` where x is
# the name of the entry, with spaces. Example: :ref:`dict Amazon Genomics CLI`
#
# Style Guide:
# * glossary_generator.py will alphabetize entries in the rendered RST, but please try to keep this .py file in
# alphabetical order for the sake of organization
# * Do not create newlines within strings (glossarpy can handle this but it makes tracking changes harder).
# * Do not use title case for the `name` of a GlossEntry; follow actual dictionary capitalization conventions
# * To link one GlossEntry to another in `definition` or `acronym_full` enclose the name (first position arg) of the entry to link in [brackets]
# * To link one GlossEntry to another in `definition` or `acronym_full` enclose the name (first positional arg)
# of the entry to link in [brackets]
# * Due to RST limitations, do not make internal links plural
# * acceptable: [WDL] [WDL], [WDL]. [WDL]'s [Seven Bridges] [Seven Bridges], [Seven Bridges]. [Seven Bridges]'s
# * will break: [WDL]s [Seven Bridges]s
Expand Down Expand Up @@ -67,7 +72,7 @@
BioDataCatalyst = GlossEntry("BioData Catalyst",
acronym_full="",
definition="A cloud-based platform funded by [NHLBI] to provide tools, applications, and workflows in secure workspaces to expand research in heart, lung, blood, and sleep health.",
furtherreading="https://biodatacatalyst.nhlbi.nih.gov/",
furtherreading="https://dockstore.org/organizations/bdcatalyst",
institute="",
pronunciation="")

Expand Down Expand Up @@ -111,7 +116,7 @@

CommonWorkflowLanguage = GlossEntry("Common Workflow Language",
acronym_full="",
definition="A workflow language that describes how to run command-line tools. [WDL] and CWL are relatively similar in principle, and code written in one language can often be translated into the other with some workarounds, but they are two different standards and each have unique features. For example, CWL has the ability to use Javascript expressions within its own commands.",
definition="A workflow language that describes how to run command-line tools. [WDL] and CWL are relatively similar in principle, and code written in one language can often be translated into the other with some workarounds, but they are two different standards and each have unique features. For example, CWL has the ability to use Javascript expressions within its own commands. CWL makes a distinction between a [tool] and a [workflow].",
furtherreading="https://www.commonwl.org/user_guide/",
institute="",
pronunciation="",
Expand All @@ -129,11 +134,19 @@
definition="An open-source [WDL] executor managed by the Broad Institute. Cromwell is the default [WDL] executor for the [Dockstore CLI] and is the executor used by [Terra].",
furtherreading="https://cromwell.readthedocs.io/en/stable/",
institute="Broad Institute",
pronunciation="")
pronunciation="",
seealso="[miniwdl]")

CWL = GlossEntry("CWL",
acronym_full="[Common Workflow Language]")

cwltool = GlossEntry("cwltool",
acronym_full="",
definition="An open-source [CWL] executor which serves as the official reference implementation of [Common Workflow Language]. It is used by the [Dockstore CLI] to run CWL tools and workflows.",
furtherreading="https://github.com/common-workflow-language/cwltool",
institute="",
pronunciation="")

DAG = GlossEntry("DAG",
acronym_full="Directed Acyclic Graph",
definition="A directional graph like a flowchart that does not have any loops. On Dockstore we use DAGs to show the steps that a workflow takes.",
Expand Down Expand Up @@ -241,6 +254,13 @@
institute="Dockstore",
pronunciation='')

EnvironmentVariable = GlossEntry("environment variable",
acronym_full="",
definition="A variable that affects how processes run on a computer. For example, [cwltool] references the environment variable $TMPDIR when deciding where to place files.",
furtherreading="https://en.wikipedia.org/wiki/Environment_variable",
institute="",
pronunciation='')

FacetedSearch = GlossEntry("faceted search",
acronym_full="",
definition="A type of search which allows users to narrow down their results based upon certain aspects of the things being searched. On Dockstore, our faceted search at <https://dockstore.org/search> allows users to narrow down their search to a particular workflow language, author, and/or other fields.",
Expand Down Expand Up @@ -403,11 +423,17 @@
institute="Dockstore",
pronunciation='')

miniwdl = GlossEntry("miniwdl",
definition="A Python-based [WDL] executor managed by the Chan Zuckerberg Initiative.",
furtherreading="https://github.com/chanzuckerberg/miniwdl",
institute="Chan Zuckerberg Initiative",
seealso="[Cromwell]")

NCI = GlossEntry("NCI",
acronym_full="National Cancer Institute ",
definition="A division of the [NIH] focused on cancer research.",
furtherreading="https://www.nih.gov/about-nih/what-we-do/nih-almanac/national-cancer-institute-nci",
institute="",
institute="NIH",
pronunciation="")

NCPI = GlossEntry("NCPI",
Expand Down Expand Up @@ -435,14 +461,14 @@
acronym_full="National Human Genome Research Institute",
definition="A division of the [NIH] that focus on genomics research. Funds the [AnVIL Project].",
furtherreading="https://www.genome.gov/",
institute="",
institute="NIH",
pronunciation="")

NHLBI = GlossEntry("NHLBI",
acronym_full="National Heart, Lungs, and Blood Institute",
definition="A division of the [NIH] that focuses on heart, lung, blood, and sleep health. Funds the [BioData Catalyst] platform.",
furtherreading="https://www.nhlbi.nih.gov/",
institute="",
institute="NIH",
pronunciation="")

NIH = GlossEntry("NIH",
Expand Down Expand Up @@ -585,7 +611,7 @@

Workflow_Description_Language = GlossEntry("Workflow Description Language",
furtherreading="https://openwdl.org/",
definition="A workflow language managed by the Open WDL Project that is designed to describe command-line tools. Usually written as [WDL]. WDL and [CWL] are relatively similar in principle, and code written in one language can often be translated into the other with some workarounds, but they are two different standards and each have unique features.",
definition="A workflow language managed by the Open WDL Project that is designed to describe command line tools. Usually written as [WDL]. WDL and [CWL] are relatively similar in principle, and code written in one language can often be translated into the other with some workarounds, but they are two different standards and each have unique features. Unlike CWL, WDL does not have an official reference implementation, but [Cromwell] and [miniwdl] are popular implementations.",
seealso="[WDL], [CWL]")

YAML = GlossEntry("YAML",
Expand Down
Loading

0 comments on commit 3a3bed3

Please sign in to comment.