-
Notifications
You must be signed in to change notification settings - Fork 2
/
appveyor.yml
164 lines (126 loc) · 5.31 KB
/
appveyor.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
# whitelist branches to avoid testing feature branches twice (as branch and as pull request)
branches:
only:
- master
environment:
matrix:
# AppVeyor installed Python versions
# http://www.appveyor.com/docs/installed-software#python
- PYTHON_INSTALL: "C:\\Python35"
- PYTHON_INSTALL: "C:\\Python36"
install:
- appveyor DownloadFile "http://s3.amazonaws.com/downloads.northscale.com/memcached-win64-1.4.4-14.zip" -FileName memcached.zip
- 7z x memcached.zip -y
- ps: $Memcached = Start-Process memcached\memcached.exe -PassThru
# Make compiler available (use MSVC 2013, 32 bit)
- call "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86
# Check compiler version
- cl
# Prepend Python installation to PATH
- set PATH=%PYTHON_INSTALL%;%PATH%
# Prepend Python scripts to PATH (e.g. pip, py.test, pylint)
- set PATH=%PYTHON_INSTALL%\Scripts;%PATH%
# Check Python version
- python --version
# Upgrade the Python build tools
- python -m pip install --upgrade pip setuptools wheel
# Check pip version
- pip --version
# Install pytest
- pip install pytest
# Install mypy
- pip install mypy
# Install pylint (installs pylint.exe in %PYTHON_INSTALL%\Scripts)
- pip install pylint
- pylint --version
# Install coverage plugin for pytest
- pip install pytest-cov
# Install the package
- pip install .
# Install tool for uploading coverage data to codecov.io; select version
# 2.0.10 specifically since later versions seem to have a bug due to
# which calling 'codecov' in a PowerShell script fails.
- pip install https://github.com/codecov/codecov-python/tarball/v2.0.10
- coverage --version
# Install dependencies for clcachesrv such that we can lint the source code
- pip install -r server\requirements.txt
# Install pymemcache for memcache storage
- pip install pymemcache
cache:
- '%LOCALAPPDATA%\pip\Cache -> appveyor.yml'
- memcached -> appveyor.yml
build_script:
- clcache --help
- clcache -s
# - python clcachesrv.py
- pylint --rcfile=.pylintrc clcache\__main__.py
- pylint --rcfile=.pylintrc clcache\storage.py
- pylint --rcfile=.pylintrc tests\test_unit.py
- pylint --rcfile=.pylintrc --disable=no-member tests\test_integration.py
- pylint --rcfile=.pylintrc tests\test_performance.py
# Disable no-member test here to work around issue in Pylint 1.7.1
- pylint --rcfile=.pylintrc --disable=no-member clcache\server\__main__.py
- mypy --ignore-missing-imports .
test_script:
# Run test files via py.test and generate JUnit XML. Then push test results
# to appveyor. The plugin pytest-cov takes care of coverage.
- ps: |
& py.test --junitxml .\unittests.xml --cov
$testsExitCode = $lastexitcode
& coverage report
& coverage xml
$wc = New-Object 'System.Net.WebClient'
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\unittests.xml))
& codecov --no-color -X gcov -F unittests -e PYTHON_INSTALL -f coverage.xml
if ($testsExitCode -ne 0) {exit $testsExitCode}
- coverage erase
- del /Q coverage.xml
- set CLCACHE_MEMCACHED=127.0.0.1:11211
- ps: |
& py.test --junitxml .\integrationtests.xml --cov
$testsExitCode = $lastexitcode
& coverage report
& coverage xml
$wc = New-Object 'System.Net.WebClient'
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\integrationtests.xml))
& codecov --no-color -X gcov -F integrationtests_memcached -e PYTHON_INSTALL -f coverage.xml
if ($testsExitCode -ne 0) {exit $testsExitCode}
- coverage erase
- del /Q coverage.xml
- set "CLCACHE_MEMCACHED="
on_finish:
- ps: Stop-Process -Id $Memcached.Id
on_success:
# Creates executable with PyInstaller
- pip install pyinstaller pypiwin32
- pyinstaller pyinstaller\clcache_main.py
- for /F %%i in ('python -c "import clcache; print(clcache.VERSION)"') do set CLCACHE_VERSION=%%i
- "echo Version: %CLCACHE_VERSION"
- ps: mv dist\clcache_main\clcache_main.exe dist\clcache_main\clcache.exe
- move dist\clcache_main clcache-%CLCACHE_VERSION%
# Build the Chocolatey package
- sed -i "s/{VERSION}/%CLCACHE_VERSION%/g" clcache.nuspec
- choco pack
# Test the compiled extension
- cd clcache-%CLCACHE_VERSION%
- clcache.exe --help
- clcache.exe -s
- cd ..
# Test the chocolatey package
- ps: ls clcache.${env:CLCACHE_VERSION}.nupkg
- choco install "clcache.%CLCACHE_VERSION%.nupkg" --version=%CLCACHE_VERSION%
- C:\ProgramData\chocolatey\bin\clcache.exe --help
- C:\ProgramData\chocolatey\bin\clcache.exe -s
# Publish artifacts
- cd clcache-%CLCACHE_VERSION%
- 7z a -y clcache-%CLCACHE_VERSION%.zip
- move clcache-%CLCACHE_VERSION%.zip ..
- cd ..
- echo PYTHON_INSTALL=%PYTHON_INSTALL%
# Disable for Python 3.5, because of PyInstaller problems on older Windows
- if not [%PYTHON_INSTALL%]==["C:\Python35"] set PUBLISH=1
- sha256sum clcache.%CLCACHE_VERSION%.nupkg clcache-%CLCACHE_VERSION%.zip
- sha256sum clcache.%CLCACHE_VERSION%.nupkg clcache-%CLCACHE_VERSION%.zip > SHA256SUM
- if "%PUBLISH%"=="1" appveyor PushArtifact clcache.%CLCACHE_VERSION%.nupkg
- if "%PUBLISH%"=="1" appveyor PushArtifact clcache-%CLCACHE_VERSION%.zip
- if "%PUBLISH%"=="1" appveyor PushArtifact SHA256SUM