Skip to content

Fix modelSystemName enum limit with conditional filtering #331

Fix modelSystemName enum limit with conditional filtering

Fix modelSystemName enum limit with conditional filtering #331

Workflow file for this run

name: main-ci
on:
pull_request: # default types: opened, synchronize, reopened
branches: [main]
paths:
- 'modules/**'
- '.github/workflows/main-ci.yml'
- 'utils/gen-json-schema-class.py'
workflow_dispatch:
env:
SCHEMATIC_VERSION: 24.7.2 # please update .devcontainer as well until this can be set globally somewhere...
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository
- name: Get skip flags
id: check_skip_flags
run: echo "HEAD_COMMIT_MESSAGE=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"
- name: Setup custom build tools and make jsonld
shell: bash
run: |
bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)
git clone --depth 1 https://github.com/anngvu/retold.git
pip install linkml==v1.8.1 synapseclient jsonref
npm install -g json-dereference-cli
echo "$HOME/.local/bin" >> $GITHUB_PATH
make -B
- name: Generate and validate JSON schemas for all templates (classes)
env:
SYNAPSE_AUTH_TOKEN: ${{ secrets.DATA_MODEL_SERVICE }}
run: |
echo "Generating JSON schemas and validating them!"
python utils/gen-json-schema-class.py
make Superdataset
- name: Report schema validation results as PR comment
uses: mshick/add-pr-comment@v2
if: always()
with:
message-id: schema-validation-report
message-path: |
schema-validation-log.md
# Set up supported python.
- uses: actions/setup-python@v5
with:
python-version: '3.10.12'
- name: Setup schematic and do another convert pass
id: schematic-convert
run: |
pip install schematicpy==${{ env.SCHEMATIC_VERSION }}
pip show schematicpy
schematic schema convert NF.jsonld
python utils/fix_display_names.py retold_NF.jsonld NF.jsonld
- name: Check if artifacts changed
id: check_artifacts
run: |
if [[ $(git diff --exit-code) ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
echo "✅ Artifacts built successfully and have changes"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "✅ Artifacts built successfully with no changes"
fi
- name: Report artifact build status as PR comment
uses: mshick/add-pr-comment@v2
with:
message-id: artifact-build-report
message: |
## ✅ Artifact Build Status
All artifacts have been successfully built and validated from source modules.
**Artifacts validated:**
- `NF.jsonld` (schematic-compatible JSON-LD)
- `dist/NF.yaml` (LinkML YAML)
- `dist/NF.ttl` (Turtle RDF)
- `registered-json-schemas/*.json` (Synapse JSON schemas)
**Note:** Artifacts are not committed to this PR to avoid merge conflicts. All artifacts will be automatically rebuilt and committed to `main` after merge.
- name: Upload artifacts for subsequent jobs
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
NF.jsonld
dist/NF.yaml
dist/NF.ttl
registered-json-schemas/*.json
retention-days: 1
analyze:
name: Analyze data model changes
needs: [build]
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.10.12'
- name: Install dependencies
run: |
pip install rdflib
- name: Get main branch pre-built NF.ttl for comparison
run: |
git fetch origin main:main
git checkout main -- dist/NF.ttl
mv dist/NF.ttl dist/NF_main.ttl
git checkout ${{ github.event.pull_request.head.ref }}
- name: Download built NF.ttl from build job
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: .
- name: Run comparison analysis
run: |
python utils/compare.py > analysis_output.md
- name: Post analysis as PR comment
uses: mshick/add-pr-comment@v2
with:
message-id: data-model-analysis
message-path: analysis_output.md
# Additionally test PRs
test:
name: Test with schematic current version
needs: [build]
runs-on: ubuntu-latest
env:
SCHEMATIC_VERSION: 24.7.2
SCHEMATIC_SERVICE_ACCT_CREDS: ${{ secrets.SCHEMATIC_SERVICE_ACCT_CREDS }}
permissions:
pull-requests: write
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip tests') }}
# strategy:
# matrix:
# cannot actually do parallel/concurrent testing because of API rate limits,
# so we currently only test with one schematic version because it takes much too long with sequential
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 1
- uses: actions/setup-python@v5
with:
python-version: '3.10.12'
- name: Download built artifacts from build job
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: .
- name: Setup schematic
id: setup-schematic
run: |
pip install schematicpy==${{ env.SCHEMATIC_VERSION }}
pip show schematicpy
- name: Test generate
working-directory: tests/schematic/generate
continue-on-error: true
run: ./basic_templates.sh
- name: Test validate
working-directory: tests/schematic/validate
continue-on-error: true
run: ./run_config.sh
- name: Create schematic test suite report
working-directory: tests/schematic
continue-on-error: true
run: docker run -v $(pwd):/tests -e SCHEMATIC=${{ env.SCHEMATIC_VERSION }} rocker/tidyverse R -e "rmarkdown::render('tests/test-suite-report.Rmd')"
- name: Report on test suite as PR comment
uses: mshick/add-pr-comment@v2
with:
message-id: test-suite-report-${{ env.SCHEMATIC_VERSION }}
message-path: |
tests/schematic/test-suite-report.md
- name: Upload test artifacts
uses: actions/upload-artifact@v4
with:
name: test-logs-${{ env.SCHEMATIC_VERSION }}
path: tests/**/logs