2020-05-08 02:38:44 -05:00
|
|
|
name: ResInsight Build With Cache
|
2020-05-08 00:25:03 -05:00
|
|
|
|
2020-06-07 12:38:30 -05:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
schedule:
|
|
|
|
# Every day at 1am to make sure we have a build cache for the current data
|
|
|
|
# build cache is
|
|
|
|
- cron: '0 1 * * * '
|
2020-05-08 00:25:03 -05:00
|
|
|
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: "Windows Latest MSVC",
|
|
|
|
os: windows-latest,
|
|
|
|
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-triplet: x64-windows,
|
|
|
|
cmake-toolchain: 'vcpkg/scripts/buildsystems/vcpkg.cmake'
|
|
|
|
}
|
|
|
|
- {
|
|
|
|
name: "Ubuntu Latest GCC",
|
|
|
|
os: ubuntu-latest,
|
|
|
|
cc: "gcc", cxx: "g++",
|
|
|
|
vcpkg-response-file: vcpkg_x64-linux.txt,
|
|
|
|
vcpkg-triplet: x64-linux,
|
|
|
|
cmake-toolchain: 'vcpkg/scripts/buildsystems/vcpkg.cmake'
|
|
|
|
}
|
2020-06-03 01:08:35 -05:00
|
|
|
- {
|
|
|
|
name: "Ubuntu 20.04",
|
|
|
|
os: ubuntu-20.04,
|
|
|
|
cc: "gcc", cxx: "g++",
|
|
|
|
vcpkg-response-file: vcpkg_x64-linux.txt,
|
|
|
|
vcpkg-triplet: x64-linux,
|
|
|
|
cmake-toolchain: 'vcpkg/scripts/buildsystems/vcpkg.cmake'
|
|
|
|
}
|
2020-05-08 00:25:03 -05:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v1
|
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
- 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: |
|
2020-05-19 06:04:19 -05:00
|
|
|
string(TIMESTAMP current_date "%Y-%m-%d" UTC)
|
2020-05-08 00:25:03 -05:00
|
|
|
message("::set-output name=timestamp::${current_date}")
|
|
|
|
- name: Cache Buildcache
|
|
|
|
id: cache-buildcache
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ${{ env.BUILDCACHE_DIR }}
|
2020-05-21 11:35:44 -05:00
|
|
|
key: ${{ matrix.config.name }}-cache-v01-${{ steps.cache_timestamp_string.outputs.timestamp }}
|
2020-05-08 00:25:03 -05:00
|
|
|
- name: Create Folder for buildcache
|
2020-05-08 02:38:44 -05:00
|
|
|
run: New-Item ${{ env.BUILDCACHE_DIR }} -ItemType "directory" -Force
|
|
|
|
shell: pwsh
|
2020-05-08 00:25:03 -05:00
|
|
|
- name: Add buildcache to system path
|
|
|
|
run: echo "::add-path::${{ github.workspace }}/bin"
|
|
|
|
|
|
|
|
- name: Cache Qt
|
|
|
|
id: cache-qt
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ../Qt
|
|
|
|
key: ${{ runner.os }}-QtCache
|
|
|
|
- name: Install Qt
|
|
|
|
uses: jurplel/install-qt-action@v2
|
|
|
|
with:
|
|
|
|
version: 5.9.9
|
|
|
|
modules: qtscript
|
|
|
|
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
|
|
|
- name: Install Python dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install grpcio-tools
|
|
|
|
pip install pytest
|
|
|
|
- name: Install Linux dependencies
|
|
|
|
if: "contains( matrix.config.os, 'ubuntu')"
|
2020-05-28 02:49:04 -05:00
|
|
|
run: sudo apt-get install libxkbcommon-x11-0 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev libhdf5-dev
|
2020-05-08 00:25:03 -05:00
|
|
|
- name: Cache vcpkg artifacts
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ${{ github.workspace }}/vcpkg/
|
|
|
|
# Ensure the cache is invalidated any time vcpkg version changes, or a different set of packages is being used.
|
|
|
|
key: ${{ hashFiles( format('{0}/{1}', github.workspace, matrix.config.vcpkg-response-file )) }}-${{ hashFiles('.git/modules/vcpkg/HEAD') }}-${{ runner.os }}
|
|
|
|
- name: Run vcpkg
|
|
|
|
uses: lukka/run-vcpkg@v1
|
|
|
|
id: runvcpkg
|
|
|
|
with:
|
|
|
|
vcpkgArguments: '@${{ github.workspace }}/${{ matrix.config.vcpkg-response-file }}'
|
|
|
|
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
|
|
|
|
- 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}
|
2020-05-29 01:00:03 -05:00
|
|
|
-D GSL_ENABLE=true
|
2020-05-08 00:25:03 -05:00
|
|
|
-D RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true
|
2020-06-03 07:34:35 -05:00
|
|
|
-D RESINSIGHT_TREAT_WARNINGS_AS_ERRORS=true
|
2020-05-08 00:25:03 -05:00
|
|
|
-D RESINSIGHT_ENABLE_GRPC=true
|
|
|
|
-D RESINSIGHT_GRPC_PYTHON_EXECUTABLE=python
|
|
|
|
-D VCPKG_TARGET_TRIPLET=${{ matrix.config.vcpkg-triplet }}
|
|
|
|
-D CMAKE_TOOLCHAIN_FILE=${{ matrix.config.cmake-toolchain }}
|
|
|
|
-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
|
|
|
|
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: (Windows) Run Unit Tests
|
|
|
|
if: contains( matrix.config.os, 'windows')
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
cmakebuild/ApplicationCode/ResInsight --unittest
|
|
|
|
- name: (Linux) Run Unit Tests
|
|
|
|
if: "!contains( matrix.config.os, 'windows')"
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
cmakebuild/ApplicationCode/ResInsight --unittest
|