-
Notifications
You must be signed in to change notification settings - Fork 103
226 lines (203 loc) · 10.3 KB
/
CI-windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# This is a basic workflow to help you get started with Actions
name: CI Windows
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ published ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
pip3 install --upgrade pip
pip3 install numpy==1.19.5 twine
- name: Install CUDA
shell: powershell
run: |
$CUDA_KNOWN_URLS = @{
"11.0.1" = "http://developer.download.nvidia.com/compute/cuda/11.0.1/network_installers/cuda_11.0.1_win10_network.exe";
"11.0.2" = "http://developer.download.nvidia.com/compute/cuda/11.0.2/network_installers/cuda_11.0.2_win10_network.exe";
"11.0.3" = "http://developer.download.nvidia.com/compute/cuda/11.0.3/network_installers/cuda_11.0.3_win10_network.exe";
"11.1.0" = "https://developer.download.nvidia.com/compute/cuda/11.1.0/network_installers/cuda_11.1.0_win10_network.exe";
"11.1.1" = "https://developer.download.nvidia.com/compute/cuda/11.1.1/network_installers/cuda_11.1.1_win10_network.exe";
"11.2.0" = "https://developer.download.nvidia.com/compute/cuda/11.2.0/network_installers/cuda_11.2.0_win10_network.exe";
"11.2.1" = "https://developer.download.nvidia.com/compute/cuda/11.2.1/network_installers/cuda_11.2.1_win10_network.exe";
"11.2.2" = "https://developer.download.nvidia.com/compute/cuda/11.2.2/network_installers/cuda_11.2.2_win10_network.exe";
"11.3.0" = "https://developer.download.nvidia.com/compute/cuda/11.3.0/network_installers/cuda_11.3.0_win10_network.exe"
}
$CUDA_PACKAGES_IN = @(
"nvcc";
"cudart";
)
$CUDA_VERSION_FULL = "11.0.3"
$CUDA_MAJOR=11
$CUDA_MINOR=0
$CUDA_PATCH=3
$CUDA_PACKAGES = ""
Foreach ($package in $CUDA_PACKAGES_IN) {
# Make sure the correct package name is used for nvcc.
if($package -eq "nvcc" -and [version]$CUDA_VERSION_FULL -lt [version]"9.1"){
$package="compiler"
} elseif($package -eq "compiler" -and [version]$CUDA_VERSION_FULL -ge [version]"9.1") {
$package="nvcc"
}
$CUDA_PACKAGES += " $($package)_$($CUDA_MAJOR).$($CUDA_MINOR)"
}
echo "$($CUDA_PACKAGES)"
$CUDA_REPO_PKG_REMOTE=$CUDA_KNOWN_URLS[$CUDA_VERSION_FULL]
$CUDA_REPO_PKG_LOCAL="cuda_$($CUDA_VERSION_FULL)_win10_network.exe"
Write-Output "Downloading CUDA Network Installer for $($CUDA_VERSION_FULL) from: $($CUDA_REPO_PKG_REMOTE)"
Invoke-WebRequest $CUDA_REPO_PKG_REMOTE -OutFile $CUDA_REPO_PKG_LOCAL | Out-Null
if(Test-Path -Path $CUDA_REPO_PKG_LOCAL){
Write-Output "Downloading Complete"
} else {
Write-Output "Error: Failed to download $($CUDA_REPO_PKG_LOCAL) from $($CUDA_REPO_PKG_REMOTE)"
exit 1
}
# Invoke silent install of CUDA (via network installer)
Write-Output "Installing CUDA $($CUDA_VERSION_FULL). Subpackages $($CUDA_PACKAGES)"
Start-Process -Wait -FilePath .\"$($CUDA_REPO_PKG_LOCAL)" -ArgumentList "-s $($CUDA_PACKAGES)"
# Check the return status of the CUDA installer.
if (!$?) {
Write-Output "Error: CUDA installer reported error. $($LASTEXITCODE)"
exit 1
}
# Store the CUDA_PATH in the environment for the current session, to be forwarded in the action.
$CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v$($CUDA_MAJOR).$($CUDA_MINOR)"
$CUDA_PATH_VX_Y = "CUDA_PATH_V$($CUDA_MAJOR)_$($CUDA_MINOR)"
# Set environmental variables in this session
$env:CUDA_PATH = "$($CUDA_PATH)"
$env:CUDA_PATH_VX_Y = "$($CUDA_PATH_VX_Y)"
Write-Output "CUDA_PATH $($CUDA_PATH)"
Write-Output "CUDA_PATH_VX_Y $($CUDA_PATH_VX_Y)"
- name: Download cuDNN and TensorRT
uses: robinraju/release-downloader@main
if: ${{ github.event_name != 'pull_request' }}
with:
repository: "smistad/FAST-secret-dependencies"
latest: true
fileName: "*"
token: ${{ secrets.DOWNLOAD_SECRET_DEPENDENCIES }}
- name: Install cuDNN and TensorRT
if: ${{ github.event_name != 'pull_request' }}
shell: powershell
run: |
Expand-Archive -Path ${{github.workspace}}/cudnn-windows-x86_64-8.6.0.163_cuda11-archive.zip -DestinationPath ${{github.workspace}}/cudnn/
cp ${{github.workspace}}/cudnn/cudnn-windows-x86_64-8.6.0.163_cuda11-archive/bin/*.dll "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0/bin/"
cp ${{github.workspace}}/cudnn/cudnn-windows-x86_64-8.6.0.163_cuda11-archive/include/cudnn*.h "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0/include/"
cp ${{github.workspace}}/cudnn/cudnn-windows-x86_64-8.6.0.163_cuda11-archive/lib/cudnn*.lib "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0/lib/x64/"
Expand-Archive -Path ${{github.workspace}}/TensorRT-8.5.3.1.Windows10.x86_64.cuda-11.8.cudnn8.6.zip -DestinationPath ${{github.workspace}}/trt/
- name: Configure CMake (with TensorRT)
if: ${{ github.event_name != 'pull_request' }}
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake ${{github.workspace}} -B ${{github.workspace}}/build `
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} `
-DFAST_MODULE_OpenVINO=ON `
-DFAST_MODULE_Dicom=ON `
-DFAST_MODULE_WholeSlideImaging=ON `
-DFAST_MODULE_OpenIGTLink=ON `
-DFAST_MODULE_Clarius=ON `
-DFAST_MODULE_TensorFlow=ON `
-DCUDA_TOOLKIT_ROOT_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0/" `
-DTensorRT_ROOT="${{github.workspace}}/trt/TensorRT-8.5.3.1/" `
-DTensorRT_parsers_LIBRARY="${{github.workspace}}/trt/TensorRT-8.5.3.1/lib/nvparsers.lib" `
-DTensorRT_onnx_parser_LIBRARY="${{github.workspace}}/trt/TensorRT-8.5.3.1/lib/nvonnxparser.lib" `
-DFAST_MODULE_TensorRT=ON `
-DFAST_MODULE_HDF5=ON `
-DFAST_MODULE_Plotting=ON `
-DFAST_MODULE_Python=ON `
-DFAST_MODULE_RealSense=ON `
-DFAST_BUILD_EXAMPLES=ON
- name: Configure CMake (without TensorRT)
if: ${{ github.event_name == 'pull_request' }}
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake ${{github.workspace}} -B ${{github.workspace}}/build `
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} `
-DFAST_MODULE_OpenVINO=ON `
-DFAST_MODULE_Dicom=ON `
-DFAST_MODULE_WholeSlideImaging=ON `
-DFAST_MODULE_OpenIGTLink=ON `
-DFAST_MODULE_Clarius=ON `
-DFAST_MODULE_TensorFlow=ON `
-DFAST_MODULE_TensorRT=OFF `
-DFAST_MODULE_HDF5=ON `
-DFAST_MODULE_Plotting=ON `
-DFAST_MODULE_Python=ON `
-DFAST_MODULE_RealSense=ON `
-DFAST_BUILD_EXAMPLES=ON
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4
- name: Build Python wheel
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target python-wheel -j 4
- name: Package
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target package -j 4
- name: Upload Windows installer
uses: actions/upload-artifact@v4
with:
name: Window installer
path: ${{github.workspace}}/build/fast_*.exe
if-no-files-found: error
- name: Upload archive package
uses: actions/upload-artifact@v4
with:
name: Archive package (zip)
path: ${{github.workspace}}/build/fast_*.zip
if-no-files-found: error
- name: Upload Python wheel
uses: actions/upload-artifact@v4
with:
name: Python wheel
path: ${{github.workspace}}/build/python/dist/pyFAST-*.whl
if-no-files-found: error
- name: Upload Windows installer to release
if: ${{ github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{github.workspace}}/build/fast_*.exe
file_glob: true
tag: ${{ github.ref }}
overwrite: true
- name: Upload archive package to release
if: ${{ github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{github.workspace}}/build/fast_*.zip
file_glob: true
tag: ${{ github.ref }}
overwrite: true
- name: Upload Python wheel to release
if: ${{ github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{github.workspace}}/build/python/dist/pyFAST-*.whl
file_glob: true
tag: ${{ github.ref }}
overwrite: true
- name: Upload Python wheel to PyPi
if: ${{ github.event_name == 'release' && !contains(github.ref, 'rc') }}
run: |
twine upload --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} ${{github.workspace}}/build/python/dist/pyFAST-*.whl