IDMP-616 enhance Amlodipine example #1520
Workflow file for this run
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 workflow will run test for IDMP project | |
name: IDMP Automation Test | |
on: | |
push: | |
pull_request: | |
branches: ["master"] | |
workflow_dispatch: | |
inputs: | |
gsrs_version: | |
description: "GSRS dataset version" | |
required: false | |
gsrs_cache_rebuild: | |
description: "Whether to rebuild cache" | |
required: false | |
permissions: | |
contents: read | |
jobs: | |
IDMP: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Java 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: "11" | |
cache: "maven" | |
- name: Install Dependencies & Prepare IDMP Ontologies | |
run: | | |
./etc/unit_tests/dependencies.sh | |
- name: Run unit tests using Apache Jena | |
run: | | |
java -Xmx5G -jar etc/unit_tests/target/unit-test-runner-1.0.jar \ | |
-ontology_location ./AboutIDMPDev-ReferenceIndividuals.ttl \ | |
-root_folder etc/unit_tests/ \ | |
-cq_source etc/CQ/Example/ \ | |
-config_file configs/idmp_tests_config.yaml | |
if [ $? != 0 ]; | |
then | |
exit $? | |
fi | |
- name: Archive merged ontology on failure | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: merged-ontology | |
path: AboutIDMPDev-ReferenceIndividuals.ttl | |
GSRS: | |
runs-on: ubuntu-latest | |
env: | |
GSRS_VERSION: ${{ inputs.gsrs_version || '2022-12-15' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Java 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: "11" | |
cache: "maven" | |
- name: Install Dependencies & Prepare IDMP Ontologies | |
run: | | |
./etc/unit_tests/dependencies.sh | |
- name: GSRS Cache | |
id: gsrs-caches | |
uses: actions/cache@v3 | |
with: | |
path: | | |
gsrs-transformed.ttl | |
key: gsrs-public-data-${{ env.GSRS_VERSION }}|transformation-files-${{ hashFiles('etc/transformation/GSRS/*.rqg') }} | |
- name: Download and Extract GSRS Version ${{ env.GSRS_VERSION }} | |
if: steps.gsrs-caches.outputs.cache-hit != 'true' || inputs.gsrs_cache_rebuild == 'true' | |
run: | | |
url=https://gsrs.ncats.nih.gov/downloads/dump-public-${{ env.GSRS_VERSION }}.gsrs | |
sudo wget --no-verbose -m -nH -nd -O public_data.gz $url | |
gunzip public_data.gz | |
jq -c -s '.' public_data > public_data.json | |
- name: Transform GSRS | |
if: steps.gsrs-caches.outputs.cache-hit != 'true' || inputs.gsrs_cache_rebuild == 'true' | |
run: | | |
queries=(gsrs-public-data-identifiers gsrs-public-data-names gsrs-public-data-relationships gsrs-public-data-substances) | |
for query in "${queries[@]}"; do | |
echo "Transforming $query.rqg" | |
java -Xmx5G -jar sparql-generate.jar -l INFO -q etc/transformation/GSRS/$query.rqg -o $query.ttl | |
done | |
result=gsrs-transformed.ttl | |
rm -rf $result | |
for query in "${queries[@]}"; do | |
cat $query.ttl >>$result | |
done | |
- name: Combine GSRS with IDMP | |
run: | | |
source_files=(gsrs-transformed.ttl AboutIDMPDev-ReferenceIndividuals.ttl) | |
output_file=gsrs-final.ttl | |
# Loop through the source files and append their contents to the output file | |
for file in "${source_files[@]}"; do | |
cat $file >> $output_file | |
done | |
- name: Run unit tests using Apache Jena | |
run: | | |
java -Xmx5G -jar etc/unit_tests/target/unit-test-runner-1.0.jar \ | |
-ontology_location ./gsrs-final.ttl \ | |
-root_folder etc/unit_tests/ \ | |
-cq_source etc/CQ/Example/ \ | |
-config_file configs/gsrs_tests_config.yaml | |
if [ $? != 0 ]; | |
then | |
exit $? | |
fi |