Pv wip #170
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test ResInsight | |
on: | |
push: | |
branches: | |
- main | |
tags: "*" | |
pull_request: | |
env: | |
ERT_SHOW_BACKTRACE: 1 | |
RESINSIGHT_VERSION: "2024.03.3" | |
RIPS_VERSION: "2024.3.3.3" | |
INSTALL_DIR: resinsight_bin | |
jobs: | |
build_dependencies: | |
name: "build-deps_${{ matrix.os }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-22.04] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: "actions/cache@v4" | |
id: cache-package | |
with: | |
key: ${{ matrix.os }}_resinsight_${{ env.RESINSIGHT_VERSION }} | |
path: ${{ github.workspace }}/resinsight_${{ env.RESINSIGHT_VERSION }}.tar.gz | |
- name: Install dependencies | |
if: steps.cache-package.outputs.cache-hit != 'true' | |
run: | | |
sudo apt update | |
sudo apt -y install build-essential gcc-12 g++-12 curl zip unzip tar | |
sudo apt -y install qtbase5-dev qtbase5-private-dev libqt5charts5-dev libqt5svg5-dev | |
- name: Switch cpp compiler | |
if: steps.cache-package.outputs.cache-hit != 'true' | |
run: | | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12 | |
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12 | |
sudo update-alternatives --auto g++ | |
sudo update-alternatives --auto gcc | |
- name: Clone ResInsight | |
if: steps.cache-package.outputs.cache-hit != 'true' | |
run: | | |
git clone -b v${{ env.RESINSIGHT_VERSION }} https://github.com/OPM/ResInsight.git | |
- name: Build ResInsight dependencies | |
if: steps.cache-package.outputs.cache-hit != 'true' | |
run: | | |
cd ResInsight | |
git submodule update --init | |
ThirdParty/vcpkg/bootstrap-vcpkg.sh | |
ThirdParty/vcpkg/vcpkg install grpc boost-filesystem boost-spirit eigen3 | |
- name: Build ResInsight | |
if: steps.cache-package.outputs.cache-hit != 'true' | |
run: | | |
# Installation of ResInsight may fail if this directory does not exist: | |
mkdir -p ResInsight/GrpcInterface/Python/rips/generated | |
mkdir ResInsight/build | |
cd ResInsight/build | |
cmake .. \ | |
-DRESINSIGHT_ENABLE_GRPC=true \ | |
-DVCPKG_TARGET_TRIPLET=x64-linux \ | |
-DCMAKE_TOOLCHAIN_FILE=../ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake \ | |
-DBUILD_PYTHON=OFF \ | |
-DRESINSIGHT_GRPC_DOWNLOAD_PYTHON_MODULE=OFF \ | |
-DRESINSIGHT_GRPC_BUNDLE_PYTHON_MODULE=OFF \ | |
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/${{ env.INSTALL_DIR }} \ | |
-DRESINSIGHT_ENABLE_HDF5=OFF | |
make -j$( nproc ) install | |
- name: Package ResInsight | |
if: steps.cache-package.outputs.cache-hit != 'true' | |
run: | | |
tar zcf resinsight_${{ env.RESINSIGHT_VERSION }}.tar.gz ${{ env.INSTALL_DIR }} | |
- name: Archive ResInsight | |
if: steps.cache-package.outputs.cache-hit != 'true' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: resinsight_${{ env.RESINSIGHT_VERSION }} | |
path: ${{ github.workspace }}/resinsight_${{ env.RESINSIGHT_VERSION }}.tar.gz | |
tests: | |
needs: build_dependencies | |
if: ${{ always() && needs.build_dependencies.result != 'failed' }} | |
name: "tests_${{ matrix.os }}_py-${{ matrix.python-version }}_resinsight" | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
os: [ubuntu-22.04] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: "actions/setup-python@v5" | |
with: | |
python-version: "${{ matrix.python-version }}" | |
- uses: "actions/checkout@v4" | |
with: | |
fetch-depth: 0 | |
- uses: actions/cache/restore@v4 | |
id: restore-cached-package | |
with: | |
key: ${{ matrix.os }}_resinsight_${{ env.RESINSIGHT_VERSION }} | |
path: ${{ github.workspace }}/resinsight_${{ env.RESINSIGHT_VERSION }}.tar.gz | |
- name: Install ResInsight | |
run: | | |
sudo apt -y install qtbase5-dev qtbase5-private-dev libqt5charts5-dev libqt5svg5-dev | |
# Unpack after checking out, otherwise the checkout action would delete it: | |
tar zxf resinsight_${{ env.RESINSIGHT_VERSION }}.tar.gz | |
- name: "Install the package" | |
run: | | |
pip install --upgrade pip setuptools | |
# Make sure we use a compatible rips: | |
pip install rips==${{ env.RIPS_VERSION }} | |
pip install .[test] | |
- name: Run tests using resinsight | |
run: | | |
RESINSIGHT_EXECUTABLE="${{ github.workspace }}/${{ env.INSTALL_DIR }}/ResInsight" pytest -sv --test-resinsight -m resinsight |