|
| 1 | +name: build and test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + name: ${{ matrix.config.name }} (Python ${{ matrix.python-version}}) |
| 12 | + runs-on: ${{ matrix.config.os }} |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + python-version: [3.11, 3.12, 3.13] |
| 17 | + paraview-version: [v6.0.1] |
| 18 | + config: |
| 19 | + - { |
| 20 | + name: Linux, |
| 21 | + os: ubuntu-latest |
| 22 | + } |
| 23 | + |
| 24 | + defaults: |
| 25 | + run: |
| 26 | + # Using a login shell is necessary to persist the conda environment |
| 27 | + shell: bash -l {0} |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: Set up Miniconda |
| 31 | + uses: conda-incubator/setup-miniconda@v3 |
| 32 | + with: |
| 33 | + channels: conda-forge |
| 34 | + conda-remove-defaults: "true" |
| 35 | + auto-update-conda: true |
| 36 | + conda-solver: libmamba |
| 37 | + python-version: ${{ matrix.python-version }} |
| 38 | + activate-environment: tomviz |
| 39 | + |
| 40 | + - name: Checkout Tomviz |
| 41 | + uses: actions/checkout@v5 |
| 42 | + with: |
| 43 | + submodules: recursive |
| 44 | + path: tomviz |
| 45 | + |
| 46 | + - name: Install Build Requirements |
| 47 | + # I can't get the defaults channel fully removed, so we have to |
| 48 | + # --override-channels here. |
| 49 | + run: | |
| 50 | + conda install -y --override-channels -c conda-forge --file tomviz/.github/workflows/build_requirements.txt |
| 51 | + # Record the whole build environment for caching |
| 52 | + conda env export > build_env.yml |
| 53 | + echo "build_env.yml file contents is:" |
| 54 | + cat build_env.yml |
| 55 | +
|
| 56 | + - name: Checkout ParaView |
| 57 | + run: git clone -b ${{ matrix.paraview-version }} --recursive https://gitlab.kitware.com/paraview/paraview |
| 58 | + |
| 59 | + # If nothing in the build environment changes, restore a cache of the |
| 60 | + # ParaView build so we can skip rebuilding it and save a lot of time. |
| 61 | + - name: Restore ParaView Build Cache |
| 62 | + id: cache-paraview-restore |
| 63 | + uses: actions/cache/restore@v4 |
| 64 | + with: |
| 65 | + path: paraview-build |
| 66 | + key: ${{ matrix.paraview-version }}-paraview-${{ hashFiles('build_env.yml') }} |
| 67 | + |
| 68 | + - name: Build ParaView |
| 69 | + if: steps.cache-paraview-restore.outputs.cache-hit != 'true' |
| 70 | + run: bash tomviz/.github/workflows/scripts/build_paraview.sh |
| 71 | + |
| 72 | + - name: Save ParaView Build Cache |
| 73 | + if: steps.cache-paraview-restore.outputs.cache-hit != 'true' |
| 74 | + id: cache-paraview-save |
| 75 | + uses: actions/cache/save@v4 |
| 76 | + with: |
| 77 | + path: paraview-build |
| 78 | + key: ${{ steps.cache-paraview-restore.outputs.cache-primary-key }} |
| 79 | + |
| 80 | + - name: Build Tomviz |
| 81 | + run: bash tomviz/.github/workflows/scripts/build_tomviz.sh |
| 82 | + |
| 83 | + - name: Install Runtime Requirements |
| 84 | + # I can't get the defaults channel fully removed, so we have to |
| 85 | + # --override-channels here. |
| 86 | + run: conda install -y --override-channels -c conda-forge --file tomviz/.github/workflows/runtime_requirements.txt |
| 87 | + |
| 88 | + - name: Install Test Requirements |
| 89 | + run: | |
| 90 | + conda install -y --override-channels -c conda-forge --file tomviz/tests/python/requirements-dev.txt |
| 91 | + pip install --no-build-isolation --no-deps -U tomviz/tomviz/python |
| 92 | + pip install --no-build-isolation --no-deps -U tomviz/acquisition |
| 93 | +
|
| 94 | + - name: Run Tests |
| 95 | + run: | |
| 96 | + cd tomviz-build |
| 97 | + TOMVIZ_TEST_PYTHON_EXECUTABLE=$(which python3) ctest --output-on-failure |
| 98 | +
|
| 99 | + - name: Upload CTest Log (On Failure Only) |
| 100 | + if: ${{ failure() }} |
| 101 | + uses: actions/upload-artifact@v4 |
| 102 | + with: |
| 103 | + name: TomvizCTestLog.log |
| 104 | + path: tomviz-build/Testing/Temporary/LastTest.log |
0 commit comments