Test ResInsight #140
This file contains hidden or 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: | |
| schedule: | |
| - cron: "00 02 * * 0,3" | |
| push: | |
| branches: | |
| - main | |
| tags: "*" | |
| pull_request: | |
| workflow_dispatch: | |
| env: | |
| ERT_SHOW_BACKTRACE: 1 | |
| RESINSIGHT_VERSION: "2025.12.0" | |
| RIPS_VERSION: "2025.12.0.1" | |
| INSTALL_DIR: resinsight_bin | |
| jobs: | |
| build_dependencies: | |
| name: "build-deps_${{ matrix.os }}" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-24.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: Free Disk Space (Ubuntu) # To avoid disk space issues on runners | |
| if: steps.cache-package.outputs.cache-hit != 'true' | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| # this might remove tools that are actually needed, | |
| # if set to "true" but frees about 6 GB | |
| tool-cache: false | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: false | |
| docker-images: true | |
| swap-storage: true | |
| - name: Install dependencies | |
| if: steps.cache-package.outputs.cache-hit != 'true' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y install build-essential gcc-13 g++-13 curl zip unzip tar linux-libc-dev | |
| sudo apt-get install libxkbcommon-x11-0 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev libhdf5-dev | |
| - name: Install Qt | |
| if: steps.cache-package.outputs.cache-hit != 'true' | |
| uses: jurplel/install-qt-action@v4 | |
| with: | |
| version: 6.7.0 | |
| dir: "${{ github.workspace }}/Qt/" | |
| cache: true | |
| modules: "qtnetworkauth qtcharts" | |
| - name: Switch cpp compiler | |
| if: steps.cache-package.outputs.cache-hit != 'true' | |
| run: | | |
| sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 | |
| sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100 | |
| sudo update-alternatives --auto g++ | |
| sudo update-alternatives --auto gcc | |
| - name: Use CMake | |
| if: steps.cache-package.outputs.cache-hit != 'true' | |
| uses: lukka/get-cmake@latest | |
| with: | |
| cmakeVersion: "~3.26.0" | |
| - 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 | |
| - 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 \ | |
| -DRESINSIGHT_BUILD_LIBS_FROM_SOURCE=false \ | |
| -DRESINSIGHT_ENABLE_PRECOMPILED_HEADERS=false \ | |
| -G Ninja | |
| cmake --build . --target 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@v5 | |
| 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.11", "3.12"] | |
| os: [ubuntu-24.04] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: "actions/checkout@v6" | |
| 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-get update | |
| sudo apt-get install libxkbcommon-x11-0 libegl1 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev | |
| # Unpack after checking out, otherwise the checkout action would delete it: | |
| tar zxf resinsight_${{ env.RESINSIGHT_VERSION }}.tar.gz | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "${{ matrix.python-version }}" | |
| cache: "pip" | |
| cache-dependency-path: | | |
| pyproject.toml | |
| - name: "Install the package" | |
| run: | | |
| pip install --upgrade pip | |
| # Make sure we use a compatible rips: | |
| pip install .[test,rips] | |
| pip install -U rips==${{ env.RIPS_VERSION }} | |
| - name: Run tests using resinsight | |
| run: | | |
| ${{ github.workspace }}/${{ env.INSTALL_DIR }}/bin/ResInsight --console --version | |
| RESINSIGHT_EXECUTABLE="${{ github.workspace }}/${{ env.INSTALL_DIR }}/bin/ResInsight" pytest -sv --test-resinsight -m resinsight --run-slow |