Skip to content

Commit

Permalink
Merge branch 'main' into wrapper_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanARashid committed May 4, 2024
2 parents 05cf746 + b9c8474 commit 8f5d07b
Show file tree
Hide file tree
Showing 39 changed files with 5,630 additions and 148 deletions.
59 changes: 59 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: 🐞 Bug report
description: Create a report to help us improve (use this to report bugs only).
title: "[BUG] <title>"
labels: [🐞 bug]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is. Include images if relevant.
placeholder: A bug happened!
validations:
required: true
- type: textarea
attributes:
label: Screenshots [optional]
description: |
Add screenshots to help explain your problem. You can also add a video here.
Tip: You can attach images or video files by clicking this area to highlight it and then dragging files in.
validations:
required: false
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the bug.
placeholder: |
1. Visit '...'
2. Click on '...'
3. Scroll to '...'
4. See error
validations:
required: true
- type: textarea
attributes:
label: Expected behavior
description: A clear and concise description of what you expected to happen
validations:
required: true
- type: textarea
attributes:
label: Additional context
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
validations:
required: false
- type: dropdown
id: assign
attributes:
label: Are you working on this?
options:
- "Yes"
- "No"
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: ✨ Idea [Feature request]
description: Tell us about the idea you have !
title: "[Feature] <title>"
labels: [idea]
body:
- type: markdown
attributes:
value: |
Your suggestions are highly valuable.
- type: textarea
attributes:
label: Feature description
description: |
Is your feature request related to a problem? A clear and concise description of what the feature is.
validations:
required: true
- type: textarea
attributes:
label: Describe the solution
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives
description: |
A clear and concise description of any alternative solutions or features you have considered.
- type: textarea
attributes:
label: Additional context
description: |
Add any other additional context or screenshots about the feature request here.
- type: dropdown
id: assign
attributes:
label: Are you working on this?
options:
- "Yes"
- "No"
39 changes: 39 additions & 0 deletions .github/actions/download-artifact/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Download Artifact
description: Download artifact from the same or different workflow

inputs:
name:
description: Artifact to be downloaded
required: true
type: string

runs:
using: composite
steps:
- name: Download Artifact
uses: actions/github-script@v6
with:
script: |
var inputs = ${{ toJSON(inputs) }}
var artifactName = inputs['name']
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == artifactName
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${artifactName}.zip`, Buffer.from(download.data));
- name: 'Unzip artifact'
run: unzip ${{ inputs.name }}.zip
shell: bash
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### Describe the changes you have made in this PR

_A clear and concise description of what you want to happen_

### Link this PR to an issue [optional]

Fixes _#ISSUE-NUMBER_

### Checklist

- [ ] Self-review of changed code
- [ ] Added automated tests where applicable
- [ ] Update Docs & Guides
144 changes: 126 additions & 18 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,106 @@ on:
- 'analysis/**'

jobs:
build:
algorithms:
runs-on: ubuntu-latest
outputs: # here we use the outputs from steps, and set outputs for the job `configure`
algorithms: ${{ steps.algorithms.outputs.algorithms }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
id: setup_python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Cache pip
uses: actions/cache@v3
id: pip-cache
with:
key: ${{ runner.os }}-${{ env.pythonLocation }}-pip-${{ hashFiles('**/requirements.txt') }}
path: ${{ env.pythonLocation }}
if: steps.pip-cache.outputs.cache-hit != 'true'

- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Read algorithms
id: algorithms
run: |
echo 'algorithms<<EOF' >> $GITHUB_OUTPUT
cat ./tests/IVIMmodels/unit_tests/algorithms.json >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Log algorithms
run: |
echo "${{fromJson(steps.algorithms.outputs.algorithms)}}"
echo "${{fromJson(steps.algorithms.outputs.algorithms).algorithms}}"
- name: Log algorithms file
run: cat ./tests/IVIMmodels/unit_tests/algorithms.json

build:
runs-on: ubuntu-latest
needs: algorithms
continue-on-error: false
strategy:
fail-fast: false
matrix:
algorithm: ${{fromJson(needs.algorithms.outputs.algorithms).algorithms}}
SNR: [10, 30, 50, 100, 200]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
if: steps.pip-cache.outputs.cache-hit != 'true'
- name: Restore cache
id: python-cache
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ env.pythonLocation }}-pip-${{ hashFiles('**/requirements.txt') }}
path: ${{ env.pythonLocation }}

- name: Generate fitting data
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python -m pytest -m slow --selectAlgorithm ${{ matrix.algorithm }} --saveFileName test_output_${{ matrix.algorithm }}_${{ matrix.SNR }}.csv --SNR ${{ matrix.SNR }} --fitCount 300 --saveDurationFileName test_duration_${{ matrix.algorithm }}_${{ matrix.SNR }}.csv
- name: Upload raw data
uses: actions/upload-artifact@v3
with:
name: Working_Data
retention-days: 1
path: |
test_output_${{ matrix.algorithm }}_${{ matrix.SNR }}.csv
test_duration_${{ matrix.algorithm }}_${{ matrix.SNR }}.csv
merge:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Merge fitting results
run: |
head -n 1 $(ls artifacts/Working_Data/test_output_*.csv | head -n 1) > test_output.csv
tail -q -n +2 artifacts/Working_Data/test_output_*.csv >> test_output.csv
- name: Merge timing results
run: |
head -n 1 $(ls artifacts/Working_Data/test_duration_*.csv | head -n 1) > test_duration.csv
tail -q -n +2 artifacts/Working_Data/test_duration_*.csv >> test_duration.csv
- name: Upload merged artifacts
uses: actions/upload-artifact@v3
with:
name: Data
path: |
test_output.csv
test_duration.csv
analyze:
runs-on: ubuntu-latest
needs: merge
steps:
- uses: actions/checkout@v4
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
Expand All @@ -36,23 +120,17 @@ jobs:
any::tidyverse
any::data.table
any::ggplot2
- name: Generate fitting data
run: |
pip install pytest
python -m pytest -m slow --saveFileName test_output.csv --SNR 10 30 50 100 200 --fitCount 300 --saveDurationFileName test_duration.csv
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: Data
- name: Generate figures
run: Rscript --vanilla tests/IVIMmodels/unit_tests/analyze.r test_output.csv test_duration.csv
- name: Upload raw data
uses: actions/upload-artifact@v3
with:
name: Raw data
path: |
test_output.csv
test_duration.csv
- name: Upload figures
uses: actions/upload-artifact@v3
if: always()
with:
name: Fit figures
name: Figures
path: |
D.pdf
f.pdf
Expand All @@ -63,3 +141,33 @@ jobs:
durations.pdf
curve_plot.pdf
fitted_curves.pdf
compare:
runs-on: ubuntu-latest
needs: merge
steps:
- uses: actions/checkout@v4
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Install R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: |
any::tidyverse
any::assertr
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: Data
- name: Test against previous results
run: Rscript --vanilla tests/IVIMmodels/unit_tests/compare.r test_output.csv test_reference.csv tests/IVIMmodels/unit_tests/reference_output.csv test_results.csv
- name: Upload data
uses: actions/upload-artifact@v3
if: always()
with:
name: Comparison
path: |
test_reference.csv
test_results.csv
66 changes: 66 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Build & Deploy Documentation

on:
workflow_run:
workflows: [Algorithm Analysis]
types:
- completed
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Set up Python
id: setup_python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Cache pip
uses: actions/cache@v3
id: pip-cache
with:
key: ${{ runner.os }}-${{ env.pythonLocation }}-pip-${{ hashFiles('**/requirements.txt') }}
path: ${{ env.pythonLocation }}
if: steps.pip-cache.outputs.cache-hit != 'true'

- name: Install dependencies
run: |
pip install -r requirements.txt
# Action to download artifacts from a different workflow (analysis.yml)
- name: 'Download artifact'
if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: ./.github/actions/download-artifact
with:
name: 'Figures'

- name: Build html
run: |
mkdir docs/_static
mv *.pdf docs/_static/
sphinx-apidoc -o docs src
cd docs/
make html
- name: Upload docs artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'docs/_build/html'

deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Loading

0 comments on commit 8f5d07b

Please sign in to comment.