build and test #14
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: build and test | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| test: | |
| name: ${{ matrix.config.name }} (Python ${{ matrix.python-version }}) | |
| runs-on: ${{ matrix.config.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: [3.11, 3.12, 3.13] | |
| config: | |
| - { | |
| name: Linux, | |
| os: ubuntu-latest | |
| } | |
| defaults: | |
| run: | |
| # Using a login shell is necessary to persist the conda environment | |
| shell: bash -l {0} | |
| steps: | |
| - name: Set up Miniconda | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| channels: conda-forge | |
| conda-remove-defaults: "true" | |
| auto-update-conda: true | |
| conda-solver: libmamba | |
| python-version: ${{ matrix.python-version }} | |
| activate-environment: tomviz | |
| - name: Checkout Tomviz | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| path: tomviz | |
| - name: Install Build Requirements | |
| # I can't get the defaults channel fully removed, so we have to | |
| # --override-channels here. | |
| run: | | |
| conda install -y --override-channels -c conda-forge --file tomviz/.github/workflows/build_requirements.txt | |
| # Record the whole build environment for caching | |
| conda env export > build_env.yml | |
| echo "build_env.yml file contents is:" | |
| cat build_env.yml | |
| - name: Build Tomviz | |
| run: bash tomviz/.github/workflows/scripts/build_tomviz.sh | |
| - name: Install Runtime Requirements | |
| # I can't get the defaults channel fully removed, so we have to | |
| # --override-channels here. | |
| run: conda install -y --override-channels -c conda-forge --file tomviz/.github/workflows/runtime_requirements.txt | |
| - name: Install Test Requirements | |
| run: | | |
| conda install -y --override-channels -c conda-forge --file tomviz/tests/python/requirements-dev.txt | |
| pip install --no-build-isolation --no-deps -U tomviz/tomviz/python | |
| pip install --no-build-isolation --no-deps -U tomviz/acquisition | |
| # These do not have to be in the same environment as Tomviz, but the dependencies | |
| # are so far compatible and we'll just let it go for the tests. | |
| conda install -y --override-channels -c conda-forge --file tomviz/.github/workflows/pyxrf_requirements.txt | |
| pip install --no-build-isolation --no-deps -U tomviz/tomviz/python/tomviz/pyxrf/pyxrf-utils | |
| - name: Run Tests | |
| env: | |
| # Make sure the Qt tests run offscreen | |
| QT_QPA_PLATFORM: offscreen | |
| TOMVIZ_REQUIRE_PYXRF: true | |
| run: | | |
| cd tomviz-build | |
| export TOMVIZ_TEST_PYTHON_EXECUTABLE=$(which python3) | |
| ctest --output-on-failure | |
| - name: Upload CTest Log (On Failure Only) | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: TomvizCTestLog_${{ matrix.config.name }}_Py${{ matrix.python-version }}.log | |
| path: tomviz-build/Testing/Temporary/LastTest.log |