Skip to content

Commit

Permalink
ENH: add CI for Windows and Linux CUDA packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Rit committed Jun 3, 2022
1 parent ee4f43a commit 2c5b730
Showing 1 changed file with 138 additions and 2 deletions.
140 changes: 138 additions & 2 deletions .github/workflows/build-test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ jobs:
strategy:
max-parallel: 3
matrix:
os: [self-hosted]
os: [self-hosted-linux, self-hosted-windows]
include:
- os: self-hosted
- os: self-hosted-linux
c-compiler: "gcc"
cxx-compiler: "g++"
itk-git-tag: "d6acfd26bfcdec606d605beb1301bddfb17c05a6"
cmake-build-type: "MinSizeRel"
- os: self-hosted-windows
c-compiler: "cl.exe"
cxx-compiler: "cl.exe"
itk-git-tag: "d6acfd26bfcdec606d605beb1301bddfb17c05a6"
cmake-build-type: "Release"

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -42,14 +47,27 @@ jobs:
git checkout ${{ matrix.itk-git-tag }}
- name: Build ITK
if: matrix.os != 'self-hosted-windows'
run: |
cd ..
mkdir ITK-build
cd ITK-build
cmake -DCMAKE_C_COMPILER:FILEPATH="${{ matrix.c-compiler }}" -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_CXX_COMPILER="${{ matrix.cxx-compiler }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.cmake-build-type }} -DBUILD_TESTING:BOOL=OFF -GNinja ../ITK
ninja
- name: Build ITK
if: matrix.os == 'self-hosted-windows'
run: |
cd ..
mkdir ITK-build
cd ITK-build
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
cmake -DCMAKE_C_COMPILER:FILEPATH="${{ matrix.c-compiler }}" -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_CXX_COMPILER="${{ matrix.cxx-compiler }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.cmake-build-type }} -DBUILD_TESTING:BOOL=OFF -GNinja ../ITK
ninja
shell: cmd

- name: Fetch CTest driver script
shell: bash
run: |
curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/dashboard/itk_common.cmake -O
Expand Down Expand Up @@ -98,5 +116,123 @@ jobs:
cat dashboard.cmake
- name: Build and test
if: matrix.os != 'self-hosted-windows'
run: |
ctest --output-on-failure -j 2 -V -S dashboard.cmake
- name: Build and test
if: matrix.os == 'self-hosted-windows'
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
ctest --output-on-failure -j 2 -V -S dashboard.cmake
shell: cmd


build-linux-cuda-python-packages:
runs-on: self-hosted-linux
strategy:
max-parallel: 2
matrix:
python-version: [37, 38, 39, 310]
include:
- itk-python-git-tag: "v5.3rc04"

steps:
- uses: actions/checkout@v2

- name: 'Fetch build script'
run: |
curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh -O
chmod u+x dockcross-manylinux-download-cache-and-build-module-wheels.sh
- name: 'Build 🐍 Python 📦 package'
run: |
export ITK_PACKAGE_VERSION=${{ matrix.itk-python-git-tag }}
export LD_LIBRARY_PATH="/home/srit/Downloads/cuda116:/home/srit/Downloads/cuda116/targets/x86_64-linux/lib:/home/srit/Downloads/cuda116/lib64/stubs"
./dockcross-manylinux-download-cache-and-build-module-wheels.sh -c "-DCUDAToolkit_ROOT=/usr/lib64/cuda116 -DCMAKE_CUDA_COMPILER=/usr/lib64/cuda116/bin/nvcc" -x "libcuda.so;libcuda.so.1;libcudart.so;libcudart.so.11.0;libcublas.so;libcublas.so.11;libcublasLt.so;libcublasLt.so.11;libcufft.so;libcufft.so.10" cp${{ matrix.python-version }}
- name: Publish Python package as GitHub Artifact
uses: actions/upload-artifact@v1
with:
name: LinuxWheel${{ matrix.python-version }}-cuda116
path: dist

build-windows-cuda-python-packages:
runs-on: self-hosted-windows
strategy:
max-parallel: 2
matrix:
python-version-minor: [7, 8, 9, 10]
include:
- itk-python-git-tag: "v5.3rc04"

steps:
- uses: actions/checkout@v2
with:
path: "im"

- name: 'Install Python'
run: |
$pythonArch = "64"
$pythonVersion = "3.${{ matrix.python-version-minor }}"
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-python.ps1'))
- name: self-hosted cleanup
shell: bash
run: |
rm -fr ../../im
- name: 'Fetch build dependencies'
shell: bash
run: |
mv im ../../
cd ../../im
curl -L "https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${{ matrix.itk-python-git-tag }}/ITKPythonBuilds-windows.zip" -o "ITKPythonBuilds-windows.zip"
7z x ITKPythonBuilds-windows.zip -o/c/P -aoa -r
curl -L "https://data.kitware.com/api/v1/file/5c0ad59d8d777f2179dd3e9c/download" -o "doxygen-1.8.11.windows.bin.zip"
7z x doxygen-1.8.11.windows.bin.zip -o/c/P/doxygen -aoa -r
curl -L "https://data.kitware.com/api/v1/file/5bbf87ba8d777f06b91f27d6/download/grep-win.zip" -o "grep-win.zip"
7z x grep-win.zip -o/c/P/grep -aoa -r
- name: 'Build 🐍 Python 📦 package'
shell: cmd
run: |
cd ../../im
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
set PATH=C:\P\grep;%PATH%
set CC=cl.exe
set CXX=cl.exe
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 --lib-paths "C:/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v11.6/bin" --exclude-libs "nvcuda.dll"
- name: Publish Python package as GitHub Artifact
uses: actions/upload-artifact@v1
with:
name: WindowsWheel3.${{ matrix.python-version-minor }}-cuda116
path: ../../im/dist

publish-python-packages-to-pypi:
needs:
- build-linux-cuda-python-packages
- build-windows-cuda-python-packages
runs-on: ubuntu-20.04

steps:
- name: Download Python Packages
uses: actions/download-artifact@v2

- name: Prepare packages for upload
run: |
ls -R
for d in */; do
mv ${d}/*.whl .
done
mkdir dist
mv *.whl dist/
ls dist
- name: Publish 🐍 Python 📦 package to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}

0 comments on commit 2c5b730

Please sign in to comment.