mcb-update-actions - Update matplotlib to latest version #22
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 checks that the semantic versioning (e.g. 1.1.0) of the GitHub | |
# project is correct, and if it's "minor" or "patch", checks backwards | |
# compatibility. | |
# The logic of this workflow is: | |
# - Details: EE-2699 | |
# - Why: it helps avoiding human errors of versions in the schemas not being | |
# changed when or how they should. | |
# - Would block the PR if failed? Yes, as long as the PR is for a release. | |
# - How: by executing the script check_project_version_change.py, and then, | |
# based on its output, deploying Biovalidator with the old and new schemas | |
# and old and new JSON examples. | |
# | |
# For more information, check: | |
# https://github.com/EbiEga/ega-metadata-schema/tree/main/docs/releases | |
name: | | |
[REQUIRED] Check project version change | |
on: | |
# Executes on any commit to a PR to the "main" branch | |
pull_request: | |
branches: [main] | |
jobs: | |
check-modifications: | |
runs-on: ubuntu-latest | |
env: | |
BASE_URL: "https://raw.githubusercontent.com/EbiEga/ega-metadata-schema/main" | |
REPOSITORY_URL: "https://api.github.com/repos/EbiEga/ega-metadata-schema" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
# This bit is needed to checkout in the branch that triggered the action | |
# (e.g. v2.0.1) | |
ref: ${{ github.head_ref }} | |
- 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: 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: Run version modification check | |
id: run-version-modification-check | |
run: | | |
script_path="./.github/scripts/check_project_version_change.py" | |
python3 "$script_path" --git_var_name "VERSION_CHANGE" --verbose | |
echo "- The version change is: $VERSION_CHANGE" | |
# The output of this previous script will determine if changes are not "major" (i.e. minor or patch), and therefore retrocompatibility | |
# has to be tested through JSON Schema validation (combination of old and new schemas with old and new examples). | |
# Thus, only if the output (saved at 'VERSION_CHANGE') from the script is NOT Major, the following steps will occur. | |
- name: Check if version change is Major | |
id: check-version | |
# This step is just to set the logic for triggering the following steps | |
run: | | |
if [[ "${{ env.VERSION_CHANGE }}" != "Major" ]]; then | |
echo "version_needs_to_be_checked=True" >> $GITHUB_ENV | |
else | |
echo "version_needs_to_be_checked=False" >> $GITHUB_ENV | |
fi | |
- name: Clone Biovalidator | |
if: ${{ env.version_needs_to_be_checked == 'True' }} | |
# See https://github.com/elixir-europe/biovalidator#installation | |
run: git clone https://github.com/elixir-europe/biovalidator.git | |
- name: Install Biovalidator | |
if: ${{ env.version_needs_to_be_checked == 'True' }} | |
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 (old schemas) | |
if: ${{ env.version_needs_to_be_checked == 'True' }} | |
# We want to specify the OLD JSON schemas, so we DO NOT specify the schemas | |
# at deployment level, and instead let Biovalidator fetch them from "main" | |
run: | | |
node biovalidator/src/biovalidator & | |
# We stop for a few seconds to give the server some time | |
sleep 3 | |
- name: Validate JSON examples (old schemas, new examples) | |
if: ${{ env.version_needs_to_be_checked == 'True' }} | |
# Validate NEW JSON documents against the OLD (from "main") schemas | |
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" | |
- name: Kill previous Biovalidator server | |
if: ${{ env.version_needs_to_be_checked == 'True' }} | |
# We kill the existing Biovalidator server if it exists | |
run: | | |
# File path | |
file="./server.pid" | |
# Check if the file exists | |
if [ -f "$file" ] | |
then | |
# Read PID | |
pid=$(cat "$file") | |
# Check if the PID exists | |
if ps -p $pid > /dev/null | |
then | |
echo "Killing task with PID: $pid" | |
kill $pid | |
else | |
echo "No process found with PID: $pid" | |
fi | |
rm $file | |
else | |
echo "File $file does not exist" | |
fi | |
- name: Start Biovalidator server (New schemas) | |
if: ${{ env.version_needs_to_be_checked == 'True' }} | |
# We want to specify the NEW JSON schemas, so we DO specify the schemas | |
# at deployment level | |
run: | | |
schemas_dir="./schemas" | |
node biovalidator/src/biovalidator -r "$schemas_dir/*.json" & | |
sleep 3 | |
- name: Validate JSON examples (New schemas, old examples) | |
if: ${{ env.version_needs_to_be_checked == 'True' }} | |
# Validate OLD JSON documents against the NEW (from branch) schemas | |
run: | | |
# We fetch all old JSON examples from "main" | |
old_json_ex_dir="./examples/old_json_validation_tests" | |
json_ex_dir="./examples/json_validation_tests" | |
python3 ./.github/scripts/fetch_github_documents.py --input_directory "$json_ex_dir" --destination_directory "$old_json_ex_dir" | |
url="http://localhost:3020/validate" | |
python3 ./.github/scripts/request_validation.py "$old_json_ex_dir" "$url" |