diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 271b5138..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Test and Deploy - -on: - - push - - pull_request - -jobs: - main: - strategy: - matrix: - os: [ubuntu-latest] - python-version: [3.8] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - cache-dependency-path: | - setup.py - notebooks/requirements.txt - - name: Install dependencies - run: | - pip install wheel pytest - pip install . - - name: Test with pytest - run: | - pytest . - - name: Determine if notebooks should be built - run: | - echo Printing a few variables for debugging - echo "GITHUB_REF = $GITHUB_REF" - echo "GITHUB_EVENT_NAME = $GITHUB_EVENT_NAME" - echo "GITHUB_REPOSITORY_OWNER = $GITHUB_REPOSITORY_OWNER" - if [[ $GITHUB_REPOSITORY_OWNER == 'OSIPI' && $GITHUB_REF = 'refs/heads/develop' && $GITHUB_EVENT_NAME == 'push' ]]; then - echo "CONTINUE=true" >> "$GITHUB_ENV" - else - echo "CONTINUE=false" >> "$GITHUB_ENV" - fi - # End job early if we are on a fork OR if we are not on the "develop" branch OR if we are on a pull request - - name: END JOB EARLY? - if: env.CONTINUE == 'false' - run: echo Ending job early. No need to build notebooks. - - name: Convert contributors csv to md - if: env.CONTINUE == 'true' - run: | - pip install -r notebooks/requirements.txt - python doc/convert_to_md.py - - name: Build the book - if: env.CONTINUE == 'true' - run: | - jupyter-book build notebooks/ - touch notebooks/_build/html/.nojekyll - - name: Re-organize files - if: env.CONTINUE == 'true' - run: | - mkdir out - mv notebooks/_build/html out/docs - mv test out/test - - name: Deploy notebook's html to DCE-DSC-MRI_TestResults repository - if: env.CONTINUE == 'true' - uses: cpina/github-action-push-to-another-repository@master - env: - API_TOKEN_GITHUB: ${{ secrets.DEMO_TOKEN }} - with: - source-directory: 'out' - destination-github-username: 'OSIPI' - destination-repository-name: 'DCE-DSC-MRI_TestResults' - user-email: zaki@live.ca diff --git a/.github/workflows/main-workflow.yml b/.github/workflows/main-workflow.yml new file mode 100644 index 00000000..164af26b --- /dev/null +++ b/.github/workflows/main-workflow.yml @@ -0,0 +1,74 @@ +name: Test, Build, and Deploy Book + +on: + push: + branches: + - main + - develop + pull_request: + branches: + - main + - develop + +jobs: + test-and-build: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: [3.8] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + + - name: Install dependencies + run: | + pip install wheel pytest + pip install -r notebooks/requirements.txt + + - name: Run tests + run: | + pytest --maxfail=1 --disable-warnings -q + + - name: Check if we should build + run: | + if [[ $GITHUB_REF == 'refs/heads/develop' && $GITHUB_EVENT_NAME == 'push' ]]; then + echo "CONTINUE=true" >> $GITHUB_ENV + else + echo "CONTINUE=false" >> $GITHUB_ENV + fi + + - name: Skip build? + if: env.CONTINUE == 'false' + run: echo "Not building the book." + + - name: Build the Jupyter Book + if: env.CONTINUE == 'true' + run: | + jupyter-book build notebooks/ + touch notebooks/_build/html/.nojekyll + + - name: Move output files + if: env.CONTINUE == 'true' + run: | + mkdir out + mv notebooks/_build/html out/docs + mv test out/test + + - name: Deploy Book + if: env.CONTINUE == 'true' + uses: cpina/github-action-push-to-another-repository@master + env: + API_TOKEN_GITHUB: ${{ secrets.GITHUB_TOKEN }} + with: + source-directory: 'out' + destination-github-username: 'OSIPI' + destination-repository-name: 'DCE-DSC-MRI_TestResults' + user-email: 'ahmed.tahan71@gmail.com' diff --git a/notebooks/_config.yml b/notebooks/_config.yml deleted file mode 100755 index 3e77cfa1..00000000 --- a/notebooks/_config.yml +++ /dev/null @@ -1,14 +0,0 @@ -# Book settings -# More info: https://jupyterbook.org/customize/config.html -title: OSIPI Code -author: OSIPI -copyright: "2021" -logo: logo.png -execute: - timeout: 600 -repository: - url : https://github.com/OSIPI/DCE-DSC-MRI_CodeCollection - path_to_book : notebooks - branch : demo -launch_buttons: - notebook_interface: "jupyterlab" \ No newline at end of file diff --git a/notebooks/_toc.yml b/notebooks/_toc.yml deleted file mode 100644 index 5d05de42..00000000 --- a/notebooks/_toc.yml +++ /dev/null @@ -1,32 +0,0 @@ -# Table of contents -# More info: https://jupyterbook.org/customize/toc.html - -format: jb-article -root: intro.md -sections: -- file: overview_of_code_collection.md -- file: DCE.md - sections: - - file: T1mapping.md - sections: - - file: VariableFlipAngle.ipynb - - file: PopulationAIF.md - sections: - - file: ParkerAIF.ipynb - - file: GeorgiouAIF.ipynb - - file: PreclinicalAIF.ipynb - - file: SItoC.ipynb - - file: DCEmodels.md - sections: - - file: ToftsModel.ipynb - - file: ExtendedToftsModel.ipynb - - file: PatlakModel.ipynb - - file: 2CXM.ipynb - - file: 2CUM.ipynb -- file: DSC.md - sections: - - file: DSC_pars.ipynb -- file: guidelines.md -- file: Acknowledgements.ipynb - -