Adding CI to your ParaView plugin and VTK modules

CI: Continuous Integration
MR: Merge Request
PR: Pull Request

In the VTK/ParaView ecosystem, there are a number of projects that rely on VTK and ParaView as dependency and are not part of VTK/ParaView per se, eg Flow3D, Salome, Themys, F3D, PVGeo, vtk-dicom, pyvista, vedo, meshio, slicer, CTK, cmb, ttk.

It has always been complex for these kind of project to be able to build and run test easily and efficiently in the development process.

Building the whole of VTK or ParaView is just not possible on every single MR/PR.

This is why we think that providing tools for the community in order to be able to build and test ParaView plugins, ParaView based applications, VTK dependent modules and VTK based applications will help all these projects grow. This is especially true since the improvements of the testing framework in both VTK and ParaView in their respective upcoming releases.

Docker is the solution we choose for this and is a de-facto standard in many communities.

So we are very happy to introduce vtk-for-ci and paraview-for-ci dockerhub repositories.

By using these docker images, you will be able to very easily build and test your projects.

To get started, you can have a look at the two examples repositories:

How to use on gitlab

If you are using GitLab, your .gitlab-ci.yml file may look like:

  image: kitware/paraview-for-ci:v5.10.1
  stage: build
    - mkdir -p build
    - cd build
    - cmake -DCMAKE_PREFIX_PATH=/opt/paraview/install/ -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release ..
    - cmake --build . --parallel 2
    expire_in: 1h
    when: always
      - build/

  image: kitware/paraview-for-ci:v5.10.1
  stage: test
    - cd build
    - xvfb-run ctest -j 2 --output-on-failure || xvfb-run ctest -j 1 --rerun-failed -VV 
    - build-plugin
    - build-plugin

How to use on github

If you are using github, your ci.yml file may look like:

name: CI

    types: [opened, synchronize, reopened, ready_for_review]
      - master

    if: github.event.pull_request.draft == false

    runs-on: ubuntu-latest
        version: [ v5.9.1, v5.10.1, latest ]
    container: kitware/paraview-for-ci:${{ matrix.version }}


    - name: Checkout
      uses: actions/checkout@v2
        path: 'source'
        fetch-depth: 0
        lfs: 'true'

    - name: Setup Directories
      working-directory: ${{github.workspace}}
      run: mkdir build

    - name: Configure
      working-directory: ${{github.workspace}}/build
      run: cmake ../source -DCMAKE_PREFIX_PATH=/opt/paraview/install/ -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release

    - name: Build
      working-directory: ${{github.workspace}}/build
      run: cmake --build . --parallel 2

    - name: Test
      working-directory: ${{github.workspace}}/build
      run: xvfb-run ctest -j 2 --output-on-failure || xvfb-run ctest -j 1 --rerun-failed -VV


Graphical testing is supported using Xvfb and mesa.

The ParaView image is built with reasonable configuration that should cover most usecases

cmake -GNinja 

The VTK image is built with a reasonable configuration that could cover most usecases

cmake -GNinja 

If you or your team need more complex images, do not hesitate to contact Kitware for help.

If you are looking to build a plugin for the binary release, you may want to look at this Kitware blog.

Special Thanks to Brad King, Charles Gueunet, Khaled Hadj-tahar and Tom Suchel for their help with this work !

3 comments to Adding CI to your ParaView plugin and VTK modules

  1. Instead of

    and let CMake find the installed versions. That avoids duplicating the version of Paraview, and allows to use a matrix for the job:

    runs-on: ubuntu-latest
    paraview_version: [ v5.9.1, v5.10.1, latest ]
    container: kitware/paraview-for-ci:${{ matrix.paraview_version }}

    1. I’ve taken your suggestions into account and also the path is now /opt/paraview/install instead.

Leave a Reply