diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 1cee4c81..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,84 +0,0 @@ -version: 2 - -jobs: - test: - docker: - - image: node:18-alpine - working_directory: ~/project/legacy - steps: - - checkout - - restore_cache: - keys: - - npm-deps-{{ checksum "./package.json" }}-{{ checksum "./bids-validator/package.json" }}-{{ checksum "./bids-validator-web/package.json" }}-v1 - - run: apk --no-cache add git - - run: npm install -g npm@^7 - - run: npm install - - run: - name: Eslint - command: npm run lint - - run: - name: Get bids-examples data - command: git submodule update --init - - run: - # must include separating --, see https://stackoverflow.com/a/14404223/5201771 - name: Jest tests - command: npm run coverage -- --maxWorkers=2 --testTimeout=10000 - - run: - name: Upload to codecov - command: npm run codecov - - run: - name: Smoke tests - command: | - bids-validator/bin/bids-validator bids-validator/tests/data/valid_headers/ --ignoreNiftiHeaders - bids-validator/bin/bids-validator bids-validator/tests/data/valid_headers/ --ignoreNiftiHeaders --json - test_docker: - environment: - IMAGE_NAME: bids/validator - machine: - # Ubuntu 20.04, Docker v20.10.11, Docker Compose v1.29.2 - # see: https://circleci.com/docs/2.0/configuration-reference/#available-machine-images - image: ubuntu-2004:202111-02 - working_directory: ~/project/legacy - steps: - - checkout - - run: docker build -t $IMAGE_NAME:latest . - - run: - name: Smoke tests - command: | - docker run --rm -it -v $PWD/bids-validator/tests/data/valid_headers:/data bids/validator:latest /data --ignoreNiftiHeaders - docker run --rm -it -v $PWD/bids-validator/tests/data/valid_headers:/data bids/validator:latest /data --ignoreNiftiHeaders --json - - run: - name: Archive Docker image - command: docker save -o image.tar $IMAGE_NAME - - persist_to_workspace: - root: . - paths: - - ./image.tar - githubPagesTest: - docker: - - image: node:18-alpine - working_directory: ~/project/legacy - steps: - - run: npm install --global npm - - run: apk --no-cache add ca-certificates git openssh-client rsync - - checkout - - restore_cache: - keys: - - npm-deps-{{ checksum "./package.json" }}-{{ checksum "./bids-validator/package.json" }}-{{ checksum "./bids-validator-web/package.json" }}-v1 - - run: - name: Install bids-validator and bids-validator-web dependencies - command: npm install - - run: - name: Build and export web-validator - command: npm run web-export && rsync -av ./bids-validator-web/out/ ~/web_version - - save_cache: - key: npm-deps-{{ checksum "./package.json" }}-{{ checksum "./bids-validator/package.json" }}-{{ checksum "./bids-validator-web/package.json" }}-v1 - paths: - - ./node_modules - - ./.next/cache - - store_artifacts: - path: ~/web_version -workflows: - version: 2 - build-deploy: - jobs: [] diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml deleted file mode 100644 index 5edf171b..00000000 --- a/.github/workflows/docker-build-push.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Build & publish containers - -on: - pull_request: - branches: [master] - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' - -jobs: - push_docker_to_registry: - name: Push Docker image to Docker Hub - runs-on: ubuntu-latest - steps: - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: bids/validator - - - name: Build and push Docker image - uses: docker/build-push-action@v6 - with: - context: . - push: false - target: base - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - outputs: type=cacheonly diff --git a/.github/workflows/node_tests.yml b/.github/workflows/node_tests.yml deleted file mode 100644 index 78dd4010..00000000 --- a/.github/workflows/node_tests.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Node Tests - -on: - push: - branches: [master] - pull_request: - branches: [master] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - strategy: - fail-fast: false - matrix: - platform: [ubuntu-latest, macos-latest, windows-latest] - node: [18] - - runs-on: ${{ matrix.platform }} - - steps: - - name: Set git to use LF - run: | - git config --global core.autocrlf false - git config --global core.eol lf - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: '18' - cache: 'npm' - - name: Set git name/email - run: | - git config --global user.email "bids.maintenance@gmail.com" - git config --global user.name "bids-maintenance" - - name: Set up Node - working-directory: ./legacy - run: | - npm install -g npm@^7 - npm install - - name: Eslint - working-directory: ./legacy - run: npm run lint - - name: Get bids-examples data - working-directory: ./legacy - run: git submodule update --init - - name: Jest tests - working-directory: ./legacy - run: npm run coverage -- --maxWorkers=2 --testTimeout=10000 --colors - - name: Upload to codecov - working-directory: ./legacy - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - - name: Smoke tests - working-directory: ./legacy - run: | - bids-validator/bin/bids-validator bids-validator/tests/data/valid_headers/ --ignoreNiftiHeaders - bids-validator/bin/bids-validator bids-validator/tests/data/valid_headers/ --ignoreNiftiHeaders --json diff --git a/.github/workflows/test-bids-examples.yml b/.github/workflows/test-bids-examples.yml deleted file mode 100644 index eb3d1cfb..00000000 --- a/.github/workflows/test-bids-examples.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: test-bids-examples - -on: - push: - branches: ['*'] - pull_request: - branches: ['*'] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - strategy: - fail-fast: false - matrix: - platform: [ubuntu-latest] - bids-examples-branch: [master] - - runs-on: ${{ matrix.platform }} - - env: - TZ: Europe/Berlin - FORCE_COLOR: 1 - - steps: - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: 18 - - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Upgrade npm - run: npm install --global npm - - - name: Install bids-validator - working-directory: ./legacy - run: | - npm install - npm link ./bids-validator - echo "./node_modules/.bin" >> $GITHUB_PATH - - - name: Get bids-examples data - working-directory: ./legacy - run: | - git clone --depth 1 https://github.com/bids-standard/bids-examples - - - name: Display versions and environment information - working-directory: ./legacy - run: | - echo $TZ - export PATH="../node_modules/.bin:$PATH" - date - echo "npm"; npm --version - echo "node"; node --version - echo "bids-validator"; bids-validator --version - which bids-validator - ls -a $(which bids-validator) - - - name: Ignore examples not supported by legacy validator - working-directory: ./legacy - run: | - for DS in bids-examples/mrs_*; do - touch $DS/.SKIP_VALIDATION - done - - - name: Validate all BIDS datasets using bids-validator - working-directory: ./legacy - run: | - export PATH="../node_modules/.bin:$PATH" - cat ./run_tests.sh - bash ./run_tests.sh - shell: bash - working-directory: /bids-examples diff --git a/bids-validator/deno.json b/bids-validator/deno.json index cac28390..e8e9f398 100644 --- a/bids-validator/deno.json +++ b/bids-validator/deno.json @@ -35,7 +35,7 @@ "@hed/validator": "npm:hed-validator@3.15.5", "@ignore": "npm:ignore@5.3.2", "@libs/xml": "jsr:@libs/xml@5.4.13", - "@mango/nifti": "npm:nifti-reader-js@0.6.8", + "@mango/nifti": "npm:@bids/nifti-reader-js@0.6.9", "@std/assert": "jsr:@std/assert@1.0.2", "@std/fmt": "jsr:@std/fmt@1.0.0", "@std/fs": "jsr:@std/fs@1.0.1", diff --git a/bids-validator/src/files/nifti.ts b/bids-validator/src/files/nifti.ts index 41f49831..58a05895 100644 --- a/bids-validator/src/files/nifti.ts +++ b/bids-validator/src/files/nifti.ts @@ -27,22 +27,11 @@ async function extract(buffer: Uint8Array, nbytes: number): Promise return result } -function readHeaderQuiet(buf: ArrayBuffer) { - const console_error = console.error - const console_log = console.log - console.error = (msg: string) => { logger.info(msg)} - console.log = (msg: string) => { logger.info(msg)} - const header = readHeader(buf) - console.error = console_error - console.log = console_log - return header -} - export async function loadHeader(file: BIDSFile): Promise { try { const buf = await file.readBytes(1024) const data = isCompressed(buf.buffer) ? await extract(buf, 540) : buf - const header = readHeaderQuiet(data.buffer) + const header = readHeader(data.buffer) if (!header) { throw { key: 'NIFTI_HEADER_UNREADABLE' } }