diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 775bf83..75aeba6 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -1,42 +1,14 @@ -name: codecov report - -# workflow dispatch has been added for testing purposes -on: [push, pull_request, workflow_dispatch] +name: Test Coverage and Report to Codecov +on: + pull_request: + branches: ["main"] + jobs: - build: - runs-on: ["macos-13"] - + codecov: + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - name: Set-up miniconda for macos and ubuntu - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.8 - miniconda-version: "latest" - - name: Create conda env - run: conda create -n spare python=3.8 - - name: Install pip - run: conda run -n spare conda install pip - - name: Install spare scores - run: | - pip install setuptools twine wheel - python setup.py bdist_wheel - cd dist - WHEEL_FILE=$(ls spare_scores*) - pip install "$WHEEL_FILE" - - name: Download dependencies - run: pip install setuptools && pip install . - - name: Generate Coverage Report - run: | - pip install pytest-cov - cd tests/unit && pytest --cov=../../ --cov-report=xml - - name: Upload Coverage to Codecov - uses: codecov/codecov-action@v4.0.1 + - name: Upload coverage reports + uses: codecov/codecov-action@v4.5.0 with: token: ${{ secrets.CODECOV_TOKEN }} - slug: CBICA/spare_score diff --git a/.github/workflows/macos-tests.yml b/.github/workflows/macos_test_cases_p3-12.yml similarity index 70% rename from .github/workflows/macos-tests.yml rename to .github/workflows/macos_test_cases_p3-12.yml index 23c5303..07b06cd 100644 --- a/.github/workflows/macos-tests.yml +++ b/.github/workflows/macos_test_cases_p3-12.yml @@ -1,4 +1,4 @@ -name: macos tests +name: MacOS python=3.12 # workflow dispatch has been added for testing purposes on: [push, pull_request, workflow_dispatch] @@ -6,15 +6,12 @@ on: [push, pull_request, workflow_dispatch] jobs: build: runs-on: ["macos-13"] - strategy: - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - name: Python ${{ matrix.python-version }} sample + steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: "3.12.4" - name: Install spare scores run: | pip install -r dev-dependencies.txt diff --git a/.github/workflows/macos_test_cases_p3-8.yml b/.github/workflows/macos_test_cases_p3-8.yml new file mode 100644 index 0000000..a82fb4d --- /dev/null +++ b/.github/workflows/macos_test_cases_p3-8.yml @@ -0,0 +1,42 @@ +name: MacOS python=3.8 + +# workflow dispatch has been added for testing purposes +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ["macos-13"] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.8 + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python=3.8 + - name: Install pip + run: conda run -n spare conda install pip + - name: Install spare scores + run: | + pip install setuptools twine wheel + python setup.py bdist_wheel + cd dist + WHEEL_FILE=$(ls spare_scores*) + pip install "$WHEEL_FILE" + - name: Download dependencies + run: pip install setuptools && pip install . + - name: Generate Coverage Report + run: | + pip install pytest-cov + cd tests/unit && pytest --cov=../../ --cov-report=xml + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: CBICA/spare_score diff --git a/.github/workflows/ubuntu-tests.yml b/.github/workflows/ubuntu-tests.yml deleted file mode 100644 index bc8315b..0000000 --- a/.github/workflows/ubuntu-tests.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: ubuntu tests - -# workflow dispatch has been added for testing purposes -on: [push, pull_request, workflow_dispatch] - -jobs: - build: - runs-on: ["ubuntu-latest"] - strategy: - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - name: Python ${{ matrix.python-version }} sample - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install spare scores - run: | - pip install setuptools twine wheel pytest pytest-cov - pip install -r dev-dependencies.txt - python -m pip install . - - name: Run unit tests - run: | - cd tests/unit && pytest --cov=../../ diff --git a/.github/workflows/ubuntu_test_cases_p3-12.yml b/.github/workflows/ubuntu_test_cases_p3-12.yml new file mode 100644 index 0000000..766b588 --- /dev/null +++ b/.github/workflows/ubuntu_test_cases_p3-12.yml @@ -0,0 +1,33 @@ +name: Ubuntu python=3.12 + +# workflow dispatch has been added for testing purposes +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ["ubuntu-latest"] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.12 + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python=3.12 + - name: Install pip + run: conda run -n spare conda install pip + - name: Install spare scores + run: | + pip install setuptools twine wheel + python -m pip install . + - name: Download dependencies + run: pip install setuptools && pip install . + - name: Run unit tests + run: | + cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/.github/workflows/ubuntu_test_cases_p3-8.yml b/.github/workflows/ubuntu_test_cases_p3-8.yml new file mode 100644 index 0000000..9a176d7 --- /dev/null +++ b/.github/workflows/ubuntu_test_cases_p3-8.yml @@ -0,0 +1,36 @@ +name: Ubuntu python=3.8 + +# workflow dispatch has been added for testing purposes +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ["ubuntu-latest"] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Set-up miniconda for macos and ubuntu + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.8 + miniconda-version: "latest" + - name: Create conda env + run: conda create -n spare python=3.8 + - name: Install pip + run: conda run -n spare conda install pip + - name: Install spare scores + run: | + pip install setuptools twine wheel + python setup.py bdist_wheel + cd dist + WHEEL_FILE=$(ls spare_scores*) + pip install "$WHEEL_FILE" + - name: Download dependencies + run: pip install setuptools && pip install . + - name: Run unit tests + run: | + cd tests/unit && python -m unittest discover -s . -p "*.py" diff --git a/README.md b/README.md index ee537d2..2cbd8fc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ [![codecov](https://codecov.io/gh/CBICA/spare_score/graph/badge.svg?token=7yk7pkydHE)](https://codecov.io/gh/CBICA/spare_score) -![macos build](https://github.com/CBICA/spare_score/actions/workflows/macos-tests.yml/badge.svg) -![ubuntu build](https://github.com/CBICA/spare_score/actions/workflows/ubuntu-tests.yml/badge.svg) +![macos python=3.12 build](https://github.com/CBICA/spare_score/actions/workflows/macos_test_cases_p3-12.yml/badge.svg) +![macos python=3.8 build](https://github.com/CBICA/spare_score/actions/workflows/macos_test_cases_p3-12.yml/badge.svg) +![ubuntu python=3.12 build](https://github.com/CBICA/spare_score/actions/workflows/ubuntu_test_cases_p3-12.yml/badge.svg) +![ubuntu python=3.8 build](https://github.com/CBICA/spare_score/actions/workflows/ubuntu_test_cases_p3-8.yml/badge.svg) + # Compute SPARE Scores for Your Case "SPARE" is short for "Spatial Pattern of Abnormalities for Recognition of ..." If you have brain images of a case population, such as the Alzheimer's disease (AD), the SPARE model will try to find characteristic brain patterns of AD with respect to a control population, such as cognitively normal. This would be an example of a classification-based SPARE model (currently powered by support vector machine or SVM). This model (that we named SPARE-AD) then computes SPARE-AD scores on an individual-basis that indicates how much the individual carries the learned brain patterns of AD.