Merge branch 'setup-ci'
This commit is contained in:
35
.github/workflows/tests.yml
vendored
Normal file
35
.github/workflows/tests.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: Tests
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
env:
|
||||||
|
CMAKE_VERSION: 3.14.7
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-18.04]
|
||||||
|
python: [3.6, 3.7, 3.8]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Cache .tox
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: .tox
|
||||||
|
key: ${{ runner.OS }}-tox-${{ hashFiles('poetry.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.OS }}-tox-
|
||||||
|
- name: Set up Python ${{ matrix.python }}
|
||||||
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
curl -sSL https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz | tar xz
|
||||||
|
python -m pip install --upgrade setuptools pip wheel
|
||||||
|
python -m pip install poetry tox-gh-actions
|
||||||
|
- name: Test with tox
|
||||||
|
run: |
|
||||||
|
export PATH=$GITHUB_WORKSPACE/cmake-$CMAKE_VERSION-Linux-x86_64/bin:$PATH
|
||||||
|
tox
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
# cmake-language-server
|
# cmake-language-server
|
||||||
|
[](https://github.com/regen100/cmake-language-server/actions)
|
||||||
|
|
||||||
CMake LSP Implementation.
|
CMake LSP Implementation.
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,8 @@ class API(object):
|
|||||||
|
|
||||||
proc = subprocess.run([self._cmake, self._build],
|
proc = subprocess.run([self._cmake, self._build],
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
capture_output=True)
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE)
|
||||||
self.query_json.unlink()
|
self.query_json.unlink()
|
||||||
self.query_json.parent.rmdir()
|
self.query_json.parent.rmdir()
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
@@ -133,7 +134,8 @@ endforeach()
|
|||||||
p = subprocess.run([self._cmake, '-P', tmplist],
|
p = subprocess.run([self._cmake, '-P', tmplist],
|
||||||
cwd=cmake_files['paths']['source'],
|
cwd=cmake_files['paths']['source'],
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
capture_output=True)
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE)
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,16 @@
|
|||||||
import logging
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture()
|
@pytest.fixture()
|
||||||
def cmake_build(shared_datadir):
|
def cmake_build(shared_datadir):
|
||||||
from subprocess import run
|
from subprocess import run, PIPE
|
||||||
source = shared_datadir / 'cmake'
|
source = shared_datadir / 'cmake'
|
||||||
build = source / 'build'
|
build = source / 'build'
|
||||||
build.mkdir()
|
build.mkdir()
|
||||||
p = run(['cmake', '-S', source, '-B', build],
|
run(['cmake', source],
|
||||||
check=True,
|
check=True,
|
||||||
capture_output=True,
|
cwd=build,
|
||||||
universal_newlines=True)
|
stdout=PIPE,
|
||||||
logging.debug(p.stdout)
|
stderr=PIPE,
|
||||||
logging.debug(p.stderr)
|
universal_newlines=True)
|
||||||
yield build
|
yield build
|
||||||
|
|||||||
@@ -43,8 +43,9 @@ def test_parse_commands(cmake_build):
|
|||||||
api.parse_doc()
|
api.parse_doc()
|
||||||
|
|
||||||
p = subprocess.run(['cmake', '--help-command-list'],
|
p = subprocess.run(['cmake', '--help-command-list'],
|
||||||
capture_output=True,
|
universal_newlines=True,
|
||||||
universal_newlines=True)
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE)
|
||||||
commands = p.stdout.strip().split('\n')
|
commands = p.stdout.strip().split('\n')
|
||||||
|
|
||||||
for command in commands:
|
for command in commands:
|
||||||
@@ -59,8 +60,9 @@ def test_parse_variables(cmake_build):
|
|||||||
api.parse_doc()
|
api.parse_doc()
|
||||||
|
|
||||||
p = subprocess.run(['cmake', '--help-variable-list'],
|
p = subprocess.run(['cmake', '--help-variable-list'],
|
||||||
capture_output=True,
|
universal_newlines=True,
|
||||||
universal_newlines=True)
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE)
|
||||||
variables = p.stdout.strip().split('\n')
|
variables = p.stdout.strip().split('\n')
|
||||||
|
|
||||||
for variable in variables:
|
for variable in variables:
|
||||||
|
|||||||
6
tox.ini
6
tox.ini
@@ -3,6 +3,12 @@ isolated_build = True
|
|||||||
skipsdist = True
|
skipsdist = True
|
||||||
envlist = py36, py37, py38, lint
|
envlist = py36, py37, py38, lint
|
||||||
|
|
||||||
|
[gh-actions]
|
||||||
|
python =
|
||||||
|
3.6: py36
|
||||||
|
3.7: py37, lint
|
||||||
|
3.8: py38
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
whitelist_externals = poetry
|
whitelist_externals = poetry
|
||||||
skip_install = true
|
skip_install = true
|
||||||
|
|||||||
Reference in New Issue
Block a user