|
| 1 | +name: 'Build, Test, Package ITK Remote Module' |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + cmake-options: |
| 7 | + required: false |
| 8 | + type: string |
| 9 | + default: "" |
| 10 | + itk-wheel-tag: |
| 11 | + required: false |
| 12 | + type: string |
| 13 | + default: 'v5.3rc04.post3' |
| 14 | + secrets: |
| 15 | + pypi_password: |
| 16 | + required: false # Packages will not be uploaded to PyPI if not set |
| 17 | + |
| 18 | +jobs: |
| 19 | + build-linux-python-packages: |
| 20 | + runs-on: ubuntu-20.04 |
| 21 | + strategy: |
| 22 | + max-parallel: 2 |
| 23 | + matrix: |
| 24 | + python-version: [37, 38, 39, 310] |
| 25 | + |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v2 |
| 28 | + |
| 29 | + - name: 'Free up disk space' |
| 30 | + run: | |
| 31 | + # Workaround for https://github.com/actions/virtual-environments/issues/709 |
| 32 | + df -h |
| 33 | + sudo apt-get clean |
| 34 | + sudo rm -rf "/usr/local/share/boost" |
| 35 | + sudo rm -rf "$AGENT_TOOLSDIRECTORY" |
| 36 | + df -h |
| 37 | +
|
| 38 | + - name: 'Fetch build script' |
| 39 | + run: | |
| 40 | + curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh -O |
| 41 | + chmod u+x dockcross-manylinux-download-cache-and-build-module-wheels.sh |
| 42 | +
|
| 43 | + - name: 'Build 🐍 Python 📦 package' |
| 44 | + shell: bash |
| 45 | + run: | |
| 46 | + export ITK_PACKAGE_VERSION=${{ inputs.itk-wheel-tag }} |
| 47 | + if [ -z ${{ inputs.cmake-options }}]; then |
| 48 | + CMAKE_OPTIONS="" |
| 49 | + else |
| 50 | + CMAKE_OPTIONS="--cmake_options ${{ inputs.cmake-options }}" |
| 51 | + fi |
| 52 | + |
| 53 | + for tarball in "-manylinux_2_28" "-manylinux2014"; do |
| 54 | + rm -rf ITKPythonPackage |
| 55 | + export TARBALL_SPECIALIZATION=${tarball} |
| 56 | + ./dockcross-manylinux-download-cache-and-build-module-wheels.sh cp${{ matrix.python-version }} $CMAKE_OPTIONS |
| 57 | + done |
| 58 | +
|
| 59 | + - name: Publish Python package as GitHub Artifact |
| 60 | + uses: actions/upload-artifact@v1 |
| 61 | + with: |
| 62 | + name: LinuxWheel${{ matrix.python-version }} |
| 63 | + path: dist |
| 64 | + |
| 65 | + build-macos-python-packages: |
| 66 | + runs-on: macos-11 |
| 67 | + strategy: |
| 68 | + max-parallel: 2 |
| 69 | + |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@v2 |
| 72 | + |
| 73 | + - name: 'Specific XCode version' |
| 74 | + run: | |
| 75 | + sudo xcode-select -s "/Applications/Xcode_13.2.1.app" |
| 76 | +
|
| 77 | + - name: Get specific version of CMake, Ninja |
| 78 | + |
| 79 | + |
| 80 | + - name: 'Fetch build script' |
| 81 | + run: | |
| 82 | + curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/macpython-download-cache-and-build-module-wheels.sh -O |
| 83 | + chmod u+x macpython-download-cache-and-build-module-wheels.sh |
| 84 | +
|
| 85 | + - name: 'Build 🐍 Python 📦 package' |
| 86 | + shell: bash |
| 87 | + run: | |
| 88 | + export ITK_PACKAGE_VERSION=${{ inputs.itk-wheel-tag }} |
| 89 | + export MACOSX_DEPLOYMENT_TARGET=10.9 |
| 90 | + if [ -z ${{ inputs.cmake-options }}]; then |
| 91 | + CMAKE_OPTIONS="" |
| 92 | + else |
| 93 | + CMAKE_OPTIONS="--cmake_options ${{ inputs.cmake-options }}" |
| 94 | + fi |
| 95 | + ./macpython-download-cache-and-build-module-wheels.sh $CMAKE_OPTIONS |
| 96 | +
|
| 97 | + - name: Publish Python package as GitHub Artifact |
| 98 | + uses: actions/upload-artifact@v1 |
| 99 | + with: |
| 100 | + name: MacOSWheels |
| 101 | + path: dist |
| 102 | + |
| 103 | + build-windows-python-packages: |
| 104 | + runs-on: windows-2019 |
| 105 | + strategy: |
| 106 | + max-parallel: 2 |
| 107 | + matrix: |
| 108 | + python-version-minor: [7, 8, 9, 10] |
| 109 | + |
| 110 | + steps: |
| 111 | + - name: Get specific version of CMake, Ninja |
| 112 | + |
| 113 | + |
| 114 | + - uses: actions/checkout@v2 |
| 115 | + with: |
| 116 | + path: "im" |
| 117 | + |
| 118 | + - name: 'Install Python' |
| 119 | + run: | |
| 120 | + $pythonArch = "64" |
| 121 | + $pythonVersion = "3.${{ matrix.python-version-minor }}" |
| 122 | + iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-python.ps1')) |
| 123 | +
|
| 124 | + - name: 'Fetch build dependencies' |
| 125 | + shell: bash |
| 126 | + run: | |
| 127 | + mv im ../../ |
| 128 | + cd ../../ |
| 129 | + curl -L "https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${{ inputs.itk-wheel-tag }}/ITKPythonBuilds-windows.zip" -o "ITKPythonBuilds-windows.zip" |
| 130 | + 7z x ITKPythonBuilds-windows.zip -o/c/P -aoa -r |
| 131 | + curl -L "https://data.kitware.com/api/v1/file/5c0ad59d8d777f2179dd3e9c/download" -o "doxygen-1.8.11.windows.bin.zip" |
| 132 | + 7z x doxygen-1.8.11.windows.bin.zip -o/c/P/doxygen -aoa -r |
| 133 | + curl -L "https://data.kitware.com/api/v1/file/5bbf87ba8d777f06b91f27d6/download/grep-win.zip" -o "grep-win.zip" |
| 134 | + 7z x grep-win.zip -o/c/P/grep -aoa -r |
| 135 | +
|
| 136 | + - name: 'Build 🐍 Python 📦 package' |
| 137 | + shell: cmd |
| 138 | + run: | |
| 139 | + cd ../../im |
| 140 | + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" |
| 141 | + set PATH=C:\P\grep;%PATH% |
| 142 | + set CC=cl.exe |
| 143 | + set CXX=cl.exe |
| 144 | + C:\Python3${{ matrix.python-version-minor }}-x64\python.exe C:\P\IPP\scripts\windows_build_module_wheels.py --py-envs "3${{ matrix.python-version-minor }}-x64" --no-cleanup |
| 145 | +
|
| 146 | + - name: Publish Python package as GitHub Artifact |
| 147 | + uses: actions/upload-artifact@v1 |
| 148 | + with: |
| 149 | + name: WindowsWheel3.${{ matrix.python-version-minor }} |
| 150 | + path: ../../im/dist |
| 151 | + |
| 152 | + publish-python-packages-to-pypi: |
| 153 | + needs: |
| 154 | + - build-linux-python-packages |
| 155 | + - build-macos-python-packages |
| 156 | + - build-windows-python-packages |
| 157 | + runs-on: ubuntu-18.04 |
| 158 | + |
| 159 | + steps: |
| 160 | + - name: Download Python Packages |
| 161 | + uses: actions/download-artifact@v2 |
| 162 | + |
| 163 | + - name: Prepare packages for upload |
| 164 | + run: | |
| 165 | + ls -R |
| 166 | + for d in */; do |
| 167 | + mv ${d}/*.whl . |
| 168 | + done |
| 169 | + mkdir dist |
| 170 | + mv *.whl dist/ |
| 171 | + ls dist |
| 172 | +
|
| 173 | + - name: Publish 🐍 Python 📦 package to PyPI |
| 174 | + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 175 | + uses: pypa/gh-action-pypi-publish@master |
| 176 | + with: |
| 177 | + user: __token__ |
| 178 | + password: ${{ secrets.pypi_password }} |
0 commit comments