Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "master-deno" flavor of validator to use as well #435

Merged
merged 25 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
64ff8ec
Add master-deno flavor of bids-validator to try
yarikoptic Apr 17, 2024
7c864ba
Fix invocation of deno validator
yarikoptic Apr 18, 2024
f5c53f7
Make it work with validator which does not support -c option
yarikoptic Apr 18, 2024
560bd03
Support validation using new deno validator while manually skipping E…
yarikoptic Apr 19, 2024
4e428e8
Do not bother storing/returning "last dataset rc" - best output which…
yarikoptic Apr 19, 2024
705bc16
Mark known to fail ATM datsets to be skipped for master-deno validator
yarikoptic Apr 25, 2024
de9892f
Use simplest sh form of redirect without | and space after before fil…
yarikoptic Apr 26, 2024
1c6068b
Update .github/workflows/validate_datasets.yml
effigies Apr 29, 2024
101d22d
CI: Set default shell to bash, disable node for deno test
effigies Apr 29, 2024
2130060
ENH: Create deno-based validator in /usr/local/bin
effigies Apr 29, 2024
3bbfe4f
Use bare env, set debug
effigies Apr 29, 2024
6ff721b
Fix cat call
effigies Apr 29, 2024
aca5e71
Give up on cat
effigies Apr 29, 2024
4a0ec5e
Try /usr/bin/env
effigies Apr 29, 2024
0ec7d33
Revert to lots of indirection
effigies Apr 29, 2024
71645cc
Deno needs to be installed with powershell on Windows
effigies Apr 29, 2024
fdfe0b5
Set shell step-by-step
effigies Apr 29, 2024
1434334
Maybe we killed powershell with our unix path?
effigies Apr 29, 2024
fd0ae0d
RF: just install deno validator into /usr/bin
yarikoptic Apr 29, 2024
3269e7b
Try to sudo to create and tune the file
yarikoptic Jun 4, 2024
78644eb
Show PATH -- may be we could install to some other locations on mac/w…
yarikoptic Jun 5, 2024
fdb0cac
Try effigies way to install the beast
yarikoptic Jun 5, 2024
953963e
Update .github/workflows/validate_datasets.yml
effigies Jun 5, 2024
c1f2b5f
Relax versioning req and remove debug statements
yarikoptic Jun 5, 2024
4e04a68
Skip more datasets for now to get into green
yarikoptic Jun 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion .github/workflows/validate_datasets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
bids-validator: [master, stable]
bids-validator: [master, stable, master-deno]

runs-on: ${{ matrix.platform }}

Expand All @@ -33,6 +33,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Node.js
if: "matrix.bids-validator == 'stable' || matrix.bids-validator == 'master'"
uses: actions/setup-node@v4
with:
node-version: 18
Expand Down Expand Up @@ -60,13 +61,38 @@ jobs:
bash -c "npm install -g bids-validator-*.tgz"
popd

- uses: denoland/[email protected]
yarikoptic marked this conversation as resolved.
Show resolved Hide resolved
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: |
set -x
LOCAL_BIN=$HOME/.local/bin
VALIDATOR=$LOCAL_BIN/bids-validator
echo $VALIDATOR # debug
mkdir -p $LOCAL_BIN
export PATH="$LOCAL_BIN:$PATH"
echo PATH="$PATH" | tee -a $GITHUB_ENV
echo -e '#!/usr/bin/env'" -S deno run --allow-read --allow-write --allow-env --allow-net --allow-run\nimport 'https://github.com/bids-standard/bids-validator/raw/master/bids-validator/src/bids-validator.ts'" > $VALIDATOR
chmod +x $VALIDATOR
# For debugging purposes
cat $VALIDATOR
which -a bids-validator
bids-validator --version
bids-validator --help
yarikoptic marked this conversation as resolved.
Show resolved Hide resolved
shell: bash

- name: Display versions and environment information
run: |
echo $TZ
date
echo "npm"; npm --version
echo "node"; node --version
echo "bids-validator"; bids-validator --version
shell: bash

- name: Check that no large files are present
if: "matrix.bids-validator == 'stable'"
Expand All @@ -83,6 +109,12 @@ jobs:
fi
shell: bash

- name: Mark to be skipped some examples for a deno based
if: "matrix.bids-validator == 'master-deno'"
run: |
touch {ds000117,ds000246,ds000247,ds000248,eeg_ds003645s_hed_demo,ieeg_motorMiller2007,ieeg_visual}/.SKIP_VALIDATION
shell: bash

- name: Validate all BIDS datasets using bids-validator
run: |
cat ./run_tests.sh
Expand Down
48 changes: 39 additions & 9 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
#!/usr/bin/env bash

rc=0;
failed=

which bids-validator
if bids-validator --help | grep -q -e '--config'; then
VALIDATOR_SUPPORTS_CONFIG=yes
else
VALIDATOR_SUPPORTS_CONFIG=
fi

for i in $(ls -d */ | grep -v node_modules); do
echo "Validating dataset" $i
echo -n "Validating dataset $i: "

if [ -f ${i%%/}/.SKIP_VALIDATION ]; then
echo "Skipping validation for ${i%%/}"
echo "skipping validation"
continue
fi

Expand All @@ -14,18 +22,40 @@ for i in $(ls -d */ | grep -v node_modules); do
CMD="bids-validator ${i%%/} $VALIDATOR_ARGS"

# Use default configuration unless overridden
if [ ! -f ${i%%/}/.bids-validator-config.json ]; then
CMD="$CMD -c $PWD/bidsconfig.json"
if [ -n "$VALIDATOR_SUPPORTS_CONFIG" ]; then
if [ ! -f ${i%%/}/.bids-validator-config.json ]; then
CMD="$CMD -c $PWD/bidsconfig.json"
fi
else
# with new one we do not have config so let's get --json and exclude some using jq
CMD="$CMD --json"
fi

# Ignore NIfTI headers except for synthetic dataset
if [ $i != "synthetic/" ]; then
CMD="$CMD --ignoreNiftiHeaders"
else
echo "Validating NIfTI headers for dataset" $i
echo "validating NIfTI headers. "
fi

echo $CMD
$CMD || rc=$?
echo "Running " $CMD

if [ -n "$VALIDATOR_SUPPORTS_CONFIG" ]; then
$CMD || failed+=" $i"
else
# exit code is not returned correctly anyways and for the best since we need to ignore
# ref: https://github.com/bids-standard/bids-validator/issues/1909
# NOTE: limit to 1 file per error to not flood screen!
errors=$($CMD 2>/dev/null \
| jq '(.issues | map(select(.severity == "error" and .key != "EMPTY_FILE"))) | map(.files_1 = (.files | if length > 0 then .[0:1] else empty end) | del(.files)) | if length > 0 then . else empty end' \
)
if [ -n "$errors" ]; then
echo -e "$errors" | sed -e 's,^, ,g'
failed+=" $i"
fi
fi
done
exit $rc;
if [ -n "$failed" ]; then
echo "Datasets failed validation: $failed"
exit 1
fi
Loading