[SCHEMA] Add migrate command to adopt standardized BIDS conventions #33
This file contains hidden or 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: validate_datasets | |
| on: | |
| push: | |
| branches: ["master"] | |
| pull_request: | |
| branches: ["**"] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [ubuntu-latest] | |
| bids-validator: [master-deno] | |
| python-version: ["3.11"] | |
| runs-on: ${{ matrix.platform }} | |
| env: | |
| TZ: Europe/Berlin | |
| FORCE_COLOR: 1 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Setup Python with bst | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: "Install build dependencies" | |
| run: pip install --upgrade build twine | |
| - name: "Build source distribution and wheel" | |
| run: python -m build tools/schemacode | |
| - name: "Check distribution metadata" | |
| run: twine check tools/schemacode/dist/* | |
| - name: "Install bst tools from the build" | |
| run: pip install $( ls tools/schemacode/dist/*.whl )[all] | |
| - name: "Produce dump of the schema as schema.json" | |
| run: bst -v export --output src/schema.json | |
| - uses: denoland/setup-deno@v1 | |
| if: "matrix.bids-validator == 'master-deno'" | |
| with: | |
| deno-version: v1.x | |
| - name: Install BIDS validator (master deno build) | |
| if: "matrix.bids-validator == 'master-deno'" | |
| run: | | |
| pushd .. | |
| # Let's use specific commit for now | |
| # TODO: progress it once in a while | |
| commit=a7b291b882a8c6184219ccb84faae255ba96203a | |
| git clone --depth 1 https://github.com/bids-standard/bids-validator | |
| cd bids-validator | |
| git fetch --depth 1 origin $commit | |
| echo -e '#!/bin/sh\n'"$PWD/bids-validator/bids-validator-deno \"\$@\"" >| /tmp/bids-validator | |
| chmod a+x /tmp/bids-validator | |
| sudo mv /tmp/bids-validator /usr/local/bin/bids-validator | |
| which -a bids-validator | |
| bids-validator --help | |
| popd | |
| - name: Display versions and environment information | |
| run: | | |
| echo $TZ | |
| date | |
| echo -n "npm: "; npm --version | |
| echo -n "node: "; node --version | |
| echo -n "bids-validator: "; bids-validator --version | |
| echo -n "python: "; python --version | |
| # Checkout bids-examples | |
| - uses: actions/checkout@v4 | |
| with: | |
| # For now use the forked repository with support for deno validator | |
| # from https://github.com/bids-standard/bids-examples/pull/435 | |
| repository: yarikoptic/bids-examples | |
| ref: deno-validator | |
| path: bids-examples | |
| - name: Mark known not yet to be deno-legit BIDS datasets | |
| run: touch {ds000117,ds000246,ds000247,ds000248,eeg_ds003645s_hed_demo,ieeg_motorMiller2007,ieeg_visual}/.SKIP_VALIDATION | |
| shell: bash | |
| working-directory: bids-examples | |
| - name: Validate using bids-validator without migration | |
| run: ./run_tests.sh | |
| working-directory: bids-examples | |
| - name: Migrate all BIDS datasets | |
| run: | | |
| for dataset in */dataset_description.json; do | |
| dataset_dir=$(dirname "$dataset") | |
| echo "Migrating $dataset_dir..." | |
| bst migrate all "$dataset_dir" --skip fix_inheritance_overloading --skip fix_tsv_entity_prefix || echo "Migration failed for $dataset_dir" | |
| done | |
| shell: bash | |
| working-directory: bids-examples | |
| - name: Show migrated datasets diff | |
| run: git diff HEAD | |
| working-directory: bids-examples | |
| - name: Validate all BIDS datasets using bids-validator after migration | |
| run: VALIDATOR_ARGS="--schema file://$PWD/../src/schema.json" bash ./run_tests.sh | |
| working-directory: bids-examples |