Skip to content

Commit c1ae24b

Browse files
committed
Add support for AppVeyor hosted Windows CI.
See https://ci.appveyor.com/project/pymssql/pymssql It still has some rough edges but working+useful trumps perfect+living for months in a branch, particularly true for CI. Wheel and .exe installer artifacts are created on successful builds. Plan is to actually use AppVeyor to build the official pymssql Windows binaries. It includes building binaries for Python 3.5. The CI matrix builds, tests pymssql on Windows along the following axes: - x86 and x86_64 - Python 2.7, 3.3, 3.4, and 3.5 - SQL server 2008 R2 SP2 and 2012 SP1 The process generates JUnit XML files which are fed to AppVeyor so results can be browsed from the 'Tests' tab in AppVeyor's Web UI. The Python C/Cython extension uses experience and code by Olivier Grisel et al from https://github.com/ogrisel/python-appveyor-demo Thanks! The binaries link in DLL versions FreeTDS (currently 0.95) and OpenSSL (1.0.2d): * FreeTDS from https://github.com/ramiro/freetds/releases * OpenSSL from http://www.npcglib.org/~stathis/blog/precompiled-openssl/ Thanks also go to Feodor Fitsner from AppVeyor for installing the Microsoft Visual C++ Compiler for Python 2.7 on the worker VMs. Also, experience and code dealing with the platform, SQL Server, etc. were reused from what was learnt when implementing the AppVeyor Windows CI setup already contributed to the FreeTDS project.
1 parent 8c5f7e3 commit c1ae24b

15 files changed

Lines changed: 594 additions & 1393 deletions

appveyor.yml

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
# version format
2+
version: "{build}"
3+
4+
# Do not build on tags (GitHub only)
5+
skip_tags: false
6+
7+
shallow_clone: true
8+
9+
environment:
10+
11+
global:
12+
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
13+
# /E:ON and /V:ON options are not enabled in the batch script intepreter
14+
# See: http://stackoverflow.com/a/13751649/163740
15+
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd"
16+
OPENSSL_VER: 1.0.2d
17+
FREETDS_VER: 0.95.21
18+
19+
matrix:
20+
- PYTHON: "C:\\Python27"
21+
PYTHON_VERSION: "2.7.9"
22+
PYTHON_ARCH: "32"
23+
VS_VER: "2008"
24+
INSTANCENAME: "SQL2008R2SP2"
25+
26+
- PYTHON: "C:\\Python33"
27+
PYTHON_VERSION: "3.3.5"
28+
PYTHON_ARCH: "32"
29+
VS_VER: "2010"
30+
INSTANCENAME: "SQL2008R2SP2"
31+
32+
- PYTHON: "C:\\Python34"
33+
PYTHON_VERSION: "3.4.3"
34+
PYTHON_ARCH: "32"
35+
VS_VER: "2010"
36+
INSTANCENAME: "SQL2008R2SP2"
37+
38+
- PYTHON: "C:\\Python35"
39+
PYTHON_VERSION: "3.5.0"
40+
PYTHON_ARCH: "32"
41+
VS_VER: "2015"
42+
INSTANCENAME: "SQL2008R2SP2"
43+
44+
- PYTHON: "C:\\Python27-x64"
45+
PYTHON_VERSION: "2.7.9"
46+
PYTHON_ARCH: "64"
47+
VS_VER: "2008"
48+
INSTANCENAME: "SQL2008R2SP2"
49+
50+
- PYTHON: "C:\\Python33-x64"
51+
PYTHON_VERSION: "3.3.5"
52+
PYTHON_ARCH: "64"
53+
VS_VER: "2010"
54+
INSTANCENAME: "SQL2008R2SP2"
55+
56+
- PYTHON: "C:\\Python34-x64"
57+
PYTHON_VERSION: "3.4.3"
58+
PYTHON_ARCH: "64"
59+
VS_VER: "2010"
60+
INSTANCENAME: "SQL2008R2SP2"
61+
62+
- PYTHON: "C:\\Python35-x64"
63+
PYTHON_VERSION: "3.5.0"
64+
PYTHON_ARCH: "64"
65+
VS_VER: "2015"
66+
INSTANCENAME: "SQL2008R2SP2"
67+
68+
69+
- PYTHON: "C:\\Python27"
70+
PYTHON_VERSION: "2.7.9"
71+
PYTHON_ARCH: "32"
72+
VS_VER: "2008"
73+
INSTANCENAME: "SQL2012SP1"
74+
75+
- PYTHON: "C:\\Python33"
76+
PYTHON_VERSION: "3.3.5"
77+
PYTHON_ARCH: "32"
78+
VS_VER: "2010"
79+
INSTANCENAME: "SQL2012SP1"
80+
81+
- PYTHON: "C:\\Python34"
82+
PYTHON_VERSION: "3.4.3"
83+
PYTHON_ARCH: "32"
84+
VS_VER: "2010"
85+
INSTANCENAME: "SQL2012SP1"
86+
87+
- PYTHON: "C:\\Python35"
88+
PYTHON_VERSION: "3.5.0"
89+
PYTHON_ARCH: "32"
90+
VS_VER: "2015"
91+
INSTANCENAME: "SQL2012SP1"
92+
93+
- PYTHON: "C:\\Python27-x64"
94+
PYTHON_VERSION: "2.7.9"
95+
PYTHON_ARCH: "64"
96+
VS_VER: "2008"
97+
INSTANCENAME: "SQL2012SP1"
98+
99+
- PYTHON: "C:\\Python33-x64"
100+
PYTHON_VERSION: "3.3.5"
101+
PYTHON_ARCH: "64"
102+
VS_VER: "2010"
103+
INSTANCENAME: "SQL2012SP1"
104+
105+
- PYTHON: "C:\\Python34-x64"
106+
PYTHON_VERSION: "3.4.3"
107+
PYTHON_ARCH: "64"
108+
VS_VER: "2010"
109+
INSTANCENAME: "SQL2012SP1"
110+
111+
- PYTHON: "C:\\Python35-x64"
112+
PYTHON_VERSION: "3.5.0"
113+
PYTHON_ARCH: "64"
114+
VS_VER: "2015"
115+
INSTANCENAME: "SQL2012SP1"
116+
117+
install:
118+
# Install Python (from the official .msi of http://python.org) and pip when
119+
# not already installed.
120+
- "powershell appveyor\\install.ps1"
121+
122+
# Prepend current Python ans scripts dirs to the PATH of this build (this cannot be
123+
# done from inside the powershell script as it would require to restart
124+
# the parent CMD process).
125+
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
126+
127+
# Upgrade to the latest version of pip to avoid it displaying warnings
128+
# about it being out of date.
129+
- "pip install --disable-pip-version-check --user --upgrade pip"
130+
131+
# Install the build dependencies of the project. If some dependencies contain
132+
# compiled extensions and are not provided as pre-built wheel packages,
133+
# pip will build them from source using the MSVC compiler matching the
134+
# target Python version and architecture
135+
- "%CMD_IN_ENV% pip install -r dev-requirements.pip"
136+
- cmd: if %PYTHON_VERSION:~0,1% == 3 ( %CMD_IN_ENV% pip install gevent==1.1.b6 ) else ( %CMD_IN_ENV% pip install gevent )
137+
138+
before_build:
139+
# OpenSSL
140+
- appveyor DownloadFile http://www.npcglib.org/~stathis/downloads/openssl-%OPENSSL_VER%-vs%VS_VER%.7z || (ping -n 10 127.0.0.1 >"nul:" & appveyor DownloadFile http://www.npcglib.org/~stathis/downloads/openssl-%OPENSSL_VER%-vs%VS_VER%.7z)
141+
- 7z x openssl-%OPENSSL_VER%-vs%VS_VER%.7z
142+
- ren openssl-%OPENSSL_VER%-vs%VS_VER% openssl
143+
# FreeTDS
144+
- "rmdir /s /q freetds\\vs%VS_VER%_%PYTHON_ARCH% || cmd /c \"exit /b 0\""
145+
- appveyor DownloadFile https://github.com/ramiro/freetds/releases/download/v%FREETDS_VER%/vs%VS_VER%_%PYTHON_ARCH%.zip
146+
- 7z x -ofreetds vs%VS_VER%_%PYTHON_ARCH%.zip
147+
148+
build_script:
149+
- "%CMD_IN_ENV% python setup.py install"
150+
151+
before_test:
152+
- copy appveyor\tests.cfg tests\
153+
# Add relevant OpenSSL DLLs dir to PATH envvar
154+
- ps: |
155+
if ($env:PYTHON_ARCH -eq 32) {
156+
$env:PATH = $env:APPVEYOR_BUILD_FOLDER + "\openssl\bin;" + $env:PATH
157+
} else {
158+
$env:PATH = $env:APPVEYOR_BUILD_FOLDER + "\openssl\bin64;" + $env:PATH
159+
}
160+
# Add relevant FreeTDS DLLs dir to PATH envvar
161+
- set PATH=%CD%\freetds\vs%VS_VER%_%PYTHON_ARCH%\dynamic;%PATH%
162+
# Start, reconfigure and restart SQL Server
163+
- net start MSSQL$%INSTANCENAME%
164+
- "powershell appveyor\\sql-server-activate-tcp-fixed-port.ps1"
165+
166+
test_script:
167+
- "py.test --junitxml=junit.xml"
168+
169+
after_test:
170+
# Preserve tests results JUnit XML file
171+
- ps: |
172+
$url = "https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)"
173+
$file = '.\junit.xml'
174+
(New-Object 'System.Net.WebClient').UploadFile($url, (Resolve-Path $file))
175+
# If tests are successful, create binary packages for the project.
176+
- "%CMD_IN_ENV% python setup.py bdist_wheel"
177+
#- "%CMD_IN_ENV% python setup.py bdist_msi"
178+
- "%CMD_IN_ENV% python setup.py bdist_wininst"
179+
180+
artifacts:
181+
- path: dist\*.whl
182+
- path: dist\*.exe
183+
184+
#on_success:
185+
# - TODO: upload the content of dist/*.whl to a public wheelhouse

0 commit comments

Comments
 (0)