This repository has been archived by the owner on Dec 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathappveyor.yml
116 lines (100 loc) · 4.27 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
version: 0.0.0.{build}
image: Visual Studio 2017
environment:
matrix:
- MBITS: 32
PYTHON_VERSION: 37
MSVC_VERSION: 15
DEPLOY: 1
install:
# configure variables
- ps: |
if ($env:MBITS -eq "32") {
echo "Architecture set to 32 bit."
$env:PYTHON_PATH="C:/Python$env:PYTHON_VERSION"
$env:CMAKE_GENERATOR="Visual Studio $env:MSVC_VERSION"
} elseif ($env:MBITS -eq "64") {
echo "Architecture set to 64 bit."
$env:PYTHON_PATH="C:/Python$env:PYTHON_VERSION-x64"
$env:CMAKE_GENERATOR="Visual Studio $env:MSVC_VERSION Win64"
} else {
echo "No architecture set. Build will be canceled."
}
- SET PIP_PATH=%PYTHON_PATH%/Scripts
- SET PATH=%PYTHON_PATH%;%PIP_PATH%;%PATH%
# install python dependencies
- cmd: pip install -r requirements.txt
# prepare for SourcetrailDB build
- cmd: git submodule init
- cmd: git submodule update
# Install SWIG by Choco
- ps: choco install -y --no-progress swig --version 4.0.1
before_build:
- ps: $env:PACKAGE_VERSION = python -c "from _version import __version__; print(__version__.replace('.', '_'))"
- ps: echo "Package version is $env:PACKAGE_VERSION"
- ps: $env:MAJOR_VERSION = $env:PACKAGE_VERSION.Split("_")[0].TrimStart("v")
- ps: echo "Major version is $env:MAJOR_VERSION"
- ps: $env:DATABASE_VERSION = $env:PACKAGE_VERSION.Split("_")[1].TrimStart("db")
- ps: echo "Database version is $env:DATABASE_VERSION"
- ps: $env:PATCH_VERSION = $env:PACKAGE_VERSION.Split("_")[2].TrimStart("p")
- ps: echo "Patch version is $env:PATCH_VERSION"
- ps: $env:BUILD_VERSION = $env:MAJOR_VERSION + "." + $env:DATABASE_VERSION + "." + $env:PATCH_VERSION + "." + $env:APPVEYOR_BUILD_NUMBER
- ps: echo "update build version to $env:BUILD_VERSION"
- ps: Update-AppveyorBuild -Version $env:BUILD_VERSION
build_script:
- cd SourcetrailDB
- mkdir build
- cd build
- cmake -G "%CMAKE_GENERATOR%" ../ -DBUILD_BINDINGS_PYTHON=ON -DPYTHON_LIBRARY="%PYTHON_PATH%/libs/python%PYTHON_VERSION%.lib"
- msbuild /p:configuration=Release /v:m ALL_BUILD.vcxproj
- cd ..
- cd ..
- ps: |
copy SourcetrailDB/build/bindings_python/sourcetraildb.py ./
copy SourcetrailDB/build/bindings_python/Release/_sourcetraildb.pyd ./
after_build:
- cmd: pyinstaller freezing.spec
- ps: $env:PACKAGE_NAME = 'SourcetrailPythonIndexer_' + $env:PACKAGE_VERSION + '-windows'
- ps: echo $env:PACKAGE_NAME
- mkdir artifacts
- cd artifacts
- mkdir %PACKAGE_NAME%
- cd %PACKAGE_NAME%
- mkdir license
- cd license
- mkdir 3rd_party_licenses
- cd ..
- cd ..
- cd ..
- ps: Copy-Item -Path dist/SourcetrailPythonIndexer/* -Recurse -Destination artifacts/$env:PACKAGE_NAME
- ps: copy LICENSE.txt artifacts/$env:PACKAGE_NAME/license/
- ps: copy SourcetrailDB/LICENSE.txt artifacts/$env:PACKAGE_NAME/license/3rd_party_licenses/license_sourcetraildb.txt
- ps: copy SourcetrailDB/external/cpp_sqlite/license_cpp_sqlite.txt artifacts/$env:PACKAGE_NAME/license/3rd_party_licenses/
- ps: copy SourcetrailDB/external/json/license_json.txt artifacts/$env:PACKAGE_NAME/license/3rd_party_licenses/
- ps: |
$env:ARTIFACTY_TO_DEPLOY = ""
if ($env:DEPLOY -eq "1") {
$env:ARTIFACTY_TO_DEPLOY = $env:PACKAGE_NAME
}
echo $env:ARTIFACTY_TO_DEPLOY
test_script:
- cmd: python test.py
- cmd: python test_shallow.py
- ps: $env:SOURCETRAIL_DB_DATABASE_VERSION = python -c "import sourcetraildb; print(sourcetraildb.getSupportedDatabaseVersion())"
- ps: |
if ($env:SOURCETRAIL_DB_DATABASE_VERSION -eq $env:DATABASE_VERSION) {
echo "SourcetrailPythonIndexer matches SourcetrailDB's database version."
} else {
throw "SourcetrailPythonIndexer db version ($env:DATABASE_VERSION) and SourcetrailDB db version ($env:SOURCETRAIL_DB_DATABASE_VERSION) do not match."
}
artifacts:
- path: artifacts
name: $(PACKAGE_NAME)
type: Zip
deploy:
provider: GitHub
artifact: $(ARTIFACTY_TO_DEPLOY)
auth_token:
secure: MB2DqEW2eCwgCYtz/5BEn18XweV4eU760lzt7zpZ9fGEU5mxxhh79FLzK8Ux++09
on:
appveyor_repo_tag: true