mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add a GitHub action to test manual build paths (no VCPKG toolchain)
This commit is contained in:
parent
7a2d388097
commit
2a2598e503
192
.github/workflows/ResInsightWithCacheManualPaths.yml
vendored
Normal file
192
.github/workflows/ResInsightWithCacheManualPaths.yml
vendored
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
name: ResInsight Manual gRPC Paths
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
env:
|
||||||
|
NINJA_VERSION: 1.9.0
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
BUILDCACHE_VERSION: 0.18.0
|
||||||
|
BUILDCACHE_DIR: ${{ github.workspace }}/buildcache_dir
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ResInsight-x64-buildcache:
|
||||||
|
runs-on: ${{ matrix.config.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
config:
|
||||||
|
- {
|
||||||
|
name: "Ubuntu 20.04",
|
||||||
|
os: ubuntu-20.04,
|
||||||
|
cc: "gcc", cxx: "g++",
|
||||||
|
}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.8'
|
||||||
|
- name: Display Python version
|
||||||
|
run: python -c "import sys; print(sys.version)"
|
||||||
|
- name: Download Ninja
|
||||||
|
uses: seanmiddleditch/gha-setup-ninja@master
|
||||||
|
with:
|
||||||
|
version: ${{ env.NINJA_VERSION }}
|
||||||
|
- name: Download buildcache
|
||||||
|
id: buildcache-download
|
||||||
|
shell: cmake -P {0}
|
||||||
|
run: |
|
||||||
|
if ("${{ runner.os }}" STREQUAL "Windows")
|
||||||
|
set(buildcache_suffix "win-msvc.zip")
|
||||||
|
elseif ("${{ runner.os }}" STREQUAL "Linux")
|
||||||
|
set(buildcache_suffix "linux.zip")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(buildcache_version $ENV{BUILDCACHE_VERSION})
|
||||||
|
set(buildcache_url "https://github.com/mbitsnbites/buildcache/releases/download/v${buildcache_version}/buildcache-${buildcache_suffix}")
|
||||||
|
file(DOWNLOAD "${buildcache_url}" ./buildcache.zip)
|
||||||
|
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./buildcache.zip)
|
||||||
|
|
||||||
|
if (NOT "${{ runner.os }}" STREQUAL "Windows")
|
||||||
|
execute_process(
|
||||||
|
COMMAND chmod +x bin/buildcache
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
- name: Prepare cache timestamp
|
||||||
|
id: cache_timestamp_string
|
||||||
|
shell: cmake -P {0}
|
||||||
|
run: |
|
||||||
|
string(TIMESTAMP current_date "%Y-%m-%d" UTC)
|
||||||
|
message("::set-output name=timestamp::${current_date}")
|
||||||
|
- name: Cache Buildcache
|
||||||
|
id: cache-buildcache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ env.BUILDCACHE_DIR }}
|
||||||
|
key: ${{ matrix.config.name }}-manual-paths-cache-v02-${{ steps.cache_timestamp_string.outputs.timestamp }}
|
||||||
|
- name: Create Folder for buildcache
|
||||||
|
run: New-Item ${{ env.BUILDCACHE_DIR }} -ItemType "directory" -Force
|
||||||
|
shell: pwsh
|
||||||
|
- name: Add buildcache to system path
|
||||||
|
run: echo "::add-path::${{ github.workspace }}/bin"
|
||||||
|
|
||||||
|
- name: Cache Qt
|
||||||
|
id: cache-qt
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ github.workspace }}/Qt/
|
||||||
|
key: ${{ matrix.config.os }}-QtCache-v02
|
||||||
|
- name: Install Qt
|
||||||
|
uses: jurplel/install-qt-action@v2
|
||||||
|
with:
|
||||||
|
version: 5.9.9
|
||||||
|
modules: qtscript
|
||||||
|
dir: '${{ github.workspace }}/Qt/'
|
||||||
|
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
||||||
|
- name: Install Linux dependencies
|
||||||
|
if: "contains( matrix.config.os, 'ubuntu')"
|
||||||
|
run: sudo apt-get install libxkbcommon-x11-0 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev libhdf5-dev libboost-filesystem-dev libeigen3-dev
|
||||||
|
- name: Cache vcpkg artifacts
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ github.workspace }}/ThirdParty/vcpkg/
|
||||||
|
# Ensure the cache is invalidated any time vcpkg version changes, or a different set of packages is being used.
|
||||||
|
key: ${{ hashFiles('.git/modules/ThirdParty/vcpkg/HEAD') }}-${{ runner.os }}-vcpkg-v04
|
||||||
|
- name: Get Python executable path
|
||||||
|
id: python-path
|
||||||
|
run: echo "::set-output name=PYTHON_EXECUTABLE::$(python -c 'import sys; import pathlib; print (pathlib.PurePath(sys.executable).as_posix())')"
|
||||||
|
- name: Print Python path
|
||||||
|
run: echo ${{ steps.python-path.outputs.PYTHON_EXECUTABLE }}
|
||||||
|
- name: Setup vcpkg
|
||||||
|
uses: lukka/run-vcpkg@v5
|
||||||
|
id: runvcpkg
|
||||||
|
with:
|
||||||
|
vcpkgDirectory: '${{ github.workspace }}/ThirdParty/vcpkg'
|
||||||
|
setupOnly: true
|
||||||
|
- name: Run vcpkg
|
||||||
|
shell: bash
|
||||||
|
run: $VCPKG_ROOT/vcpkg install grpc:x64-linux
|
||||||
|
- name: Configure
|
||||||
|
shell: cmake -P {0}
|
||||||
|
run: |
|
||||||
|
set(ENV{CC} ${{ matrix.config.cc }})
|
||||||
|
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(
|
||||||
|
COMMAND cmake
|
||||||
|
-S .
|
||||||
|
-B cmakebuild
|
||||||
|
-D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE}
|
||||||
|
-D CMAKE_INSTALL_PREFIX=cmakebuild/install
|
||||||
|
-D RESINSIGHT_ENABLE_UNITY_BUILD=true
|
||||||
|
-D RESINSIGHT_BUNDLE_OPENSSL=true
|
||||||
|
-D RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true
|
||||||
|
-D RESINSIGHT_TREAT_WARNINGS_AS_ERRORS=true
|
||||||
|
-D RESINSIGHT_ENABLE_GRPC=true
|
||||||
|
-D RESINSIGHT_GRPC_INSTALL_PREFIX=${{ github.workspace }}/ThirdParty/vcpkg/installed/x64-linux
|
||||||
|
-D RESINSIGHT_GRPC_PYTHON_EXECUTABLE=${{ steps.python-path.outputs.PYTHON_EXECUTABLE }}
|
||||||
|
-D RESINSIGHT_GRPC_DOWNLOAD_PYTHON_MODULE=false
|
||||||
|
-D VCPKG_AUTO_INSTALL=false
|
||||||
|
-G Ninja
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
)
|
||||||
|
if (NOT result EQUAL 0)
|
||||||
|
message(FATAL_ERROR "Bad exit status")
|
||||||
|
endif()
|
||||||
|
- name: Build
|
||||||
|
shell: cmake -P {0}
|
||||||
|
run: |
|
||||||
|
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(
|
||||||
|
COMMAND cmake --build cmakebuild --target install
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
)
|
||||||
|
if (NOT result EQUAL 0)
|
||||||
|
message(FATAL_ERROR "Bad exit status")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
- name: Stats for buildcache
|
||||||
|
run: ${{ github.workspace }}/bin/buildcache -s
|
||||||
|
|
||||||
|
- name: (Linux) Run Unit Tests
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cmakebuild/ApplicationCode/ResInsight --unittest
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: ResInsight-manual-${{ matrix.config.name }}
|
||||||
|
path: ${{ runner.workspace }}/ResInsight/cmakebuild/install
|
@ -260,7 +260,6 @@ add_library(
|
|||||||
if(RESINSIGHT_GRPC_INSTALL_PREFIX)
|
if(RESINSIGHT_GRPC_INSTALL_PREFIX)
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE ${GRPC_INCLUDE_DIRS})
|
target_include_directories(${PROJECT_NAME} PRIVATE ${GRPC_INCLUDE_DIRS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} ${LINK_LIBRARIES})
|
target_link_libraries(${PROJECT_NAME} ${LINK_LIBRARIES})
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
Loading…
Reference in New Issue
Block a user