diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 60695b4363..749521555d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,4 +1,4 @@ -# Azure CI build file +# Azure CI build file # https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema @@ -34,24 +34,12 @@ jobs: cxxCompiler: g++ cCompiler: gcc installSh: '' -# CentOS 7 gcc VFX CY2020: -# agentImage: 'ubuntu-16.04' -# containerImage: aswfstaging/ci-openexr:2020.0 -# cxxCompiler: g++ -# cCompiler: gcc -# installSh: '' CentOS 7 Clang 7 VFX CY2019: agentImage: 'ubuntu-16.04' containerImage: aswfstaging/ci-openexr:2019.0 cxxCompiler: clang++ cCompiler: clang installSh: '' -# CentOS 7 Clang 7 VFX CY2020: -# agentImage: 'ubuntu-16.04' -# containerImage: aswfstaging/ci-openexr:2020.0 -# cxxCompiler: clang++ -# cCompiler: clang -# installSh: '' pool: vmImage: $(agentImage) container: $[ variables['containerImage'] ] @@ -72,6 +60,7 @@ jobs: cxxCompiler: $(cxxCompiler) cCompiler: $(cCompiler) cmakeOpts: -- -j4 + excludeTests: 'PyIlmBase.PyImath*' - task: PublishTestResults@2 condition: succeededOrFailed() @@ -120,54 +109,57 @@ jobs: steps: - template: share/ci/templates/checkout.yml - bash: | - share/ci/scripts/macos/install.sh share/ci/scripts/macos/install_python.sh 2.7.16 + share/ci/scripts/macos/install_python.sh 3.7.4 + share/ci/scripts/macos/install.sh displayName: Install dependencies - template: share/ci/templates/configure.yml parameters: - cmakeOpts: | - -DPYTHON_INCLUDE_DIR=$(python-config --prefix)/include/python2.7 \ - -DPYTHON_LIBRARY=$(python-config --prefix)/lib/libpython2.7.dylib \ - -DPYTHON_EXECUTABLE=$(which python2) + cmakeOpts: '' - template: share/ci/templates/build.yml parameters: cmakeOpts: -- -j4 + excludeTests: 'PyIlmBase.PyImath_*' + # ------------------------------------------------------------------------------ # Windows # ------------------------------------------------------------------------------ -#- job: Windows -# strategy: -# matrix: -# 2016 MSVC 14.16: -# agentImage: 'vs2017-win2016' -# buildSharedLibs: ON +- job: Windows + strategy: + matrix: + 2016 MSVC 14.16: + agentImage: 'vs2017-win2016' + buildSharedLibs: ON # 2016 MSVC 14.16 (Static): # agentImage: 'vs2017-win2016' # buildSharedLibs: OFF # 2012 MSVC 14.0: # agentImage: 'vs2015-win2012r2' # buildSharedLibs: ON -# pool: -# vmImage: $(agentImage) -# -# steps: -# - template: share/ci/templates/checkout.yml -# - powershell: | -# share/ci/scripts/windows/install_python.ps1 2.7.16 -# share/ci/scripts/windows/install_cmake.ps1 3.12.4 -# displayName: Install dependencies -# -# - template: share/ci/templates/configure.yml -# parameters: -# buildSharedLibs: $(buildSharedLibs) -# verbose: ON -# cmakeOpts: | -# -DCMAKE_GENERATOR_PLATFORM=x64 \ -# -DPYTHON_EXECUTABLE=$(which python) -# -# - template: share/ci/templates/build.yml + pool: + vmImage: $(agentImage) + + steps: + - template: share/ci/templates/checkout.yml + - powershell: | + share/ci/scripts/windows/install_cmake.ps1 3.12.4 + share/ci/scripts/windows/install_python.ps1 2.7.16 + share/ci/scripts/windows/install_python.ps1 3.7.4 + share/ci/scripts/windows/install_zlib.ps1 1.2.11 + displayName: Install dependencies + + - template: share/ci/templates/configure.yml + parameters: + buildSharedLibs: $(buildSharedLibs) + verbose: ON + cmakeOpts: '' + + - template: share/ci/templates/build.yml + parameters: + cmakeOpts: -- + excludeTests: 'PyIlmBase.PyImath_*|OpenEXR.IlmImf$' diff --git a/share/ci/scripts/macos/install.sh b/share/ci/scripts/macos/install.sh index 6423233201..89d2458931 100755 --- a/share/ci/scripts/macos/install.sh +++ b/share/ci/scripts/macos/install.sh @@ -3,4 +3,6 @@ set -ex brew update -brew install glew +brew install boost +brew install boost-python +brew install boost-python3 diff --git a/share/ci/scripts/macos/install_python.sh b/share/ci/scripts/macos/install_python.sh index 4809933feb..b8e5c0e41b 100755 --- a/share/ci/scripts/macos/install_python.sh +++ b/share/ci/scripts/macos/install_python.sh @@ -3,10 +3,13 @@ set -ex PYTHON_VERSION="$1" +PYTHON_MAJOR="$(echo ${PYTHON_VERSION} | cut -f 1 -d .)" MACOS_MAJOR="$(sw_vers -productVersion | cut -f 1 -d .)" MACOS_MINOR="$(sw_vers -productVersion | cut -f 2 -d .)" +echo "Installing Python ${PYTHON_VERSION} Major ${PYTHON_MAJOR}" + # This workaround is needed for building Python on macOS >= 10.14: # https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes @@ -16,9 +19,21 @@ if [[ "$MACOS_MAJOR" -gt 9 && "$MACOS_MINOR" -gt 13 ]]; then -target / fi -brew install pyenv +unset CFLAGS + +brew update +brew install pyenv openssl + +CFLAGS="-I/usr/local/Cellar/openssl/1.0.2s/include" +LDFLAGS="-L/usr/local/Cellar/openssl/1.0.2s/lib" echo 'eval "$(pyenv init -)"' >> .bash_profile source .bash_profile env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install -v ${PYTHON_VERSION} pyenv global ${PYTHON_VERSION} + +if [[ ${PYTHON_MAJOR}=2 ]]; then + pip install numpy +else + pip3 install numpy +fi diff --git a/share/ci/scripts/windows/install_python.ps1 b/share/ci/scripts/windows/install_python.ps1 index a36f26dd73..e879587540 100755 --- a/share/ci/scripts/windows/install_python.ps1 +++ b/share/ci/scripts/windows/install_python.ps1 @@ -1,6 +1,18 @@ $pythonVersion = $Args[0] +$pythonMajor = ($pythonVersion -split '\.')[0] + +Write-Host "Installing python version ${pythonVersion}" + +if ($pythonMajor -eq "3") +{ + Invoke-WebRequest "https://www.python.org/ftp/python/${pythonVersion}/python-${pythonVersion}-amd64.exe" -OutFile "C:\python-${pythonVersion}-amd64.exe" + & "C:\python-${pythonVersion}-amd64.exe" /quiet /l* C:\_python.log TARGETDIR=C:\_python +} +else +{ + Invoke-WebRequest "https://www.python.org/ftp/python/${pythonVersion}/python-${pythonVersion}.amd64.msi" -OutFile "C:\python-${pythonVersion}-amd64.msi" + msiexec /i "C:\python-${pythonVersion}-amd64.msi" /quiet /l* C:\_python.log TARGETDIR=C:\_python +} -Invoke-WebRequest "https://www.python.org/ftp/python/${pythonVersion}/python-${pythonVersion}.amd64.msi" -OutFile "C:\python-${pythonVersion}.amd64.msi" -msiexec /i "C:\python-${pythonVersion}.amd64.msi" /quiet /l* C:\_python.log TARGETDIR=C:\_python Write-Host "##vso[task.prependpath]C:\_python" Write-Host "##vso[task.prependpath]C:\_python\Scripts" diff --git a/share/ci/scripts/windows/install_zlib.ps1 b/share/ci/scripts/windows/install_zlib.ps1 new file mode 100755 index 0000000000..a5ca904517 --- /dev/null +++ b/share/ci/scripts/windows/install_zlib.ps1 @@ -0,0 +1,30 @@ +$zlibVersion = $Args[0] +$zlibMajorMinor = [io.path]::GetFileNameWithoutExtension("$zlibVersion") +$zlibVersionConcise = $zlibVersion -replace '[.]','' +$zlibArchive = "https://www.zlib.net/zlib${zlibVersionConcise}.zip" + +$zlibRoot = "C:\" +$zlibBuildPath = "${zlibRoot}\zlib-${zlibVersion}" +$zlibInstallPath = "C:\_zlib" +$msbuild = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" + +Write-Host "Retrieving ${zlibArchive}" +Invoke-WebRequest "${zlibArchive}" -OutFile "${zlibRoot}\zlib-${zlibVersion}.zip" +Write-Host "Expanding archive ${zlibRoot}\zlib-${zlibVersion}.zip" +Expand-Archive "${zlibRoot}\zlib-${zlibVersion}.zip" -DestinationPath "${zlibRoot}" + +cd $zlibBuildPath +mkdir _build +cd _build +cmake .. -G"Visual Studio 15 2017" -DCMAKE_INSTALL_PREFIX="${zlibInstallPath}" + +Write-Host "Building ${zlibBuildPath}\_build\INSTALL.vcxproj" -foregroundcolor green +& "${msbuild}" "${zlibBuildPath}\_build\INSTALL.vcxproj" /P:Configuration=Release + +cd $zlibInstallPath +Write-Host "ls ${zlibInstallPath}" +& ls + +Write-Host "##vso[task.prependpath]${zlibInstallPath}" +Write-Host "##vso[task.prependpath]${zlibInstallPath}\bin" + diff --git a/share/ci/templates/build.yml b/share/ci/templates/build.yml index b799a88e34..9f953103cb 100644 --- a/share/ci/templates/build.yml +++ b/share/ci/templates/build.yml @@ -6,6 +6,7 @@ parameters: cxxCompiler: '' cCompiler: '' cmakeOpts: '' + excludeTests: '' steps: - bash: | @@ -23,6 +24,9 @@ steps: workingDirectory: _build displayName: Build OpenEXR -- template: test.yml +- template: test.yml + parameters: + buildType: ${{ parameters.buildType }} + excludeTests: ${{ parameters.excludeTests }} diff --git a/share/ci/templates/test.yml b/share/ci/templates/test.yml index f3bec1e179..e469fa0310 100644 --- a/share/ci/templates/test.yml +++ b/share/ci/templates/test.yml @@ -1,8 +1,21 @@ # azure-pipelines template file # https://docs.microsoft.com/en-us/azure/devops/pipelines/process/templates?view=azure-devops +parameters: + buildType: Release + excludeTests: '' + steps: - bash: | - ctest -T Test -E PyIlmBase.* --output-on-failure -VV + exclusionFlags="" + if [[ -n "${{ parameters.excludeTests}}" ]]; then + exclusionFlags="-E ${{ parameters.excludeTests }}" + echo "Excluding tests ${{ parameters.excludeTests }}" + fi + ctest -T Test \ + $exclusionFlags \ + -C ${{ parameters.buildType }} \ + --output-on-failure \ + -VV workingDirectory: _build displayName: Test OpenEXR