Skip to content

Commit

Permalink
Merge pull request #100 from perrinjerome/feat/appveyor_matrix
Browse files Browse the repository at this point in the history
Run tests and linters on multiple python versions and on linux
  • Loading branch information
danixeee authored Feb 12, 2020
2 parents cddfa13 + e99ef92 commit 3728b42
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 35 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include *.md *.txt *.ini **/py.typed
86 changes: 51 additions & 35 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,31 @@ on_failure:
if ($fileobj) { cat $fileobj; };
}
image:
- Visual Studio 2017
stack: python %PYTHON%

environment:
APPVEYOR_YML_DISABLE_PS_LINUX: true
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu
PYTHON: "3.5"
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu
PYTHON: "3.6"
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu
PYTHON: "3.7"
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu
PYTHON: "3.8"
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
PYTHON: "3.5"
PATH: C:\Python35-x64;C:\Python35-x64\Scripts\;%PATH%
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
PYTHON: "3.6"
PATH: C:\Python36-x64;C:\Python36-x64\Scripts\;%PATH%
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
PYTHON: "3.7"
PATH: C:\Python37-x64;C:\Python37-x64\Scripts\;%PATH%
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
PYTHON: "3.8"
PATH: C:\Python38-x64;C:\Python38-x64\Scripts\;%PATH%

# Configure the GitHub username and email for accessing the `pygls` release
init:
Expand All @@ -42,8 +65,23 @@ init:

# Install scripts. (runs after repo cloning)
install:
- C:\Python35-x64\python.exe -m pip install --upgrade pip # upgrade pip
- python -m pip install --upgrade pip
- pip install tox

# point to the same version as in `examples/json-extension/package.json`
- npm install -g typescript@3.5.2
- tsc --version

# install vsce module (for packaging our extension into a .vsix file)
- npm install -g vsce@1.63.0

# Output useful info for debugging.
- node --version
- npm --version
- python --version

# Create a Visual Studio Code Extension (only on windows)
build_script:
- ps: >-
$json_extension_client_json = (Get-Content -Raw -Path examples\json-extension\package.json | ConvertFrom-Json);
$prefixed_version = "v" + $json_extension_client_json.version;
Expand Down Expand Up @@ -86,39 +124,18 @@ install:
}
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 typescript@3.5.2
- tsc --version

# install vsce module (for packaging our extension into a .vsix file)
- npm install -g vsce@1.63.0

# Output useful info for debugging.
- node --version
- npm --version

# Create a Visual Studio Code Extension
build_script:
- cd examples\json-extension
- cd examples/json-extension
# install extension-wide js dependencies
- npm install --save-dev
# run tslint
- .\node_modules\.bin\tslint client\src\*.ts
- ./node_modules/.bin/tslint client/src/*.ts
# install our dependencies
- npm install # TODO: replace with `yarn install`
- npm install # TODO: replace with `yarn install`
- tsc -p .

- cd ..\..\
- cd ../../

test_script:
- C:\Python35-x64\Scripts\flake8.exe
- C:\Python35-x64\Scripts\bandit.exe -r ./pygls
- C:\Python35-x64\Scripts\pytest.exe
- tox -e py

after_test:
# check function
Expand All @@ -132,9 +149,9 @@ after_test:
}
# package up the json-extension client example VS Code extension
- ps: cd examples/json-extension/
- 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
- vsce ls > packages.txt
# files/folders to be checked
- ps: CheckInVsixPackage "package.json"
- ps: CheckInVsixPackage "out/extension.js"
Expand All @@ -143,11 +160,10 @@ after_test:
- 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
- ps: rm results.txt
# passed the basic checks, should be good-to-go
- vsce package rem "normal" command line is on purpose

- ps: cd ../
- vsce package
- cd ..

# Create extensions artifacts
artifacts:
Expand Down
83 changes: 83 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
############################################################################
# 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. #
############################################################################

strategy:
matrix:
Python3.5 on linux:
python.version: "3.5"
imageName: "ubuntu-18.04"
Python3.6 on linux:
python.version: "3.6"
imageName: "ubuntu-18.04"
Python3.7 on linux:
python.version: "3.7"
imageName: "ubuntu-18.04"
Python3.8 on linux:
python.version: "3.8"
imageName: "ubuntu-18.04"
Python3.5 on windows:
python.version: "3.5"
imageName: "windows-2019"
Python3.6 on windows:
python.version: "3.6"
imageName: "windows-2019"
Python3.7 on windows:
python.version: "3.7"
imageName: "windows-2019"
Python3.8 on windows:
python.version: "3.8"
imageName: "windows-2019"

pool:
vmImage: $(imageName)

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: "$(python.version)"
displayName: "Use Python $(python.version)"

- script: |
python -m pip install --upgrade pip tox setuptools
displayName: "Install python dependencies"
- script: tox -e py
displayName: "tox"

- bash: |
cd examples/json-extension
# install extension-wide js dependencies
npm install --save-dev
# run tslint
npx tslint client/src/*.ts
# install our dependencies
npm install # TODO: replace with `yarn install`
npm run compile
# check to see if key files will be in the `.vsix` package to be built
npx vsce ls | grep package.json
npx vsce ls | grep out/extension.js
npx vsce ls | grep server/__init__.py
npx vsce ls | grep server/__main__.py
npx vsce ls | grep server/server.py
displayName: "build and check sample extension"
- script: |
python --version
node --version
npm --version
displayName: "Output versions for debugging"
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[flake8]
max-line-length = 99

[mypy]
ignore_missing_imports = True
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
development = [
"bandit==1.6.0", # Run locally: bandit -r ./pygls
"flake8==3.7.7", # Run locally: flake8
"mypy==0.761", # Run locally: mypy .
]

docs_require = [
Expand Down
13 changes: 13 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tox]
envlist = py{35,36,37,38}

[testenv]
extras =
test
dev
commands =
pytest
bandit -r pygls
flake8
mypy .

0 comments on commit 3728b42

Please sign in to comment.