From 1b7fedc2091849a853cf2e4cc9d21b5f767f3a17 Mon Sep 17 00:00:00 2001 From: fredericpoitevin Date: Mon, 24 Jan 2022 12:31:18 -0800 Subject: [PATCH] Decoupled linting and testing, and updated badges in README. --- .codecov.yml | 14 ----- .github/workflows/lint.yml | 53 +++++++++++++++++++ .../workflows/{test_docker.yml => test.yml} | 17 ++---- .github/workflows/test_singularity.yml | 11 +--- README.md | 18 +++++-- dev-requirements.txt | 5 ++ environment.yml | 5 -- 7 files changed, 76 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/lint.yml rename .github/workflows/{test_docker.yml => test.yml} (62%) create mode 100644 dev-requirements.txt diff --git a/.codecov.yml b/.codecov.yml index 7f29efe9..4b2b4d2a 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -2,20 +2,6 @@ coverage: round: up precision: 2 status: - project: - default: - target: 90% - threshold: 2% - base: auto - flags: - - unit - # advanced - branches: - - master - if_not_found: error - if_ci_failed: error - informational: False - only_pulls: false patch: default: # basic diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..47da04e5 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,53 @@ +name: "Lint" + +on: + push: + branches: [master,github-actions-test] + paths-ignore: + - 'README.md' + - '.deepsource.toml' + - '.gitignore' + - 'setup.py' + + pull_request: + branches: [master] + paths-ignore: + - 'README.md' + - '.deepsource.toml' + - '.gitignore' + - 'setup.py' + + +jobs: + build: + + runs-on: ${{matrix.os}} + strategy: + matrix: + os: [ubuntu-18.04] + python-version: [3.9] + test-folder : ['tests'] + fail-fast: false + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Build using Python ${{matrix.python-version}} + uses: actions/setup-python@v2 + with: + python-version: ${{matrix.python-version}} + - name: install dependencies [pip] + run: | + pip install --upgrade pip setuptools wheel + for req in dev-requirements.txt; do + pip install -q -r $req + done + pip install -e . + - name: linting [black and isort] + run: | + black . --check + isort --profile black --check . + - name: linting [flake8] + run: | + flake8 simSPI tests \ No newline at end of file diff --git a/.github/workflows/test_docker.yml b/.github/workflows/test.yml similarity index 62% rename from .github/workflows/test_docker.yml rename to .github/workflows/test.yml index bb3c3d0c..3c65e267 100644 --- a/.github/workflows/test_docker.yml +++ b/.github/workflows/test.yml @@ -1,8 +1,8 @@ -name: "Linting and Testing (Docker)" -# https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action +name: "Test" + on: push: - branches: [master,temsim-test-in-container] + branches: [master,github-actions-test] paths-ignore: - 'README.md' - '.deepsource.toml' @@ -26,17 +26,6 @@ jobs: - name: Check Out Repo uses: actions/checkout@v2 - - name: dryrun - uses: ./docker/ - id: dryrun - - - name: linting [flake8] - uses: ./docker/ - id: linting - with: - command: | - flake8 --config=/work/.flake8 /work/simSPI /work/tests - - name: unit testing [pytest] uses: ./docker/ id: testing diff --git a/.github/workflows/test_singularity.yml b/.github/workflows/test_singularity.yml index 46373d4d..c61eb837 100644 --- a/.github/workflows/test_singularity.yml +++ b/.github/workflows/test_singularity.yml @@ -2,16 +2,15 @@ name: "Linting and Testing (Singularity)" on: push: - branches: [simspi-test-singularity] + branches: [test-singularity] paths-ignore: - 'README.md' - '.deepsource.toml' - '.gitignore' - 'setup.py' - pull_request: - branches: [simspi-test-singularity] + branches: [test-singularity] paths-ignore: - 'README.md' - '.deepsource.toml' @@ -33,12 +32,6 @@ jobs: with: singularity-version: 3.8.3 - - name: linting [flake8] - run: > - singularity exec docker://${{ secrets.DOCKER_HUB_USERNAME }}/simspi:latest - /bin/bash /opt/entrypoint.sh - flake8 --config=/work/.flake8 /work/simSPI /work/tests - - name: unit testing [pytest] run: > singularity exec docker://${{ secrets.DOCKER_HUB_USERNAME }}/simspi:latest diff --git a/README.md b/README.md index 11ed9e6c..34aa818d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ -[![Build](https://github.com/compSPI/simSPI/actions/workflows/build.yml/badge.svg)](https://github.com/compSPI/simSPI/actions/workflows/build.yml) -[![Codecov](https://codecov.io/gh/compSPI/ioSPI/branch/master/graph/badge.svg?token=OBVOV3ZM1O)](https://codecov.io/gh/compSPI/simSPI) +[![Test](https://github.com/compSPI/simSPI/actions/workflows/test.yml/badge.svg)](https://github.com/compSPI/simSPI/actions/workflows/test.yml) +[![Lint](https://github.com/compSPI/simSPI/actions/workflows/lint.yml/badge.svg)](https://github.com/compSPI/simSPI/actions/workflows/lint.yml) +[![Codecov](https://codecov.io/gh/compSPI/simSPI/branch/master/graph/badge.svg?token=OBVOV3ZM1O)](https://codecov.io/gh/compSPI/simSPI) [![DeepSource](https://deepsource.io/gh/compSPI/simSPI.svg/?label=active+issues&show_trend=true&token=9eFu6aig3-oXQIuhdDoYTEq-)](https://deepsource.io/gh/compSPI/simSPI/?ref=repository-badge) # simSPI @@ -8,13 +9,20 @@ Methods and tools for simulating SPI data. # Download -First create a conda environment with the required dependencies using the `enviroment.yml` file as follows: +First download: + + git clone https://github.com/compSPI/simSPI.git + +Then, create a conda environment with the required dependencies using the `environment.yml` file as follows: conda env create --file environment.yml -Then download: +Finally, install simSPI in this environment: + + conda activate simSPI + pip install -e . - git clone https://github.com/compSPI/ioSPI.git +Alternatively, pull the simSPI container from [DockerHub](https://hub.docker.com/repository/docker/fpoitevi/simspi) # Contribute diff --git a/dev-requirements.txt b/dev-requirements.txt new file mode 100644 index 00000000..4981486a --- /dev/null +++ b/dev-requirements.txt @@ -0,0 +1,5 @@ +black +flake8 +flake8-docstrings +isort +pre-commit \ No newline at end of file diff --git a/environment.yml b/environment.yml index 5fa40225..ebc3058a 100644 --- a/environment.yml +++ b/environment.yml @@ -7,9 +7,6 @@ dependencies: - codecov - configparser - coverage - - flake8-black - - flake8-docstrings - - flake8-import-order - h5py - mdtraj - mrcfile @@ -22,9 +19,7 @@ dependencies: - pytorch=1.9.0 - pytorch3d - pip: - - black==20.8b0 - geomstats - git+https://github.com/compSPI/ioSPI.git - - pre-commit - raster_geometry - starfile