Skip to content

Commit

Permalink
Merge branch 'master' into bep031
Browse files Browse the repository at this point in the history
  • Loading branch information
mariehbourget authored Oct 1, 2021
2 parents 5d0a27e + abb700c commit f2588ed
Show file tree
Hide file tree
Showing 83 changed files with 26,943 additions and 31,979 deletions.
21 changes: 15 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ jobs:
name: test python
command: |
conda activate testenv
pytest --doctest-modules bids-validator/bids_validator
flake8 bids-validator/bids_validator
pydocstyle bids-validator/bids_validator/bids_validator.py
cd bids-validator
pytest --doctest-modules bids_validator
flake8 bids_validator
pydocstyle bids_validator/bids_validator.py
test:
docker:
- image: node:12.16.1
Expand Down Expand Up @@ -57,17 +58,26 @@ jobs:
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 16.04, docker 18.09.3, docker-compose 1.23.1
image: ubuntu-1604:201903-01
steps:
- checkout
- run: docker build -t bids/validator:latest .
- 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: mhart/alpine-node:12
Expand Down Expand Up @@ -191,15 +201,14 @@ jobs:
- run: git status
- run:
name: Commit updates
command: git add . && git commit --allow-empty --no-verify -m "Circle CI - Generate validator demo with version $CIRCLE_TAG"
command: git add . && git commit --allow-empty --no-verify -m "Circle CI - Generate validator demo with version $CIRCLE_TAG [ci skip]"
- run: git push origin gh-pages -f
- save_cache:
key: npm-deps-{{ checksum "package.json" }}-{{ checksum "./bids-validator/package.json" }}-{{ checksum "./bids-validator-web/package.json" }}-v1
paths:
- ./node_modules
- store_artifacts:
path: ~/

workflows:
version: 2
build-deploy:
Expand Down
4 changes: 4 additions & 0 deletions bids-validator/.codeclimate.yml → .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
version: '2'
checks:
similar-code:
Expand All @@ -11,3 +12,6 @@ plugins:
enabled: true
config:
count_threshold: 3
exclude_patterns:
- bids-validator/versioneer.py
- bids-validator/bids_validator/_version.py
19 changes: 19 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Codespell

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: codespell-project/actions-codespell@master
with:
ignore_words_list: ro,anser,te,tage,afterall,nwe,nin,nd
94 changes: 94 additions & 0 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Build & publish containers

on:
push:
branches:
- 'master'
tags:
- 'v*'
pull_request:
branches:
- 'master'

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@v2

- name: Log in to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: bids/validator

- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

push_singularity_to_registry:
runs-on: ubuntu-latest
needs:
- push_docker_to_registry
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go
- name: Install Dependencies
run: |
sudo apt-get update && sudo apt-get install -y \
build-essential \
libssl-dev \
uuid-dev \
libgpgme11-dev \
squashfs-tools \
libseccomp-dev \
pkg-config
- name: Install Singularity
env:
SINGULARITY_VERSION: 3.8.0
GOPATH: /tmp/go
run: |
mkdir -p $GOPATH
sudo mkdir -p /usr/local/var/singularity/mnt && \
mkdir -p $GOPATH/src/github.com/sylabs && \
cd $GOPATH/src/github.com/sylabs && \
wget -qO- https://github.com/sylabs/singularity/releases/download/v${SINGULARITY_VERSION}/singularity-ce-${SINGULARITY_VERSION}.tar.gz | \
tar xzv && \
cd singularity-ce-${SINGULARITY_VERSION} && \
./mconfig -p /usr/local && \
make -C builddir && \
sudo make -C builddir install
- name: Check out code for the container build
uses: actions/checkout@v2
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: bids/validator
- name: Build Container
run: |
tags=${{ steps.meta.outputs.tags }}
echo $tags
singularity pull container.sif docker://${tags%,*}
- name: Login and Deploy Container
if: (github.event_name != 'pull_request')
run: |
tags=${{ steps.meta.outputs.tags }}
echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ github.actor }} --password-stdin oras://ghcr.io
for tag in $(echo $tags | sed "s/,/ /g" | sed "s/bids\/validator/bids-standard\/bids-validator/g");
do echo $tag; singularity push container.sif oras://ghcr.io/$tag; done
8 changes: 5 additions & 3 deletions .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ jobs:
- name: Check formatting
shell: bash -l {0}
run: |
flake8 bids-validator/bids_validator
pydocstyle bids-validator/bids_validator/bids_validator.py
cd bids-validator
flake8 bids_validator
pydocstyle bids_validator/bids_validator.py
- name: Test with pytest
shell: bash -l {0}
run: |
pytest --doctest-modules bids-validator/bids_validator --verbose
cd bids-validator
pytest --doctest-modules bids_validator --verbose
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
FROM node:12.14.1-alpine
FROM node:14-alpine

COPY ./bids-validator /src
COPY . /src

RUN npm install -g /src
RUN npm install -g npm
WORKDIR /src
RUN npm install
RUN npm -w bids-validator run build
RUN npm -w bids-validator pack
RUN npm install -g bids-validator-*.tgz

ENTRYPOINT ["/usr/local/bin/bids-validator"]
1 change: 0 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ module.exports = {
}
}
}

Empty file modified bids-validator-web/components/App.jsx
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion bids-validator-web/components/results/Issues.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Issues extends React.Component {
// issue card
if (hasErrorFiles) {
return (
<Card key={index} className="validation-error fadeIn" key={index}>
<Card className="validation-error fadeIn" key={index}>
<Card.Header
className="error-header"
aria-expanded={this.state.errorOpen}
Expand Down
1 change: 1 addition & 0 deletions bids-validator-web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const withTM = require("next-transpile-modules");
module.exports = withTM({
transpileModules: ["bids-validator"],
assetPrefix: "./",
webpack5: false,
webpack: (config, {}) => {
config.resolve.symlinks = false;
return config;
Expand Down
8 changes: 4 additions & 4 deletions bids-validator-web/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "bids-validator-web",
"version": "1.8.1-dev.0",
"version": "1.8.5-dev.0",
"description": "web client for bids-validator",
"main": "index.js",
"license": "MIT",
"dependencies": {
"bootstrap": "^4.3.0",
"bowser": "^1.0.0",
"next": "^10",
"next": "^11.1.2",
"next-transpile-modules": "^2.3.1",
"pluralize": "^8.0.0",
"react": "^16.8.1",
"react": "^17.0.2",
"react-bootstrap": "^1.0.0-beta.5",
"react-dom": "^16.8.1",
"react-dom": "^17.0.2",
"sass": "^1.32.8"
},
"scripts": {
Expand Down
16 changes: 14 additions & 2 deletions bids-validator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
couple of minutes please open [developer tools ](https://developer.chrome.com/devtools)
and report the error at [https://github.com/bids-standard/bids-validator/issues](https://github.com/bids-standard/bids-validator/issues).
1. Command line version:
1. Install [Node.js](https://nodejs.org) (at least version 10.11.0)
1. Install [Node.js](https://nodejs.org) (at least version 12.12.0)
1. Update `npm` to be at least version 7 (`npm install --global npm@^7`)
1. From a terminal run `npm install -g bids-validator`
1. Run `bids-validator` to start validating datasets.
Expand Down Expand Up @@ -327,7 +327,7 @@ contents as described above.
The BIDS Validator currently works in the browser with [browserify](http://browserify.org/)
or [webpack](https://webpack.js.org/). You can add it to a project by cloning
the validator and requiring it with browserify syntax
`var validate = require('bids-validator');` or an ES2015 webpack import
`const validate = require('bids-validator');` or an ES2015 webpack import
`import validate from 'bids-validator'`.

### On the Server
Expand Down Expand Up @@ -406,6 +406,10 @@ following command to install it globally: `cd bids-validator && npm install -g`
Please see the [CONTRIBUTING.md](../CONTRIBUTING.md)
for additional details.

### Bundling

bids-validator is bundled with esbuild. While developing, the script `bids-validator/bin/bids-validator` will automatically bundle the project each time it is run. To test a build without publishing it `npm -w bids-validator run build`. This will generate a bids-validator/dist directory containing the local build and `bids-validator/bin/bids-validator` will use this build. To return to automatic bundling on each run, remove the dist directory.

### Running Locally in a Browser

A note about OS X, the dependencies for the browser require a npm package called
Expand Down Expand Up @@ -435,6 +439,14 @@ is useful to run tests while making changes. A coverage report is available with

To run the linter which checks code conventions run `npm run lint`.

### Install globally from a development branch

Global installs are not recommended for development because of the possibility of package conflicts with other Node.js projects. If you do need to test with a global install from a development tree, follow these steps to generate the NPM package without publishing it and install the package locally.

1. `npm -w bids-validator run build`
2. `npm -w bids-validator pack`
3. `npm install -g bids-validator-*.tgz`

### Publishing

Publishing is done with [Lerna](https://github.com/lerna/lerna). Use the command `npx lerna publish` and follow instructions to set a new version.
Expand Down
6 changes: 3 additions & 3 deletions bids-validator/bids_validator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""BIDS validator common Python package."""
from ._version import get_versions
from .bids_validator import BIDSValidator
__version__ = get_versions()['version']
__all__ = ['BIDSValidator']
del get_versions

from . import _version
__version__ = _version.get_versions()['version']
Loading

0 comments on commit f2588ed

Please sign in to comment.