Skip to content

Commit 44395c2

Browse files
authored
Merge pull request #304 from tpaviot/review/ci-cd
CI/CD changes
2 parents 086fee9 + ded819b commit 44395c2

12 files changed

+344
-385
lines changed

.travis.yml

+57-26
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,64 @@ sudo: false
22

33
language: cpp
44

5-
os:
6-
- osx
7-
- linux
8-
9-
compiler:
10-
- gcc
11-
- clang
12-
13-
env:
14-
matrix:
15-
- python_version=2.7
16-
- python_version=3.5m
17-
18-
install:
19-
# We do this conditionally because it saves us some downloading if the
20-
# version is the same.
21-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
22-
wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
23-
else
24-
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh;
5+
#os:
6+
# - osx
7+
# - linux
8+
9+
#compiler: REMOVE comments to test both gcc and clang compilers
10+
#- gcc
11+
#- clang
12+
# Install packages for cross-compilation to 32 Bit
13+
addons:
14+
apt:
15+
packages:
16+
- gcc-multilib
17+
- g++-multilib
18+
- lib32z1
19+
20+
matrix:
21+
include:
22+
#- env: PYTHON="2.7" CONDA_PY=27 ARCH="x86"
23+
# os: linux
24+
- env: PYTHON="2.7" CONDA_PY=27 ARCH="x86_64"
25+
os: linux
26+
- env: PYTHON="2.7" CONDA_PY=27 ARCH="x86_64"
27+
os: osx
28+
#- env: PYTHON="3.4" CONDA_PY=34 ARCH="x86"
29+
# os: linux
30+
- env: PYTHON="3.4" CONDA_PY=34 ARCH="x86_64"
31+
os: linux
32+
- env: PYTHON="3.4" CONDA_PY=34 ARCH="x86_64"
33+
os: osx
34+
#- env: PYTHON="3.5" CONDA_PY=35 ARCH="x86"
35+
# os: linux
36+
- env: PYTHON="3.5" CONDA_PY=35 ARCH="x86_64"
37+
os: linux
38+
- env: PYTHON="3.5" CONDA_PY=35 ARCH="x86_64"
39+
os: osx
40+
41+
# Use miniconda to install binary versions of numpy etc. from continuum
42+
# analytic's repository. Follows an approach described by Dan Blanchard:
43+
# https://gist.github.com/dan-blanchard/7045057
44+
before_install:
45+
- if [ ${PYTHON:0:1} == "2" ]; then
46+
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
47+
wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-$ARCH.sh -O miniconda.sh;
48+
else
49+
wget http://repo.continuum.io/miniconda/Miniconda-latest-MacOSX-$ARCH.sh -O miniconda.sh;
50+
fi;
51+
else
52+
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
53+
wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-$ARCH.sh -O miniconda.sh;
54+
else
55+
wget http://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-$ARCH.sh -O miniconda.sh;
56+
fi;
2557
fi
26-
- bash miniconda.sh -b -p $HOME/miniconda
58+
- chmod +x miniconda.sh
59+
# When we are installing the 32 Bit conda on a 64 Bit system, the miniconda
60+
# installer will ask for a "yes" despite the -b flag, so we pipe in a yes
61+
- yes | ./miniconda.sh -b -p $HOME/miniconda
62+
#- bash miniconda.sh -b -p -f $HOME/miniconda
2763
- export PATH="$HOME/miniconda/bin:$HOME/miniconda/lib:$PATH"
2864
- hash -r
2965
- conda config --set always_yes yes --set changeps1 no
@@ -37,11 +73,6 @@ install:
3773

3874

3975
script:
40-
- if [[ "$python_version" == "2.7" ]]; then
41-
export CONDA_PY=27;
42-
else
43-
export CONDA_PY=35;
44-
fi
4576
- conda build ci/conda
4677

4778
branches:

CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ if(WIN32)
178178
if(MSVC) # The compiler used is MSVC
179179
message(STATUS "Found MSVC compiler: ${MSVC} ${MSVC_VERSION}")
180180
set(LIBRARY_OUTPUT_PATH bin/)
181+
# prevent bigobj fatal error C1148 issue, and remove C4244 verbose warning
182+
add_definitions("/bigobj /wd4244")
181183
elseif (BORLAND) # The compiler used is BORLAND
182184
set(LIBRARY_OUTPUT_PATH win${BIT}/bin/${CMAKE_BUILD_TYPE})
183185
else()

appveyor.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
version: pythonocc-core-0.17.2-dev.{build}
2+
3+
environment:
4+
global:
5+
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
6+
# /E:ON and /V:ON options are not enabled in the batch script intepreter
7+
# See: http://stackoverflow.com/a/13751649/163740
8+
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci\\appveyor\\run_with_env.cmd"
9+
10+
matrix:
11+
- PYTHON: "C:\\Python27_32"
12+
PYTHON_VERSION: "2.7"
13+
PYTHON_ARCH: "32"
14+
CONDA_PY: "27"
15+
CONDA_NPY: "18"
16+
17+
- PYTHON: "C:\\Python27_64"
18+
PYTHON_VERSION: "2.7"
19+
PYTHON_ARCH: "64"
20+
CONDA_PY: "27"
21+
CONDA_NPY: "18"
22+
23+
- PYTHON: "C:\\Python34_32"
24+
PYTHON_VERSION: "3.4"
25+
PYTHON_ARCH: "32"
26+
CONDA_PY: "34"
27+
CONDA_NPY: "18"
28+
29+
- PYTHON: "C:\\Python34_64"
30+
PYTHON_VERSION: "3.4"
31+
PYTHON_ARCH: "64"
32+
CONDA_PY: "34"
33+
CONDA_NPY: "18"
34+
35+
- PYTHON: "C:\\Python35_32"
36+
PYTHON_VERSION: "3.5"
37+
PYTHON_ARCH: "32"
38+
CONDA_PY: "35"
39+
CONDA_NPY: "18"
40+
41+
- PYTHON: "C:\\Python35_64"
42+
PYTHON_VERSION: "3.5"
43+
PYTHON_ARCH: "64"
44+
CONDA_PY: "35"
45+
CONDA_NPY: "18"
46+
47+
install:
48+
# this installs the appropriate Miniconda (Py2/Py3, 32/64 bit),
49+
# as well as pip, conda-build, and the binstar CLI
50+
- powershell .\\ci\\appveyor\\appveyor_install_conda.ps1
51+
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
52+
- "%CMD_IN_ENV% conda config --add channels https://conda.anaconda.org/dlr-sc"
53+
- "%CMD_IN_ENV% conda config --add channels https://conda.anaconda.org/oce"
54+
55+
build: false
56+
57+
test_script:
58+
# Build and test the package. This appears(?) to sporadically fail due to a
59+
# bug in conda-build on 32 bit python.
60+
# https://github.com/conda/conda-build/issues/152
61+
#
62+
# Note also that our setup.py script, which is called by conda-build, writes
63+
# a __conda_version__.txt file, so the version number on the binary package
64+
# is set dynamically. This unfortunately mean that conda build --output
65+
# doesn't really work.
66+
#
67+
- "%CMD_IN_ENV% conda build .\\ci\\conda --quiet"
68+
# Move the conda package into the current directory, to register it
69+
# as an "artifact" for Appveyor. cmd.exe does't have good globbing, so
70+
# we'll use a simple python script.
71+
- python ci\move-conda-package.py
72+
73+
artifacts:
74+
# Archive the generated conda package in the ci.appveyor.com build report.
75+
- path: '*.tar.bz2'
+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Sample script to install Miniconda under Windows
2+
# Authors: Olivier Grisel, Jonathan Helmus and Kyle Kastner, Robert McGibbon
3+
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
4+
5+
$MINICONDA_URL = "http://repo.continuum.io/miniconda/"
6+
7+
8+
function DownloadMiniconda ($python_version, $platform_suffix) {
9+
$webclient = New-Object System.Net.WebClient
10+
if ($python_version -match "3.4") {
11+
$filename = "Miniconda3-latest-Windows-" + $platform_suffix + ".exe"
12+
} else {
13+
$filename = "Miniconda-latest-Windows-" + $platform_suffix + ".exe"
14+
}
15+
$url = $MINICONDA_URL + $filename
16+
17+
$basedir = $pwd.Path + "\"
18+
$filepath = $basedir + $filename
19+
if (Test-Path $filename) {
20+
Write-Host "Reusing" $filepath
21+
return $filepath
22+
}
23+
24+
# Download and retry up to 3 times in case of network transient errors.
25+
Write-Host "Downloading" $filename "from" $url
26+
$retry_attempts = 2
27+
for($i=0; $i -lt $retry_attempts; $i++){
28+
try {
29+
$webclient.DownloadFile($url, $filepath)
30+
break
31+
}
32+
Catch [Exception]{
33+
Start-Sleep 1
34+
}
35+
}
36+
if (Test-Path $filepath) {
37+
Write-Host "File saved at" $filepath
38+
} else {
39+
# Retry once to get the error message if any at the last try
40+
$webclient.DownloadFile($url, $filepath)
41+
}
42+
return $filepath
43+
}
44+
45+
46+
function InstallMiniconda ($python_version, $architecture, $python_home) {
47+
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
48+
if (Test-Path $python_home) {
49+
Write-Host $python_home "already exists, skipping."
50+
return $false
51+
}
52+
if ($architecture -match "32") {
53+
$platform_suffix = "x86"
54+
} else {
55+
$platform_suffix = "x86_64"
56+
}
57+
58+
$filepath = DownloadMiniconda $python_version $platform_suffix
59+
Write-Host "Installing" $filepath "to" $python_home
60+
$install_log = $python_home + ".log"
61+
$args = "/S /D=$python_home"
62+
Write-Host $filepath $args
63+
Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru
64+
if (Test-Path $python_home) {
65+
Write-Host "Python $python_version ($architecture) installation complete"
66+
} else {
67+
Write-Host "Failed to install Python in $python_home"
68+
Get-Content -Path $install_log
69+
Exit 1
70+
}
71+
}
72+
73+
74+
function InstallCondaPackages ($python_home, $spec) {
75+
$conda_path = $python_home + "\Scripts\conda.exe"
76+
$args = "install --yes " + $spec
77+
Write-Host ("conda " + $args)
78+
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
79+
}
80+
81+
function UpdateConda ($python_home) {
82+
$conda_path = $python_home + "\Scripts\conda.exe"
83+
Write-Host "Updating conda..."
84+
$args = "update --yes conda"
85+
Write-Host $conda_path $args
86+
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
87+
}
88+
89+
90+
function main () {
91+
InstallMiniconda $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
92+
UpdateConda $env:PYTHON
93+
InstallCondaPackages $env:PYTHON "conda-build jinja2 anaconda-client"
94+
}
95+
96+
main
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cd C:\projects\pythonocc-core
2+
mkdir cmake-build
3+
cd cmake-build
4+
cmake -DOCE_DIR=C:\\Python27_32\\Library\\cmake ^
5+
-G "%generator%" ..
6+
msbuild /m:8 /verbosity:minimal /p:Configuration=%configuration% PYTHONOCC.sln
7+
msbuild /m:4 /verbosity:minimal /p:Configuration=%configuration% INSTALL.vcxproj
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/sh
2+
set -e
3+
cd /c/projects/pythonocc-core
4+
if [ "$ARCH" = Win32 ]; then
5+
PATH=$PATH:/c/MinGW/bin
6+
elif [ "$ARCH" = i686 ]; then
7+
f=i686-4.9.3-release-posix-dwarf-rt_v4-rev1.7z
8+
if ! [ -e $f ]; then
9+
echo "Downloading $f"
10+
curl -LsSO http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.3/threads-posix/dwarf/$f
11+
fi
12+
7z x $f > /dev/null
13+
echo "Extracting $f"
14+
mv mingw32 /MinGW
15+
else
16+
f=x86_64-5.2.0-release-posix-seh-rt_v4-rev0.7z
17+
if ! [ -e $f ]; then
18+
echo "Downloading $f"
19+
curl -LsSO http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/5.2.0/threads-posix/seh/$f
20+
fi
21+
echo "Extracting $f"
22+
7z x $f > /dev/null
23+
mv mingw64 /MinGW
24+
fi
25+
# download/extract oce-0.17.2
26+
f=OCE-0.17.2-Mingw32.zip
27+
if ! [ -e $f ]; then
28+
echo "Downloading $f"
29+
curl -LsSO https://github.com/tpaviot/oce/releases/download/OCE-0.17.2/$f
30+
fi
31+
echo "Extracting $f"
32+
7z x $f > /dev/null
33+
34+
echo "current directory"
35+
pwd
36+
ls C:/projects/pythonocc-core/OCE-0.17.2-Mingw32/cmake
37+
g++ -v
38+
# make pythonocc-core
39+
cd /c/projects/pythonocc-core
40+
mkdir cmake-build
41+
cd cmake-build
42+
cmake -DOCE_DIR=C:/projects/pythonocc-core/OCE-0.17.2-Mingw32/cmake \
43+
-G'MSYS Makefiles' ..
44+
45+
mingw32-make -j4
46+
mingw32-make install

ci/appveyor/run_with_env.cmd

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
:: To build extensions for 64 bit Python 3, we need to configure environment
2+
:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:
3+
:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1)
4+
::
5+
:: To build extensions for 64 bit Python 2, we need to configure environment
6+
:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of:
7+
:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0)
8+
::
9+
:: 32 bit builds do not require specific environment configurations.
10+
::
11+
:: Note: this script needs to be run with the /E:ON and /V:ON flags for the
12+
:: cmd interpreter, at least for (SDK v7.0)
13+
::
14+
:: More details at:
15+
:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows
16+
:: http://stackoverflow.com/a/13751649/163740
17+
::
18+
:: Author: Olivier Grisel
19+
:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
20+
@ECHO OFF
21+
22+
SET COMMAND_TO_RUN=%*
23+
SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows
24+
25+
SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%"
26+
IF %MAJOR_PYTHON_VERSION% == "2" (
27+
SET WINDOWS_SDK_VERSION="v7.0"
28+
) ELSE IF %MAJOR_PYTHON_VERSION% == "3" (
29+
SET WINDOWS_SDK_VERSION="v7.1"
30+
) ELSE (
31+
ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%"
32+
EXIT 1
33+
)
34+
35+
IF "%PYTHON_ARCH%"=="64" (
36+
ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture
37+
SET DISTUTILS_USE_SDK=1
38+
SET MSSdk=1
39+
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION%
40+
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release
41+
ECHO Executing: %COMMAND_TO_RUN%
42+
call %COMMAND_TO_RUN% || EXIT 1
43+
) ELSE (
44+
ECHO Using default MSVC build environment for 32 bit architecture
45+
ECHO Executing: %COMMAND_TO_RUN%
46+
call %COMMAND_TO_RUN% || EXIT 1
47+
)

0 commit comments

Comments
 (0)