forked from openlawlibrary/pygls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappveyor.yml
156 lines (129 loc) · 6.24 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
############################################################################
# Copyright(c) Open Law Library. All rights reserved. #
# See ThirdPartyNotices.txt in the project root for additional notices. #
# #
# Licensed under the Apache License, Version 2.0 (the "License") #
# you may not use this file except in compliance with the License. #
# You may obtain a copy of the License at #
# #
# http: // www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
############################################################################
configuration: Release
# Do not build feature branch with open Pull Requests
skip_branch_with_pr: true
# # uncomment to RDP at end of build ...
# on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
on_failure:
# if we have an npm log, show it
- ps: >-
if (Test-Path C:\Users\appveyor\AppData\Roaming\npm-cache\_logs\) {
cd C:\Users\appveyor\AppData\Roaming\npm-cache\_logs\
$fileobj = Get-ChildItem -Filter *.log | Select-Object -First 1;
if ($fileobj) { cat $fileobj; };
}
image:
- Visual Studio 2017
# Configure the GitHub username and email for accessing the `pygls` release
init:
- git config --global user.name %OLL_GIT_USER_NAME%
- git config --global user.email %OLL_GIT_EMAIL%
# Install scripts. (runs after repo cloning)
install:
- C:\Python35-x64\python.exe -m pip install --upgrade pip # upgrade pip
- ps: >-
$json_extension_client_json = (Get-Content -Raw -Path examples\json-extension\package.json | ConvertFrom-Json);
$prefixed_version = "v" + $json_extension_client_json.version;
# if we are building a tag, then replace the package version with the tag name
# else append the build number to the package version and save
$env:production_build = $True;
If ($env:APPVEYOR_REPO_TAG -eq "false") {
# append the build number to the client and server package versions
$env:production_build = $False;
$json_extension_client_json.version = $json_extension_client_json.version + "+" + $env:APPVEYOR_BUILD_NUMBER;
$prefixed_version = $prefixed_version + "+" + $env:APPVEYOR_BUILD_NUMBER;
} ElseIf ($env:APPVEYOR_REPO_TAG_NAME -ne $prefixed_version) {
# tag is present and tag name does not match package version, so exit
echo "Json-extension client version is $($json_extension_client_json.version)";
echo "You must update the json-extension client version, or change tag to $prefixed_version";
Exit-AppveyorBuild;
exit;
}
# update the package files so that vsce will pick up the altered version number
$json_extension_client_json | ConvertTo-Json -Depth 20 | Set-Content examples\json-extension\package.json;
# update it with Appveyor
# from this point on, version numbers should always include the "v" prefix
try {
Update-AppveyorBuild -Version $prefixed_version;
Set-AppveyorBuildVariable unprefixed_version $json_extension_client_json.version
} catch {
echo $PSItem.ToString();
echo "Cannot set Appveyor build version to $prefixed_version"
Exit-AppveyorBuild;
exit;
}
echo "APPVEYOR_BUILD_VERSION - $env:APPVEYOR_BUILD_VERSION";
# install pygls and dev dependencies
- C:\Python35-x64\Scripts\pip.exe install .[dev]
- C:\Python35-x64\Scripts\pip.exe install .[test]
- C:\Python35-x64\Scripts\pip.exe install -e .
# point to the same version as in `examples/json-extension/package.json`
- npm install -g [email protected]
- tsc --version
# install vsce module (for packaging our extension into a .vsix file)
- npm install -g [email protected]
# Output useful info for debugging.
- node --version
- npm --version
# Create a Visual Studio Code Extension
build_script:
- cd examples\json-extension
# install extension-wide js dependencies
- npm install --save-dev
# run tslint
- .\node_modules\.bin\tslint client\src\*.ts
# install our dependencies
- npm install # TODO: replace with `yarn install`
- tsc -p .
- cd ..\..\
test_script:
- C:\Python35-x64\Scripts\flake8.exe
- C:\Python35-x64\Scripts\bandit.exe -r ./pygls
- C:\Python35-x64\Scripts\pytest.exe
after_test:
# check function
- ps: >-
Function CheckInVsixPackage([string]$stringToCheck)
{
type packages.txt | findstr /R /C:$stringToCheck > results.txt
If ((Get-Content results.txt) -eq $Null) {
throw "'$stringToCheck' is missing from package to be built."
}
}
# package up the json-extension client example VS Code extension
- ps: cd examples/json-extension/
# check to see if key files will be in the `.vsix` package to be built
- vsce ls > packages.txt rem list files to be packaged
# files/folders to be checked
- ps: CheckInVsixPackage "package.json"
- ps: CheckInVsixPackage "out/extension.js"
- ps: CheckInVsixPackage "server/__init__.py"
- ps: CheckInVsixPackage "server/__main__.py"
- ps: CheckInVsixPackage "server/server.py"
# clean-up after ourselves (so these files don't end up in our `.vsix` package)
- rm packages.txt
- rm results.txt
# passed the basic checks, should be good-to-go
- vsce package rem "normal" command line is on purpose
- ps: cd ../
# Create extensions artifacts
artifacts:
- path: examples/json-extension/json-extension-$(unprefixed_version).vsix
name: json-extension-example-$(unprefixed_version).vsix
type: file