Add windows build
This commit is contained in:
16
.github/workflows/tests.yml
vendored
16
.github/workflows/tests.yml
vendored
@@ -4,24 +4,30 @@ on: [push]
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
env:
|
runs-on: ${{ matrix.os }}
|
||||||
CMAKE_VERSION: 3.14.7
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python: [3.6, 3.7, 3.8]
|
python: [3.6, 3.7, 3.8]
|
||||||
|
os: [ubuntu-18.04, windows-latest]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: Set up Python ${{ matrix.python }}
|
- name: Set up Python ${{ matrix.python }}
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v1
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python }}
|
python-version: ${{ matrix.python }}
|
||||||
|
- name: Setup VC
|
||||||
|
uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
if: contains(matrix.os, 'windows')
|
||||||
|
- name: Install CMake
|
||||||
|
if: contains(matrix.os, 'ubuntu')
|
||||||
|
run: |
|
||||||
|
CMAKE_VERSION=3.14.7
|
||||||
|
curl -sSL https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz | tar xz
|
||||||
|
sudo cp -rT cmake-$CMAKE_VERSION-Linux-x86_64 /usr/local
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
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 --upgrade setuptools pip wheel
|
||||||
python -m pip install poetry tox-gh-actions
|
python -m pip install poetry tox-gh-actions
|
||||||
- name: Test with tox
|
- name: Test with tox
|
||||||
run: |
|
run: |
|
||||||
export PATH=$GITHUB_WORKSPACE/cmake-$CMAKE_VERSION-Linux-x86_64/bin:$PATH
|
|
||||||
tox
|
tox
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class API(object):
|
|||||||
]
|
]
|
||||||
}''')
|
}''')
|
||||||
|
|
||||||
proc = subprocess.run([self._cmake, self._build],
|
proc = subprocess.run([self._cmake, str(self._build)],
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
@@ -131,7 +131,8 @@ foreach (variable ${variables})
|
|||||||
message("${variable}=${${variable}}")
|
message("${variable}=${${variable}}")
|
||||||
endforeach()
|
endforeach()
|
||||||
''')
|
''')
|
||||||
p = subprocess.run([self._cmake, '-P', tmplist],
|
p = subprocess.run(
|
||||||
|
[self._cmake, '-P', str(tmplist)],
|
||||||
cwd=cmake_files['paths']['source'],
|
cwd=cmake_files['paths']['source'],
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
|
|||||||
@@ -7,10 +7,16 @@ def cmake_build(shared_datadir):
|
|||||||
source = shared_datadir / 'cmake'
|
source = shared_datadir / 'cmake'
|
||||||
build = source / 'build'
|
build = source / 'build'
|
||||||
build.mkdir()
|
build.mkdir()
|
||||||
run(['cmake', source],
|
p = run(['cmake', str(source)],
|
||||||
check=True,
|
|
||||||
cwd=build,
|
cwd=build,
|
||||||
stdout=PIPE,
|
stdout=PIPE,
|
||||||
stderr=PIPE,
|
stderr=PIPE,
|
||||||
universal_newlines=True)
|
universal_newlines=True)
|
||||||
|
if p.returncode != 0:
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
logging.error(os.environ)
|
||||||
|
logging.error(p.stdout)
|
||||||
|
logging.error(p.stderr)
|
||||||
|
raise RuntimeError("CMake failed")
|
||||||
yield build
|
yield build
|
||||||
|
|||||||
@@ -35,7 +35,14 @@ def test_read_cmake_files(cmake_build):
|
|||||||
assert api.query()
|
assert api.query()
|
||||||
api.read_reply()
|
api.read_reply()
|
||||||
|
|
||||||
|
import platform
|
||||||
|
system = platform.system()
|
||||||
|
if system == 'Linux':
|
||||||
assert 'GNU' in api.get_variable_doc('CMAKE_CXX_COMPILER_ID')
|
assert 'GNU' in api.get_variable_doc('CMAKE_CXX_COMPILER_ID')
|
||||||
|
elif system == 'Windows':
|
||||||
|
assert 'MSVC' in api.get_variable_doc('CMAKE_CXX_COMPILER_ID')
|
||||||
|
else:
|
||||||
|
raise RuntimeError('Unexpected system')
|
||||||
|
|
||||||
|
|
||||||
def test_parse_commands(cmake_build):
|
def test_parse_commands(cmake_build):
|
||||||
|
|||||||
3
tox.ini
3
tox.ini
@@ -12,6 +12,7 @@ python =
|
|||||||
[testenv]
|
[testenv]
|
||||||
whitelist_externals = poetry
|
whitelist_externals = poetry
|
||||||
skip_install = true
|
skip_install = true
|
||||||
|
passenv = INCLUDE LIB LIBPATH
|
||||||
commands_pre =
|
commands_pre =
|
||||||
poetry install
|
poetry install
|
||||||
commands =
|
commands =
|
||||||
@@ -23,5 +24,5 @@ skip_install = true
|
|||||||
commands =
|
commands =
|
||||||
poetry run isort -c -rc src tests
|
poetry run isort -c -rc src tests
|
||||||
poetry run yapf -d -r src tests
|
poetry run yapf -d -r src tests
|
||||||
poetry run flake8
|
poetry run flake8 src tests
|
||||||
poetry run mypy src tests
|
poetry run mypy src tests
|
||||||
|
|||||||
Reference in New Issue
Block a user