Skip to content

mcb-update-actions - Update matplotlib to latest version #86

mcb-update-actions - Update matplotlib to latest version

mcb-update-actions - Update matplotlib to latest version #86

---
# This workflow validates the current JSON documents against EGA's JSON schemas
# using EGA's API endpoint (http://biovalidator.ega.ebi.ac.uk/validate) of
# the tool Biovalidator (https://github.com/elixir-europe/biovalidator) and the
# up-to-date EGA JSON schemas
# (https://github.com/EbiEga/ega-metadata-schema/tree/main/schemas).
# The logic of this workflow is:
# - Details: EE-2575
# - Why: Allows us to check two things:
# 1. Whether the current "main" branch of Biovalidator can be deployed as
# a server instance.
# 2. Whether the modified schemas-&-documents (the ones in the branch of
# the PR) are compliant (i.e. would pass validation) against an up to
# date Biovalidator instance.
# - Would block the PR if failed? Requires interpretation depending on the
# step at which it failed.
# - How: (1) Clone current Biovalidator repository; (2) install dependencies
# and project; (3) deploy Biovalidator local server, specifying (-r/--ref)
# the schemas to be used during validation, which would be the ones within
# the branch; (4) execute script .github/scripts/request_validation.py
# specifying the localhost server and branch's JSON documents.
#
# For more information, check:
# https://github.com/EbiEga/ega-metadata-schema/tree/main/docs/gh_workflows
name: |
[REQUIRED] JSON docs validation - Local Biovalidator
(json_validation_deploying_biovalidator.yml)
on:
pull_request:
branches: [main]
jobs:
validate-json-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
# We'll use the latest version of python from major 3 release
# This bit is needed for running the following python script
python-version: '3.x'
- name: Cache pip
uses: actions/cache@v4
with:
# On subsequent runs, if the cache key matches (i.e., operating system and the hash of the requirements.txt file),
# the dependencies are restored from the cache instead of being downloaded and installed again.
path: ~/.cache/pip
# combines the OS type and a hash of the requirements.txt file: the cache is specific to the dependencies listed
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
# If there is no cache for this key, we create it at the end of the run, even if there was an error mid-way
save-always: true
- name: Clone Biovalidator
# See https://github.com/elixir-europe/biovalidator#installation
# We want to test the "main" branch of the project
run: git clone https://github.com/elixir-europe/biovalidator.git
- name: Install Biovalidator
# We want to test with the latest Node.js version, but if not, we
# could make use of action: https://github.com/actions/setup-node
run: |
cd biovalidator
npm install
# We shouldn't need to audit the issues, but for now it is what it is
# npm audit fix
- name: Start Biovalidator server
# We want to specify the JSON schemas and documents with the new
# changes. Therefore we specify the schemas at deployment level (-r)
run: |
#!
echo "--- Listing files:"
pwd
ls
ls ./schemas
#!
schemas_dir="./schemas"
node biovalidator/src/biovalidator -r "$schemas_dir/*.json" > biovalidator.log 2>&1 &
# Check if the server is up and running, and wait for a few seconds if not
for i in {1..10}; do
if curl --output /dev/null --silent --head --fail "http://localhost:3020/validate"; then
echo "Biovalidator server is up!"
break
fi
echo "Waiting ($i time(s)) for Biovalidator server to start..."
sleep 5
done
if ! curl --output /dev/null --silent --head --fail "http://localhost:3020/validate"; then
echo "Biovalidator server failed to start"
cat biovalidator.log
exit 1
fi
- name: Install dependencies
run: |
pip install --upgrade pip
requirements_f="./.github/scripts/requirements.txt"
if [ -f "$requirements_f" ]; then pip install -r "$requirements_f" --prefer-binary --verbose; fi
- name: Validate JSON examples
# Validate all JSON documents against their corresponding schemas
# Check:
# github.com/EbiEga/ega-metadata-schema/tree/main/.github/scripts
run: |
json_ex_dir="./examples/json_validation_tests"
# The following URL points to the locally deployed server of
# Biovalidator
url="http://localhost:3020/validate"
python3 ./.github/scripts/request_validation.py "$json_ex_dir" "$url"
#!
echo "Biovalidator log:\n"
cat biovalidator.log
#!