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:
|
||||
build:
|
||||
env:
|
||||
CMAKE_VERSION: 3.14.7
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
python: [3.6, 3.7, 3.8]
|
||||
os: [ubuntu-18.04, windows-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Set up Python ${{ matrix.python }}
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
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
|
||||
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
|
||||
|
||||
@@ -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,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
@@ -131,11 +131,12 @@ foreach (variable ${variables})
|
||||
message("${variable}=${${variable}}")
|
||||
endforeach()
|
||||
''')
|
||||
p = subprocess.run([self._cmake, '-P', tmplist],
|
||||
cwd=cmake_files['paths']['source'],
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
p = subprocess.run(
|
||||
[self._cmake, '-P', str(tmplist)],
|
||||
cwd=cmake_files['paths']['source'],
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
if p.returncode != 0:
|
||||
return
|
||||
|
||||
|
||||
@@ -7,10 +7,16 @@ def cmake_build(shared_datadir):
|
||||
source = shared_datadir / 'cmake'
|
||||
build = source / 'build'
|
||||
build.mkdir()
|
||||
run(['cmake', source],
|
||||
check=True,
|
||||
cwd=build,
|
||||
stdout=PIPE,
|
||||
stderr=PIPE,
|
||||
universal_newlines=True)
|
||||
p = run(['cmake', str(source)],
|
||||
cwd=build,
|
||||
stdout=PIPE,
|
||||
stderr=PIPE,
|
||||
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
|
||||
|
||||
@@ -35,7 +35,14 @@ def test_read_cmake_files(cmake_build):
|
||||
assert api.query()
|
||||
api.read_reply()
|
||||
|
||||
assert 'GNU' in api.get_variable_doc('CMAKE_CXX_COMPILER_ID')
|
||||
import platform
|
||||
system = platform.system()
|
||||
if system == 'Linux':
|
||||
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):
|
||||
|
||||
3
tox.ini
3
tox.ini
@@ -12,6 +12,7 @@ python =
|
||||
[testenv]
|
||||
whitelist_externals = poetry
|
||||
skip_install = true
|
||||
passenv = INCLUDE LIB LIBPATH
|
||||
commands_pre =
|
||||
poetry install
|
||||
commands =
|
||||
@@ -23,5 +24,5 @@ skip_install = true
|
||||
commands =
|
||||
poetry run isort -c -rc src tests
|
||||
poetry run yapf -d -r src tests
|
||||
poetry run flake8
|
||||
poetry run flake8 src tests
|
||||
poetry run mypy src tests
|
||||
|
||||
Reference in New Issue
Block a user