Skip to content

Commit 94151c9

Browse files
authored
Merge pull request #35 from xoviat/scintilla
Tests: enable build wrapper.
2 parents 6a0de4a + d7fd2e1 commit 94151c9

File tree

3 files changed

+58
-6
lines changed

3 files changed

+58
-6
lines changed

appveyor.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ matrix:
5252

5353
cache:
5454
# Cache downloaded pip packages.
55-
- "C:\\Users\\appveyor\\AppData\\Local\\pip"
55+
- "%LOCALAPPDATA%\\pip"
5656

5757
init:
5858
- "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"
@@ -82,7 +82,9 @@ install:
8282
) ELSE (
8383
%CMD_IN_ENV% pip install -U --disable-pip-version-check --timeout 5 --retries 2 -r tests/requirements-win.txt )"
8484

85-
- "%CMD_IN_ENV% python setup.py bdist_wheel"
85+
- "%CMD_IN_ENV% python tests/scripts/appveyor/fetch_wrapper.py"
86+
87+
- "%CMD_IN_ENV% build-wrapper-win-x86-64 --out-dir sonar python setup.py bdist_wheel"
8688
- "%CMD_IN_ENV% python tests/scripts/install_wheels.py dist"
8789

8890
build: none
@@ -94,9 +96,34 @@ test_script:
9496

9597
artifacts:
9698
- path: '**\*.whl'
99+
100+
on_success:
101+
# Remove old or huge cache files to hopefully not exceed the 1GB cache limit.
102+
#
103+
# If the cache limit is reached, the cache will not be updated (of not even
104+
# created in the first run). So this is a trade of between keeping the cache
105+
# current and having a cache at all.
106+
# NB: This is done only `on_success` since the cache in uploaded only on
107+
# success anyway.
108+
- C:\cygwin\bin\find "%LOCALAPPDATA%\pip" -type f -mtime +360 -delete
109+
- C:\cygwin\bin\find "%LOCALAPPDATA%\pip" -type f -size +10M -delete
110+
- C:\cygwin\bin\find "%LOCALAPPDATA%\pip" -empty -delete
111+
# Show size of cache
112+
- C:\cygwin\bin\du -hs "%LOCALAPPDATA%\pip\Cache"
97113

98114
on_finish:
99115
# - "python .\\tests\\scripts\\list_sitepackages.py"
100-
- ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\junit-results.xml))
101-
102-
- "sonar-scanner -Dsonar.projectKey=pywin32 -Dsonar.sources=. -Dsonar.host.url=https://sonarqube.com -Dsonar.login=%SONAR_TOKEN% -Dsonar.cfamily.build-wrapper-output.bypass=true"
116+
- ps: |
117+
(new-object net.webclient).UploadFile(
118+
"https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)",
119+
(Resolve-Path .\junit-results.xml)
120+
)
121+
- ps: |
122+
if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) {
123+
sonar-scanner `
124+
-Dsonar.projectKey=pywin32 `
125+
-Dsonar.sources=. `
126+
-Dsonar.host.url=https://sonarqube.com `
127+
-Dsonar.login=%SONAR_TOKEN% `
128+
-Dsonar.cfamily.build-wrapper-output=sonar
129+
}

tests/requirements-tools.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ pycmd # Contains 'py.cleanup' that removes all .pyc files and similar.
2424
codecov
2525
pytest-cov
2626
packaging
27-
cmdvars
27+
cmdvars
28+
requests
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import requests
2+
import zipfile
3+
import os
4+
import shutil
5+
6+
from io import BytesIO
7+
8+
URL = 'http://sonarqube.com/static/cpp/build-wrapper-win-x86.zip'
9+
DIR = 'C:\\ProgramData\\chocolatey\\bin'
10+
11+
request = requests.get(URL)
12+
zip_file = zipfile.ZipFile(BytesIO(request.content))
13+
14+
for member in zip_file.namelist():
15+
filename = os.path.basename(member)
16+
# skip directories
17+
if not filename:
18+
continue
19+
20+
# copy file (taken from zipfile's extract)
21+
source = zip_file.open(member)
22+
target = open(os.path.join(DIR, filename), "wb")
23+
with source, target:
24+
shutil.copyfileobj(source, target)

0 commit comments

Comments
 (0)