120 harmonization of scenario metadata to other data categories (#123) #423
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
name: CI pipeline | |
on: | |
push: | |
branches-ignore: | |
- main | |
jobs: | |
create-file: | |
name: Create VARIABLES.md file on change within Branch | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.0 | |
- name: Install additional libraries | |
run: pip install -r src/requirements_ci.txt | |
- name: Run Python script | |
run: python3 src/readme_generator.py | |
working-directory: ${{ github.workspace }} | |
- name: Check for changes | |
id: check_changes | |
run: | | |
if git status --porcelain | grep "VARIABLES.md"; then | |
echo "CHANGES_FOUND=true" >> $GITHUB_OUTPUT | |
else | |
echo "CHANGES_FOUND=false" >> $GITHUB_OUTPUT | |
fi | |
continue-on-error: true | |
working-directory: ${{ github.workspace }} | |
- name: Commit and push changes | |
if: steps.check_changes.outputs.CHANGES_FOUND == 'true' | |
run: | | |
git config --local user.email "justin.dex@msg-david.de" | |
git config --local user.name "GitHub Action" | |
git add */VARIABLES.md | |
git commit -s -m "Add VARIABLES.md files" | |
git push | |
working-directory: ${{ github.workspace }} | |
parse-turtle: | |
name: Check syntax of all changed Turtle files | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Check for changes in .ttl files | |
id: check_ttl | |
run: | | |
git fetch origin main | |
CHANGED_TTL=$(git diff --name-only origin/main -- '*.ttl') | |
if [[ -n "$CHANGED_TTL" ]]; then | |
echo "TTL_HAS_CHANGED=true" >> $GITHUB_ENV | |
echo "CHANGED_TTL=$(echo "$CHANGED_TTL" | tr '\n' ' ')" >> $GITHUB_ENV # save files in one line | |
else | |
echo "TTL_HAS_CHANGED=false" >> $GITHUB_ENV | |
echo "Subsequent steps will be skipped as no .ttl files have changed." | |
fi | |
- name: Set up Python | |
if: env.TTL_HAS_CHANGED == 'true' | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.0 | |
- name: Install additional libraries | |
if: env.TTL_HAS_CHANGED == 'true' | |
run: pip install -r src/requirements_ci.txt | |
- name: Run Python script for each changed .ttl file | |
if: env.TTL_HAS_CHANGED == 'true' | |
run: | | |
IFS=' ' # Set the Internal Field Separator to a space | |
for FILE in ${CHANGED_TTL}; do | |
echo "Processing changed file: ${FILE}" | |
python3 -u src/check_ttl_syntax.py "${FILE}" | |
done | |
check-jsonld-against-schema: | |
name: Check jsonld against schema for all changed directories | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Check for changes in .ttl and .json files | |
id: check_ttl_or_instance | |
run: | | |
git fetch origin main | |
CHANGED_FILES=$(git diff --name-only origin/main -- '*shacl.ttl' '*instance.json') | |
if [[ -n "$CHANGED_FILES" ]]; then | |
CHANGED_DIRS=$(echo "$CHANGED_FILES" | xargs -n1 dirname | sort -u) # just save the directory names | |
echo "FILES_HAVE_CHANGED=true" >> $GITHUB_ENV | |
echo "CHANGED_DIRS=$(echo "$CHANGED_DIRS" | tr '\n' ' ')" >> $GITHUB_ENV # save directories in one line | |
else | |
echo "FILES_HAVE_CHANGED=false" >> $GITHUB_ENV | |
echo "Subsequent steps will be skipped as no .ttl or .json files have changed." | |
fi | |
- name: Set up Python | |
if: env.FILES_HAVE_CHANGED == 'true' | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.0 | |
- name: Install additional libraries | |
if: env.FILES_HAVE_CHANGED == 'true' | |
run: pip install -r src/requirements_ci.txt | |
- name: Run Python script for each directory that is affected (either shacl or instance file was changed). | |
if: env.FILES_HAVE_CHANGED == 'true' | |
run: | | |
IFS=' ' # Set the Internal Field Separator to a space | |
for DIRECTORY in ${CHANGED_DIRS}; do | |
echo "Processing changed directory: ${DIRECTORY}" | |
python3 -u src/check_jsonld_against_shacl_schema.py "${DIRECTORY}" | |
done | |
check_target_classes_agains_owl_classes: | |
name: Check target classes in SHACL files against owl classes for all changed directories | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Check for changes in .ttl | |
id: check_ttl | |
run: | | |
git fetch origin main | |
CHANGED_FILES=$(git diff --name-only origin/main -- '*.ttl') | |
if [[ -n "$CHANGED_FILES" ]]; then | |
CHANGED_DIRS=$(echo "$CHANGED_FILES" | xargs -n1 dirname | sort -u) # just save the directory names | |
echo "FILES_HAVE_CHANGED=true" >> $GITHUB_ENV | |
echo "CHANGED_DIRS=$(echo "$CHANGED_DIRS" | tr '\n' ' ')" >> $GITHUB_ENV # save directories in one line | |
else | |
echo "FILES_HAVE_CHANGED=false" >> $GITHUB_ENV | |
echo "Subsequent steps will be skipped as no .ttl files have changed." | |
fi | |
- name: Set up Python | |
if: env.FILES_HAVE_CHANGED == 'true' | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.0 | |
- name: Install additional libraries for ci | |
if: env.FILES_HAVE_CHANGED == 'true' | |
run: pip install -r src/requirements_ci.txt | |
- name: Install additional libraries for federated catalogue script that is being called. | |
if: env.FILES_HAVE_CHANGED == 'true' | |
run: pip install -r src/requirements_fc.txt | |
- name: Run Python script for each directory that is affected (ttl file was changed). | |
if: env.FILES_HAVE_CHANGED == 'true' | |
run: | | |
IFS=' ' # Set the Internal Field Separator to a space | |
for DIRECTORY in ${CHANGED_DIRS}; do | |
echo "Processing changed directory: ${DIRECTORY}" | |
python3 -u src/check_target_classes_against_owl_classes.py "${DIRECTORY}" | |
done |