BIDS-2.0 #10
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: validate_datasets | |
on: | |
push: | |
branches: ['master'] | |
pull_request: | |
branches: ['**'] | |
# create: | |
# branches: [master] | |
# tags: ['**'] | |
# schedule: | |
# - cron: "0 4 * * 1" | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu-latest] # , macos-latest, windows-latest] | |
bids-validator: [master, stable] | |
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 | |
# Setup validator | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Install BIDS validator (stable) | |
if: "matrix.bids-validator == 'stable'" | |
run: | | |
npm install -g bids-validator | |
- name: Install BIDS validator (master) | |
if: "matrix.bids-validator == 'master'" | |
run: | | |
pushd .. | |
# Get npm 7+ | |
npm install -g npm | |
git clone --depth 1 https://github.com/bids-standard/bids-validator | |
cd bids-validator | |
# Generate the full development node_modules | |
npm clean-install | |
# Build & bundle the bids-validator CLI package | |
npm -w bids-validator run build | |
# Generate a package to install globally | |
npm -w bids-validator pack | |
# Install the package globally | |
bash -c "npm install -g bids-validator-*.tgz" | |
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: | |
repository: bids-standard/bids-examples | |
path: bids-examples | |
- 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 |