From 4286419e4f8fe3ea0db4ce3f33a95f15dcb42209 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 12 Apr 2024 19:49:39 -0400 Subject: [PATCH] Add installation of bids-examples, migration of them, and testing --- .github/workflows/validate_bids-examples.yml | 74 +++++++++++++------- 1 file changed, 49 insertions(+), 25 deletions(-) diff --git a/.github/workflows/validate_bids-examples.yml b/.github/workflows/validate_bids-examples.yml index 0ed566aa65..1f850b1a2d 100644 --- a/.github/workflows/validate_bids-examples.yml +++ b/.github/workflows/validate_bids-examples.yml @@ -2,14 +2,14 @@ name: validate_datasets on: push: - branches: ['**'] + branches: ['master'] pull_request: branches: ['**'] - create: - branches: [master] - tags: ['**'] - schedule: - - cron: "0 4 * * 1" +# create: +# branches: [master] +# tags: ['**'] +# schedule: +# - cron: "0 4 * * 1" concurrency: group: ${{ github.ref }} @@ -20,8 +20,9 @@ jobs: strategy: fail-fast: false matrix: - platform: [ubuntu-latest, macos-latest, windows-latest] + platform: [ubuntu-latest] # , macos-latest, windows-latest] bids-validator: [master, stable] + python-version: ["3.11"] runs-on: ${{ matrix.platform }} @@ -32,6 +33,22 @@ jobs: 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 + + # Setup validator - name: Set up Node.js uses: actions/setup-node@v4 with: @@ -64,27 +81,34 @@ jobs: run: | echo $TZ date - echo "npm"; npm --version - echo "node"; node --version - echo "bids-validator"; bids-validator --version + echo -n "npm: "; npm --version + echo -n "node: "; node --version + echo -n "bids-validator: "; bids-validator --version + echo -n "python: "; python --version - - name: Check that no large files are present - if: "matrix.bids-validator == 'stable'" - run: | - echo "Checking for big files ..." - found=`find . -not -path "./.git*" -type f -size +500k` - if [ "$found" == "" ] - then - echo "No big files present, great!" - else - echo "Found big files:" - echo "$found" - exit 1; - fi - shell: bash + # Checkout bids-examples + - uses: actions/checkout@v4 + with: + repository: bids-standard/bids-examples + path: bids-examples - - name: Validate all BIDS datasets using bids-validator + - name: Validate all BIDS datasets using bids-validator without migration run: | cat ./run_tests.sh bash ./run_tests.sh + working-directory: bids-examples + + - name: Migrate all BIDS datasets + run: | + /bin/ls */dataset_description.json | sed -e 's,/.*,,g' | xargs bst migrate-datasets shell: bash + working-directory: bids-examples + + - name: Show migrated datasets diff + run: git diff + working-directory: bids-examples + + - name: Validate all BIDS datasets using bids-validator after migration + run: | + VALIDATOR_ARGS="-s ../src/schema.json" bash ./run_tests.sh + working-directory: bids-examples