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:
|
2020-11-17 06:36:02 -06:00
|
|
|
pull_request:
|
2020-06-07 12:38:30 -05:00
|
|
|
schedule:
|
2020-06-16 07:41:14 -05:00
|
|
|
# Every day at 1am to make sure we have a build cache for the current date
|
2022-01-10 12:07:43 -06:00
|
|
|
# build cache is
|
2020-06-07 12:38:30 -05:00
|
|
|
- cron: '0 1 * * * '
|
2020-05-08 00:25:03 -05:00
|
|
|
env:
|
|
|
|
BUILD_TYPE: Release
|
2021-01-29 03:38:15 -06:00
|
|
|
BUILDCACHE_VERSION: 0.24.4
|
2020-05-08 00:25:03 -05:00
|
|
|
BUILDCACHE_DIR: ${{ github.workspace }}/buildcache_dir
|
2021-01-29 03:38:15 -06:00
|
|
|
BUILDCACHE_ACCURACY: SLOPPY
|
2020-05-08 00:25:03 -05:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
ResInsight-x64-buildcache:
|
|
|
|
runs-on: ${{ matrix.config.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
config:
|
|
|
|
- {
|
|
|
|
name: "Windows Latest MSVC",
|
2022-02-04 01:45:38 -06:00
|
|
|
os: windows-latest,
|
2020-05-08 00:25:03 -05:00
|
|
|
cc: "cl", cxx: "cl",
|
2020-11-15 11:26:42 -06:00
|
|
|
vcpkg-response-file: vcpkg_x64-windows.txt,
|
2020-05-08 00:25:03 -05:00
|
|
|
vcpkg-triplet: x64-windows,
|
2021-04-05 10:33:58 -05:00
|
|
|
build-python-module: true,
|
|
|
|
execute-unit-tests: true
|
2020-05-08 00:25:03 -05:00
|
|
|
}
|
2020-06-03 01:08:35 -05:00
|
|
|
- {
|
2021-04-27 08:32:07 -05:00
|
|
|
name: "Ubuntu Latest gcc",
|
|
|
|
os: ubuntu-latest,
|
2020-06-03 01:08:35 -05:00
|
|
|
cc: "gcc", cxx: "g++",
|
2020-11-15 11:26:42 -06:00
|
|
|
vcpkg-response-file: vcpkg_x64-linux.txt,
|
2020-09-11 11:55:23 -05:00
|
|
|
vcpkg-triplet: x64-linux,
|
2021-04-05 10:33:58 -05:00
|
|
|
build-python-module: true,
|
|
|
|
execute-unit-tests: true
|
2020-09-11 11:55:23 -05:00
|
|
|
}
|
|
|
|
- {
|
2021-04-27 08:32:07 -05:00
|
|
|
name: "Ubuntu Latest clang",
|
|
|
|
os: ubuntu-latest,
|
2020-09-11 11:55:23 -05:00
|
|
|
cc: "clang", cxx: "clang++",
|
2020-11-15 11:26:42 -06:00
|
|
|
vcpkg-response-file: vcpkg_x64-linux.txt,
|
2020-06-03 01:08:35 -05:00
|
|
|
vcpkg-triplet: x64-linux,
|
2021-04-05 10:33:58 -05:00
|
|
|
build-python-module: true,
|
|
|
|
execute-unit-tests: true
|
|
|
|
}
|
|
|
|
- {
|
|
|
|
name: "Mac OS",
|
|
|
|
os: macos-latest,
|
|
|
|
cc: "clang", cxx: "clang++",
|
|
|
|
vcpkg-response-file: vcpkg_x64-osx.txt,
|
|
|
|
vcpkg-triplet: x64-osx,
|
|
|
|
build-python-module: false,
|
|
|
|
execute-unit-tests: false
|
2020-06-03 01:08:35 -05:00
|
|
|
}
|
2020-05-08 00:25:03 -05:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2020-06-09 02:38:07 -05:00
|
|
|
uses: actions/checkout@v2
|
2020-05-08 00:25:03 -05:00
|
|
|
with:
|
|
|
|
submodules: true
|
2020-10-30 04:11:58 -05:00
|
|
|
- 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)"
|
2021-08-02 09:06:56 -05:00
|
|
|
|
2022-02-04 01:45:38 -06:00
|
|
|
- name: Use CMake
|
|
|
|
uses: lukka/get-cmake@latest
|
|
|
|
|
|
|
|
- name: Use MSVC (Windows)
|
|
|
|
if: matrix.config.os == 'windows-latest'
|
|
|
|
uses: ilammy/msvc-dev-cmd@v1
|
2021-08-02 09:06:56 -05:00
|
|
|
|
2020-05-08 00:25:03 -05:00
|
|
|
- name: Download buildcache
|
|
|
|
id: buildcache-download
|
|
|
|
shell: cmake -P {0}
|
|
|
|
run: |
|
|
|
|
if ("${{ runner.os }}" STREQUAL "Windows")
|
|
|
|
set(buildcache_suffix "win-msvc.zip")
|
2021-04-05 10:33:58 -05:00
|
|
|
elseif ("${{ runner.os }}" STREQUAL "macOS")
|
|
|
|
set(buildcache_suffix "macos.zip")
|
2020-05-08 00:25:03 -05:00
|
|
|
elseif ("${{ runner.os }}" STREQUAL "Linux")
|
2020-11-28 05:53:06 -06:00
|
|
|
set(buildcache_suffix "linux.tar.gz")
|
2020-05-08 00:25:03 -05:00
|
|
|
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(
|
2020-11-28 05:53:06 -06:00
|
|
|
COMMAND chmod +x buildcache/bin/buildcache
|
2020-05-08 00:25:03 -05:00
|
|
|
)
|
|
|
|
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
|
2020-06-09 02:38:07 -05:00
|
|
|
uses: actions/cache@v2
|
2020-05-08 00:25:03 -05:00
|
|
|
with:
|
|
|
|
path: ${{ env.BUILDCACHE_DIR }}
|
2021-04-18 01:23:50 -05:00
|
|
|
key: ${{ matrix.config.os }}-${{ matrix.config.cc }}-cache-v02-${{ 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
|
2020-11-28 05:53:06 -06:00
|
|
|
run: echo "${{github.workspace}}/buildcache/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
|
2020-11-11 00:58:55 -06:00
|
|
|
shell: pwsh
|
|
|
|
|
2020-08-09 02:19:40 -05:00
|
|
|
- name: Cache Qt
|
2020-05-08 00:25:03 -05:00
|
|
|
id: cache-qt
|
2020-06-09 02:38:07 -05:00
|
|
|
uses: actions/cache@v2
|
2020-05-08 00:25:03 -05:00
|
|
|
with:
|
2020-08-09 02:19:40 -05:00
|
|
|
path: ${{ github.workspace }}/Qt/
|
2020-11-30 07:31:26 -06:00
|
|
|
key: ${{ matrix.config.os }}-QtCache-v03
|
2020-05-08 00:25:03 -05:00
|
|
|
- name: Install Qt
|
|
|
|
uses: jurplel/install-qt-action@v2
|
|
|
|
with:
|
|
|
|
version: 5.9.9
|
2020-11-30 07:31:26 -06:00
|
|
|
modules: qtscript qtcharts
|
2020-08-09 02:19:40 -05:00
|
|
|
dir: '${{ github.workspace }}/Qt/'
|
2020-05-08 00:25:03 -05:00
|
|
|
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
|
|
|
- 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-10-30 04:11:58 -05:00
|
|
|
- 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 }}
|
2020-11-15 11:26:42 -06:00
|
|
|
|
2020-11-24 02:20:23 -06:00
|
|
|
- name: Set vcpkg's response file path used as part of cache's key.
|
|
|
|
uses: lukka/set-shell-env@master
|
|
|
|
with:
|
|
|
|
VCPKGRESPONSEFILE: ${{ github.workspace }}/${{ matrix.config.vcpkg-response-file }}
|
2021-03-05 02:56:05 -06:00
|
|
|
- name: Restore from cache and install vcpkg
|
2021-04-05 10:33:58 -05:00
|
|
|
uses: lukka/run-vcpkg@v7
|
2020-10-30 06:29:57 -05:00
|
|
|
id: runvcpkg
|
|
|
|
with:
|
2020-11-15 11:26:42 -06:00
|
|
|
vcpkgArguments: '@${{ github.workspace }}/${{ matrix.config.vcpkg-response-file }}'
|
2020-10-30 06:29:57 -05:00
|
|
|
vcpkgDirectory: '${{ github.workspace }}/ThirdParty/vcpkg'
|
2020-11-24 02:20:23 -06:00
|
|
|
# Ensure the cache key changes any time the content of the response file changes.
|
2021-08-02 12:42:39 -05:00
|
|
|
appendedCacheKey: ${{ hashFiles(env.VCPKGRESPONSEFILE) }}-cache-key-v2
|
2020-11-15 11:26:42 -06:00
|
|
|
|
2021-03-05 02:56:05 -06:00
|
|
|
- name: Cache dynamic version of OpenSSL (Linux)
|
2021-04-05 14:21:14 -05:00
|
|
|
if: "contains( matrix.config.os, 'ubuntu_disabled')"
|
2021-03-05 02:56:05 -06:00
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ github.workspace }}/ThirdParty/vcpkg/installed/x64-linux-dynamic
|
2021-04-05 13:26:29 -05:00
|
|
|
key: ${{ matrix.config.os }}-vcpkg-x64-linux-dynamic_v05
|
2021-03-05 02:56:05 -06:00
|
|
|
|
|
|
|
- name: Install dynamic version of OpenSSL (Linux)
|
|
|
|
if: "contains( matrix.config.os, 'ubuntu')"
|
|
|
|
run: |
|
|
|
|
$VCPKG_ROOT/vcpkg install --overlay-triplets=${{ github.workspace }}/ThirdParty/vcpkg-custom-triplets --triplet x64-linux-dynamic openssl
|
|
|
|
|
2020-05-08 00:25:03 -05:00
|
|
|
- name: Configure
|
|
|
|
shell: cmake -P {0}
|
|
|
|
run: |
|
|
|
|
set(ENV{CC} ${{ matrix.config.cc }})
|
|
|
|
set(ENV{CXX} ${{ matrix.config.cxx }})
|
2020-10-30 04:11:58 -05:00
|
|
|
|
2020-05-08 00:25:03 -05:00
|
|
|
execute_process(
|
|
|
|
COMMAND cmake
|
|
|
|
-S .
|
|
|
|
-B cmakebuild
|
|
|
|
-D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE}
|
2020-06-16 07:41:14 -05:00
|
|
|
-D CMAKE_INSTALL_PREFIX=cmakebuild/install
|
2020-10-21 04:30:26 -05:00
|
|
|
-D RESINSIGHT_BUNDLE_OPENSSL=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
|
2021-04-05 10:33:58 -05:00
|
|
|
-D RESINSIGHT_ENABLE_GRPC=${{ matrix.config.build-python-module }}
|
2020-10-30 04:11:58 -05:00
|
|
|
-D RESINSIGHT_GRPC_PYTHON_EXECUTABLE=${{ steps.python-path.outputs.PYTHON_EXECUTABLE }}
|
|
|
|
-D RESINSIGHT_GRPC_DOWNLOAD_PYTHON_MODULE=true
|
2022-02-04 01:45:38 -06:00
|
|
|
-D CMAKE_TOOLCHAIN_FILE=ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake
|
2020-05-08 00:25:03 -05:00
|
|
|
-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] ")
|
|
|
|
execute_process(
|
2020-06-16 07:41:14 -05:00
|
|
|
COMMAND cmake --build cmakebuild --target install
|
2020-05-08 00:25:03 -05:00
|
|
|
RESULT_VARIABLE result
|
|
|
|
)
|
|
|
|
if (NOT result EQUAL 0)
|
|
|
|
message(FATAL_ERROR "Bad exit status")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
- name: Stats for buildcache
|
2020-11-28 05:53:06 -06:00
|
|
|
run: ${{ github.workspace }}/buildcache/bin/buildcache -s
|
2020-12-18 06:32:17 -06:00
|
|
|
- name: Run Unit Tests
|
2021-04-05 10:33:58 -05:00
|
|
|
if: "matrix.config.execute-unit-tests == true"
|
2020-05-08 00:25:03 -05:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2021-01-06 08:03:38 -06:00
|
|
|
cmakebuild/ApplicationExeCode/ResInsight --unittest
|
2021-06-04 05:22:10 -05:00
|
|
|
|
2020-12-18 06:32:17 -06:00
|
|
|
- name: Run pytest
|
2021-04-05 10:33:58 -05:00
|
|
|
if: "matrix.config.build-python-module == true"
|
2020-06-16 07:41:14 -05:00
|
|
|
env:
|
2021-01-06 08:03:38 -06:00
|
|
|
RESINSIGHT_EXECUTABLE: ${{ runner.workspace }}/ResInsight/cmakebuild/ApplicationExeCode/ResInsight
|
2020-06-16 07:41:14 -05:00
|
|
|
run: |
|
2021-01-06 08:03:38 -06:00
|
|
|
cd GrpcInterface/Python/rips
|
2020-10-30 04:11:58 -05:00
|
|
|
${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m pytest --console
|
2021-06-04 05:22:10 -05:00
|
|
|
|
2020-06-16 07:41:14 -05:00
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
2021-06-04 05:22:10 -05:00
|
|
|
if: "matrix.config.name != 'Ubuntu Latest clang'"
|
2020-06-16 07:41:14 -05:00
|
|
|
with:
|
|
|
|
name: ResInsight-${{ matrix.config.name }}
|
|
|
|
path: ${{ runner.workspace }}/ResInsight/cmakebuild/install
|