Merge pull request #8519 from magnesj/simplify-windows-env

Simplify GitHub Action and support windows-2022
This commit is contained in:
Magne Sjaastad
2022-02-04 08:45:38 +01:00
committed by GitHub
parent 2c0ebfd14c
commit 358c11264a
2 changed files with 12 additions and 40 deletions

View File

@@ -22,12 +22,10 @@ jobs:
config: config:
- { - {
name: "Windows Latest MSVC", name: "Windows Latest MSVC",
os: windows-2019, os: windows-latest,
cc: "cl", cxx: "cl", cc: "cl", cxx: "cl",
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
vcpkg-response-file: vcpkg_x64-windows.txt, vcpkg-response-file: vcpkg_x64-windows.txt,
vcpkg-triplet: x64-windows, vcpkg-triplet: x64-windows,
cmake-toolchain: 'ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake',
build-python-module: true, build-python-module: true,
execute-unit-tests: true execute-unit-tests: true
} }
@@ -37,7 +35,6 @@ jobs:
cc: "gcc", cxx: "g++", cc: "gcc", cxx: "g++",
vcpkg-response-file: vcpkg_x64-linux.txt, vcpkg-response-file: vcpkg_x64-linux.txt,
vcpkg-triplet: x64-linux, vcpkg-triplet: x64-linux,
cmake-toolchain: 'ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake',
build-python-module: true, build-python-module: true,
execute-unit-tests: true execute-unit-tests: true
} }
@@ -47,7 +44,6 @@ jobs:
cc: "clang", cxx: "clang++", cc: "clang", cxx: "clang++",
vcpkg-response-file: vcpkg_x64-linux.txt, vcpkg-response-file: vcpkg_x64-linux.txt,
vcpkg-triplet: x64-linux, vcpkg-triplet: x64-linux,
cmake-toolchain: 'ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake',
build-python-module: true, build-python-module: true,
execute-unit-tests: true execute-unit-tests: true
} }
@@ -57,7 +53,6 @@ jobs:
cc: "clang", cxx: "clang++", cc: "clang", cxx: "clang++",
vcpkg-response-file: vcpkg_x64-osx.txt, vcpkg-response-file: vcpkg_x64-osx.txt,
vcpkg-triplet: x64-osx, vcpkg-triplet: x64-osx,
cmake-toolchain: 'ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake',
build-python-module: false, build-python-module: false,
execute-unit-tests: false execute-unit-tests: false
} }
@@ -73,9 +68,12 @@ jobs:
- name: Display Python version - name: Display Python version
run: python -c "import sys; print(sys.version)" run: python -c "import sys; print(sys.version)"
# workaround a poor interaction between github actions/cmake/vcpkg, see https://github.com/lukka/run-vcpkg/issues/88#issuecomment-885758902 - name: Use CMake
- name: Use CMake 3.20.1 uses: lukka/get-cmake@latest
uses: lukka/get-cmake@v3.20.1
- name: Use MSVC (Windows)
if: matrix.config.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: Download buildcache - name: Download buildcache
id: buildcache-download id: buildcache-download
@@ -171,23 +169,6 @@ jobs:
run: | run: |
set(ENV{CC} ${{ matrix.config.cc }}) set(ENV{CC} ${{ matrix.config.cc }})
set(ENV{CXX} ${{ matrix.config.cxx }}) set(ENV{CXX} ${{ matrix.config.cxx }})
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
execute_process(
COMMAND "${{ matrix.config.environment_script }}" && set
OUTPUT_FILE environment_script_output.txt
)
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
set(path_separator ":")
if ("${{ runner.os }}" STREQUAL "Windows")
set(path_separator ";")
endif()
set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}")
execute_process( execute_process(
COMMAND cmake COMMAND cmake
@@ -201,7 +182,7 @@ jobs:
-D RESINSIGHT_ENABLE_GRPC=${{ matrix.config.build-python-module }} -D RESINSIGHT_ENABLE_GRPC=${{ matrix.config.build-python-module }}
-D RESINSIGHT_GRPC_PYTHON_EXECUTABLE=${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -D RESINSIGHT_GRPC_PYTHON_EXECUTABLE=${{ steps.python-path.outputs.PYTHON_EXECUTABLE }}
-D RESINSIGHT_GRPC_DOWNLOAD_PYTHON_MODULE=true -D RESINSIGHT_GRPC_DOWNLOAD_PYTHON_MODULE=true
-D CMAKE_TOOLCHAIN_FILE=${{ matrix.config.cmake-toolchain }} -D CMAKE_TOOLCHAIN_FILE=ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake
-G Ninja -G Ninja
RESULT_VARIABLE result RESULT_VARIABLE result
) )
@@ -212,18 +193,6 @@ jobs:
shell: cmake -P {0} shell: cmake -P {0}
run: | run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
set(path_separator ":")
if ("${{ runner.os }}" STREQUAL "Windows")
set(path_separator ";")
endif()
execute_process( execute_process(
COMMAND cmake --build cmakebuild --target install COMMAND cmake --build cmakebuild --target install
RESULT_VARIABLE result RESULT_VARIABLE result

View File

@@ -32,6 +32,7 @@
#include <QTextStream> #include <QTextStream>
#include <algorithm> #include <algorithm>
#include <cmath>
#include <numeric> #include <numeric>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -186,7 +187,9 @@ bool RifEclipseUserDataParserTools::isANumber( const std::string& line )
{ {
try try
{ {
std::stod( line ); auto value = std::stod( line );
if ( std::isinf( value ) || std::isnan( value ) ) return false;
return true;
} }
catch ( ... ) catch ( ... )
{ {