|
| 1 | +#This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
| 2 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
| 3 | + |
| 4 | +# For deployment, it will be necessary to create a PyPI API token and store it as a secret |
| 5 | +# https://docs.github.com/en/actions/reference/encrypted-secrets |
| 6 | + |
| 7 | +name: CI/CD |
| 8 | + |
| 9 | + |
| 10 | +on: |
| 11 | + workflow_dispatch: # Trigger this workflow manually or via a repository dispatch event |
| 12 | + repository_dispatch: |
| 13 | + types: [auto-gen] |
| 14 | + |
| 15 | + |
| 16 | +env: |
| 17 | + MRTRIX_HOME: /opt/mrtrix3 |
| 18 | + MRTRIX_INSTALL: /opt/mrtrix3/install |
| 19 | + MRTRIX_VERSION: 3.1.0 |
| 20 | + SUBPKG_NAME: v3_1 |
| 21 | + |
| 22 | +jobs: |
| 23 | + |
| 24 | + generate: |
| 25 | + |
| 26 | + runs-on: ubuntu-latest |
| 27 | + |
| 28 | + env: |
| 29 | + CFLAGS: -Werror |
| 30 | + QT_SELECT: qt6 |
| 31 | + SCCACHE_GHA_ENABLED: "true" |
| 32 | + SCCACHE_CACHE_SIZE: "2G" |
| 33 | + |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v3 |
| 36 | + with: |
| 37 | + submodules: true |
| 38 | + - name: Set Git User |
| 39 | + # checkout@v2 adds a header that makes branch protection report errors |
| 40 | + # because the Github action bot is not a collaborator on the repo |
| 41 | + run: | |
| 42 | + git config --global user.email "dummy@email.com" |
| 43 | + git config --global user.name "Dummy User" |
| 44 | + - name: Unset header |
| 45 | + # checkout@v2 adds a header that makes branch protection report errors |
| 46 | + # because the Github action bot is not a collaborator on the repo |
| 47 | + run: git config --local --unset http.https://github.com/.extraheader |
| 48 | + - name: Fetch tags |
| 49 | + run: git fetch --prune --unshallow |
| 50 | + - name: Create auto-gen tag |
| 51 | + run: git tag -a old-auto-gen -m "Old point of auto-generation" |
| 52 | + - name: Checkout auto-gen branch |
| 53 | + run: git checkout auto-gen |
| 54 | + - name: install dependencies |
| 55 | + run: | |
| 56 | + sudo apt-get update |
| 57 | + sudo apt-get install clang qt6-base-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build |
| 58 | + - name: Run sccache-cache |
| 59 | + uses: mozilla-actions/sccache-action@v0.0.3 |
| 60 | + - name: Get CMake |
| 61 | + uses: lukka/get-cmake@latest |
| 62 | + with: |
| 63 | + cmakeVersion: '3.16.3' |
| 64 | + - name: Print CMake version |
| 65 | + run: cmake --version |
| 66 | + - name: Create MRtrix install directory |
| 67 | + run: | |
| 68 | + sudo mkdir -p ${{ env.MRTRIX_INSTALL }} |
| 69 | + sudo chown $USER ${{ env.MRTRIX_INSTALL }} |
| 70 | + - name: Cache MRtrix Install |
| 71 | + id: cache-install |
| 72 | + uses: actions/cache@v4 |
| 73 | + with: |
| 74 | + path: ${{ env.MRTRIX_INSTALL }} |
| 75 | + key: mrtrix-${{ env.MRTRIX_VERSION }}-${{ runner.os }} |
| 76 | + - name: Clone latest MRtrix and switch to latest tag |
| 77 | + run: | |
| 78 | + mkdir $MRTRIX_HOME |
| 79 | + sudo chown -R $USER $MRTRIX_HOME |
| 80 | + git clone https://github.com/tclose/mrtrix3.git $MRTRIX_HOME/src |
| 81 | + cd $MRTRIX_HOME/src |
| 82 | + git checkout print-pydra-dev |
| 83 | + git tag -a $MRTRIX_VERSION -m"Tag used to create a pydra-task-mrtrix3 release" |
| 84 | + git describe --abbrev=0 |
| 85 | +# echo "MRTRIX_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV |
| 86 | +# git checkout $MRTRIX_VERSION |
| 87 | + - name: configure |
| 88 | + run: | |
| 89 | + cd $MRTRIX_HOME/src |
| 90 | + cmake \ |
| 91 | + -B build \ |
| 92 | + -G Ninja \ |
| 93 | + -D CMAKE_BUILD_TYPE=Release \ |
| 94 | + -D MRTRIX_BUILD_TESTS=ON \ |
| 95 | + -D MRTRIX_STL_DEBUGGING=ON \ |
| 96 | + -D MRTRIX_WARNINGS_AS_ERRORS=ON \ |
| 97 | + -D CMAKE_C_COMPILER=clang \ |
| 98 | + -D CMAKE_CXX_COMPILER=clang++ \ |
| 99 | + -D CMAKE_INSTALL_PREFIX=$MRTRIX_INSTALL |
| 100 | + - name: Build Mrtrix |
| 101 | + run: | |
| 102 | + cd $MRTRIX_HOME/src |
| 103 | + cmake --build build |
| 104 | + - name: Install Mrtrix |
| 105 | + run: | |
| 106 | + cd $MRTRIX_HOME/src |
| 107 | + cmake --install build |
| 108 | + - name: Set PATH Variable |
| 109 | + run: echo "PATH=$PATH:$MRTRIX_INSTALL/bin" >> $GITHUB_ENV |
| 110 | + - name: Set LD_LIBRARY_PATH Variable |
| 111 | + run: echo "LD_LIBRARY_PATH=$MRTRIX_INSTALL/lib" >> $GITHUB_ENV |
| 112 | + - name: Change back to the root directory |
| 113 | + run: cd .. |
| 114 | + - name: Set up Python |
| 115 | + uses: actions/setup-python@v5 |
| 116 | + - name: Install Python build dependencies |
| 117 | + run: | |
| 118 | + python -m pip install --upgrade pip |
| 119 | + - name: Install pydra-auto-gen requirements |
| 120 | + run: > |
| 121 | + pip install |
| 122 | + -e related-packages/fileformats |
| 123 | + -e related-packages/fileformats-extras |
| 124 | + -e .[dev,test] |
| 125 | + - name: Install development Pydra |
| 126 | + run: pip install --no-deps git+https://github.com/nipype/pydra.git@develop |
| 127 | + - name: Generate task specifications |
| 128 | + run: > |
| 129 | + ./generate.py |
| 130 | + $MRTRIX_INSTALL/bin |
| 131 | + $(pwd) |
| 132 | + $MRTRIX_VERSION |
| 133 | + --raise-errors |
| 134 | + --latest |
| 135 | + - name: Commit changes to auto-gen branch |
| 136 | + run: | |
| 137 | + git add . |
| 138 | + git commit -m "Refresh of auto-generated task specifications" |
| 139 | + git push |
| 140 | + - name: Rebase main on auto-gen |
| 141 | + run: | |
| 142 | + git checkout main |
| 143 | + git checkout -b re-auto-gen |
| 144 | + git rebase old-auto-gen --onto auto-gen |
| 145 | + - name: Create pull request |
| 146 | + uses: peter-evans/create-pull-request@v4 |
| 147 | + with: |
| 148 | + branch: re-auto-gen |
| 149 | + title: 'Rebase of main on re-auto-generated tasks' |
| 150 | + body: 'This PR rebases the main branch on the re-auto-gen branch to include newly regenerated Pydra tasks.' |
| 151 | + base: main |
| 152 | + commit-message: 'Rebase main on auto-gen' |
| 153 | + labels: auto-gen |
0 commit comments