updates to the automatic generation GA workflows #118
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: test generating other formats | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
permissions: | |
contents: write | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout this repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install the required python packages | |
run: python -m pip install .[test] | |
- name: Other installations | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential git wget curl | |
- name: Generate other model representations | |
run: | | |
cd linkml-schema | |
mkdir tests_artifacts | |
mkdir tests_artifacts/json-schema-autogen | |
mkdir tests_artifacts/jsonld-context-autogen | |
mkdir tests_artifacts/models_py-autogen | |
mkdir tests_artifacts/erdiagram-autogen | |
for file in *.yaml; do | |
if [[ "$file" != *bican* && "$file" != *core* ]]; then | |
name=`basename ${file} .yaml`; | |
echo "Processing $name file.."; | |
gen-json-schema ${file} > tests_artifacts/json-schema-autogen/${name}.json; | |
# generating jsonld context and removing generation_date field to avoid constant updates | |
gen-jsonld-context ${file} > tests_artifacts/jsonld-context-autogen/${name}.context.jsonld; | |
sed -i "/generation_date/d" tests_artifacts/jsonld-context-autogen/${name}.context.jsonld; | |
gen-pydantic ${file} > tests_artifacts/models_py-autogen/${name}.py; | |
if [ ${name} = "library_generation" ] || [ ${name} = "genome_annotation" ]; then | |
echo "Creating and Fixing diagrams for $name"; | |
python ../utils/fix_and_create_erdiagram.py | |
else | |
gen-erdiagram ${file} > tests_artifacts/erdiagram-autogen/${name}.md; | |
fi | |
fi | |
done | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: ./tests_artifacts # Specify the directory to download artifacts into | |
# - name: Create a new testing branch to check autogenerated formats (deleting first if the branch exists) | |
# run: | | |
# branch_name="testing-autogen-formats" | |
# | |
# # Check if the branch exists locally | |
# if git show-ref --verify --quiet refs/heads/$branch_name; then | |
# echo "Branch $branch_name exists locally. Deleting it." | |
# git branch -D $branch_name | |
# fi | |
# # creating the new branch | |
# git checkout -b $branch_name | |
# | |
# | |
# - name: Creating another branch and to check other model representations | |
# run: | | |
# branch_name="testing-autogen-formats" | |
# git config --local user.email "[email protected]" | |
# git config --local user.name "GitHub Action" | |
# if ! git diff --quiet; then | |
# git add json-schema-autogen/*.json | |
# git add jsonld-context-autogen/*.context.jsonld | |
# git add models_py-autogen/*.py | |
# git add erdiagram-autogen/*.md | |
# git commit -m "generate another formats and add them to the testing branch" | |
# git push | |
# else | |
# echo "No changes to commit" | |
# fi | |