On Pull Request #61
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
name: On Pull Request | |
on: | |
workflow_dispatch: | |
#pull_request: | |
#paths: | |
# - '**/*.gpml' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: false # to allow multiple runs to queue up rather than clobber | |
jobs: | |
# Retrieves GPML file and PR number associated with incoming Pull Request and creates | |
# global variables that can accessed by subsequent jobs: | |
# * pr-number = the unique number that identifies a Pull Request | |
# * add-modified = a GPML file that is being added or modified in the wikipathways database | |
# * deleted = a GPML file that is being deleted from the wikipathways database | |
get-gpml-pr: | |
runs-on: ubuntu-latest | |
outputs: | |
pr-number: ${{ steps.changes.outputs.pr-number }} | |
added-modified: ${{ steps.changes.outputs.added-modified }} | |
deleted: ${{ steps.changes.outputs.deleted }} | |
steps: | |
# Make sure we have some code to diff. | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Get PR and GPML | |
id: changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} #only need to support TESTING via GH API calls | |
run: | | |
echo "GPML files were changed in pull request ${{ github.event.before }} -> ${{ github.event.after }}" | |
#echo "pr-number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT | |
echo "pr-number=10" >> $GITHUB_OUTPUT #TESTING | |
#echo "added-modified=$(git diff --name-only --diff-filter=AM ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$ | xargs)" >> $GITHUB_OUTPUT | |
echo "added-modified=$(gh pr view 10 --json files --jq '.files.[].path' | grep '.gpml$')" >> $GITHUB_OUTPUT #TESTING | |
if git diff --name-only --diff-filter=AM ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$; then | |
echo 'added or modified:' | |
git diff --name-only --diff-filter=AM ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$ | |
fi | |
echo "deleted=$(git diff --name-only --diff-filter=D ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$ | xargs)" >> $GITHUB_OUTPUT | |
if git diff --name-only --diff-filter=D ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$; then | |
echo 'deleted:' | |
git diff --name-only --diff-filter=D ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$ | |
fi | |
check_gpml: | |
needs: [get-gpml-pr] | |
if: ${{needs.get-gpml-pr.outputs.added-modified}} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
ref: refs/pull/${{needs.get-gpml-pr.outputs.pr-number}}/head | |
- name: Install XML processing tools | |
run: sudo apt-get install -y libxml2-utils | |
- name: Check GPML file | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
GPML_FILE=${{needs.get-gpml-pr.outputs.added-modified}} | |
echo "Found .gpml file: $GPML_FILE" | |
wpid="$(basename ""$GPML_FILE"" | sed 's/.gpml//')" | |
org="$(xmllint --xpath 'string(//*[local-name()="Pathway"]/@Organism)' "$GPML_FILE")" | |
name="$(xmllint --xpath 'string(//*[local-name()="Pathway"]/@Name)' "$GPML_FILE")" | |
desc="$(xmllint --xpath 'string(//*[local-name()="Comment" and @Source="WikiPathways-description"])' "$GPML_FILE")" | |
# Start PR description | |
NEW_DESCRIPTION=" | |
## Pathway Information | |
**WPID**: $wpid | |
**TITLE**: $name | |
**ORGANISM**: $org | |
**DESCRIPTION**: $desc | |
--- | |
" | |
PR_NUMBER=${{needs.get-gpml-pr.outputs.pr-number}} | |
gh pr edit $PR_NUMBER --body "$NEW_DESCRIPTION" | |
metadata: | |
needs: [get-gpml-pr,check_gpml] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
ref: refs/pull/${{needs.get-gpml-pr.outputs.pr-number}}/head | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- name: Cache meta-data-action with dependencies | |
uses: actions/cache@v3 | |
id: cacheMetaJar | |
with: | |
path: ./meta-data-action-1.1.2-jar-with-dependencies.jar | |
key: cached-meta-data-action-${{ hashFiles('meta-data-action-1.1.2-jar-with-dependencies.jar') }} | |
restore-keys: | | |
cached-meta-data-action-${{ hashFiles('meta-data-action-1.1.2-jar-with-dependencies.jar') }} | |
cached-meta-data-action- | |
- name: Install deps | |
run: | | |
echo "Refreshing cached-meta-data-action" | |
if [ ! -e ./meta-data-action-1.1.2-jar-with-dependencies.jar ]; then | |
wget -O meta-data-action-1.1.2-jar-with-dependencies.jar https://github.com/wikipathways/meta-data-action/releases/download/v1.1.2/meta-data-action-1.1.2-jar-with-dependencies.jar | |
fi | |
- name: Cache and install dependencies | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: ${{ github.workspace }}/Hs_Derby_Ensembl_108.bridge | |
key: ${{ runner.os }}-java-Hs_Derby_Ensembl_108 | |
restore-keys: | | |
${{ runner.os }}-java-Hs_Derby_Ensembl_108 | |
${{ runner.os }}-java-Hs_Derby_Ensembl_ | |
- if: steps.cache.outputs.cache-hit != 'true' | |
name: Install deps | |
run: | | |
cd "${{ github.workspace }}" | |
if [ ! -e ./Hs_Derby_Ensembl_108.bridge ]; then | |
wget -O Hs_Derby_Ensembl_108.bridge https://zenodo.org/record/7781913/files/Hs_Derby_Ensembl_108.bridge?download=1 | |
fi | |
- name: Generate gdb.config, fileNames.config, and fileDownloads.config | |
run: | | |
for f in ${{needs.changed-gpmls.outputs.added-modified}}; do | |
scripts/meta-data-action/configGenerator.sh $f | |
done | |
- name: Cache all bridge files | |
uses: actions/cache@v3 | |
id: cacheAllBridge | |
with: | |
path: | | |
./metabolites*.bridge | |
./Ag*.bridge | |
./An*.bridge | |
./At*.bridge | |
./Bs*.bridge | |
./Bt*.bridge | |
./Ce*.bridge | |
./Cf*.bridge | |
./Ci*.bridge | |
./Dr*.bridge | |
./Da*.bridge | |
./Dp*.bridge | |
./Dm*.bridge | |
./Ec*.bridge | |
./Gg*.bridge | |
./Fg*.bridge | |
./Gm*.bridge | |
./Hs*.bridge | |
./Hv*.bridge | |
./Ml*.bridge | |
./Mm*.bridge | |
./Mx*.bridge | |
./Oa*.bridge | |
./Ova*.bridge | |
./Oi*.bridge | |
./Oj*.bridge | |
./Pi*.bridge | |
./Pt*.bridge | |
./Qc*.bridge | |
./Rn*.bridge | |
./Sc*.bridge | |
./Sl*.bridge | |
./Ss*.bridge | |
./Vv*.bridge | |
./Xt*.bridge | |
./Zm*.bridge | |
key: cached-bridge-files | |
restore-keys: | | |
cached-bridge-files | |
- if: steps.cacheAllBridge.outputs.cache-hit != 'true' | |
name: Install all bridge files | |
run: | | |
echo "Cache not found: cached-bridge-files" | |
declare -a OrganismNames=("Metabolites" "Anopheles gambiae" "Aspergillus niger" "Arabidopsis thaliana" "Bacillus subtilis" "Bos taurus" "Caenorhabditis elegans" "Canis familiaris" "Ciona intestinalis" "Danio rerio" "Daphnia magna" "Daphnia pulex" "Drosophila melanogaster" "Escherichia coli" "Gallus gallus" "Fusarium graminearum" "Glycine max" "Homo sapiens" "Hordeum vulgare" "Macaca mulatta" "Mus musculus" "Mycobacterium tuberculosis" "Ornithorhynchus anatinus" "Ovis aries" "Oryza indica" "Oryza japonica" "Populus trichocarpa" "Pan troglodytes" "Equus caballus" "Rattus norvegicus" "Saccharomyces cerevisiae" "Solanum lycopersicum" "Sus scrofa" "Vitis vinifera" "Xenopus tropicalis" "Zea mays") | |
for org in "${OrganismNames[@]}"; do | |
echo "generating configuration files for "$org"" | |
scripts/meta-data-action/configGenerator.sh "$org" | |
echo "installing bridgedb files for "$org"" | |
scripts/meta-data-action/installDependencies.sh "$org" | |
done | |
- name: Generate configs, install bridgeDb, generate info and datanode files | |
run: | | |
chmod 777 meta-data-action-1.1.2-jar-with-dependencies.jar | |
f=${{ needs.get-gpml-pr.outputs.added-modified }} | |
echo "value of f "$f"" | |
org="$(sed -n '/<Pathway /s/.*Organism=\(.*\)[^\n]*/\1/p' $f | tr -d '"' | tr -d '>' | tr -d '\r')" | |
echo "generating configuration files for "$org"" | |
scripts/meta-data-action/configGenerator.sh "$org" | |
wpid="$(basename ""$f"" | sed 's/.gpml//')" | |
cat gdb.config | |
echo "generating info and datanode files for $wpid, organism "$org"" | |
java -jar meta-data-action-1.1.2-jar-with-dependencies.jar wikipathways/sandbox-wp-db "$f" $(date --utc +%F) gdb.config "$org" | |
- name: Run meta-data-action | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "TODO: Run meta-data-action and attach output JSON and TSV to PR" | |
# Update PR description | |
PR_NUMBER=${{needs.get-gpml-pr.outputs.pr-number}} | |
CURRENT_DESCRIPTION=$(gh pr view $PR_NUMBER --json body -q ".body") | |
NEW_DESCRIPTION="$CURRENT_DESCRIPTION | |
## Generate Metadata Files | |
- [x] info.json generated | |
- [x] datanodes.tsv generated | |
" | |
gh pr edit $PR_NUMBER --body "$NEW_DESCRIPTION" | |
pubmed: | |
needs: [get-gpml-pr,metadata] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
ref: refs/pull/${{needs.get-gpml-pr.outputs.pr-number}}/head | |
- name: Run generate-references | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "TODO: Run generate-references and attach output TSV to PR" | |
# Update PR description | |
PR_NUMBER=${{needs.get-gpml-pr.outputs.pr-number}} | |
CURRENT_DESCRIPTION=$(gh pr view $PR_NUMBER --json body -q ".body") | |
NEW_DESCRIPTION="$CURRENT_DESCRIPTION | |
- [x] references.tsv generated | |
" | |
gh pr edit $PR_NUMBER --body "$NEW_DESCRIPTION" | |
frontmatter: | |
needs: [get-gpml-pr,pubmed] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
ref: refs/pull/${{needs.get-gpml-pr.outputs.pr-number}}/head | |
- name: Run create_pathway_frontmatter.py | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "TODO: Run create_pathway_frontmatter.py and attach output MD to PR" | |
# Update PR description | |
PR_NUMBER=${{needs.get-gpml-pr.outputs.pr-number}} | |
CURRENT_DESCRIPTION=$(gh pr view $PR_NUMBER --json body -q ".body") | |
NEW_DESCRIPTION="$CURRENT_DESCRIPTION | |
- [x] .md generated | |
" | |
gh pr edit $PR_NUMBER --body "$NEW_DESCRIPTION" | |
json-svg: | |
needs: [get-gpml-pr,frontmatter] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
ref: refs/pull/${{needs.get-gpml-pr.outputs.pr-number}}/head | |
- name: Run generate-svgs | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "TODO: Run generate-svgs and attach output JSON, SVG and PNG to PR" | |
# Update PR description | |
PR_NUMBER=${{needs.get-gpml-pr.outputs.pr-number}} | |
CURRENT_DESCRIPTION=$(gh pr view $PR_NUMBER --json body -q ".body") | |
NEW_DESCRIPTION="$CURRENT_DESCRIPTION | |
- [x] .json generated | |
- [x] .svg generated | |
- [x] .png generated | |
*TODO: insert PNG here* | |
" | |
gh pr edit $PR_NUMBER --body "$NEW_DESCRIPTION" | |
testing: | |
needs: [get-gpml-pr,json-svg] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
ref: refs/pull/${{needs.get-gpml-pr.outputs.pr-number}}/head | |
- name: Perform automatic test | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# TODO: perform testing | |
# Update PR description | |
PR_NUMBER=${{needs.get-gpml-pr.outputs.pr-number}} | |
CURRENT_DESCRIPTION=$(gh pr view $PR_NUMBER --json body -q ".body") | |
NEW_DESCRIPTION="$CURRENT_DESCRIPTION | |
--- | |
## Automated Testing | |
*As table* | |
| # | Test name | Link | Notes | Result | | |
|---|---|---|---|---| | |
| 1 | Test one | | | \$\${\color{green}PASS}\$\$ | | |
| 2 | Test two | | | \$\${\color{red}FAIL}\$\$ | | |
| 3 | Test three | | | \$\${\color{green}PASS}\$\$ | | |
*As checklist* | |
- [ ] Interactions are connected | |
- [ ] Datanodes are annotated with database references | |
- [ ] Decription, consisting of 2-3 sentence overview of processes described in the pathway | |
- [ ] At least one literature reference | |
- [ ] At least one pathway ontology term | |
- [ ] Pathway title conforms to the [guidelines](https://github.com/wikipathways/wikipathways-faq/discussions/24) | |
--- | |
" | |
gh pr edit $PR_NUMBER --body "$NEW_DESCRIPTION" |