Misc TODOs #672
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: Tests | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - '*' # all branches | |
| jobs: | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-latest, macos-14 ] | |
| python-version: [ '3.10', '3.13' ] # lowest and highest supported Python versions | |
| # if durations files present, pytest-split will use them to intelligently distribute tests | |
| split: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] | |
| env: | |
| MPLBACKEND: Agg # non-interactive backend for matplotlib | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[tests] | |
| - name: Test | |
| run: | # update durations file with `pytest -vv -m "not mpl_image_compare" tests --store-durations --durations-path tests/.pytest_split_durations_non_plotting` | |
| pytest -vv -m "not mpl_image_compare" \ | |
| --splits 10 --group ${{ matrix.split }} \ | |
| --durations-path tests/.pytest_split_durations_non_plotting \ | |
| --splitting-algorithm least_duration tests # use this algo to avoid zero-splits | |
| - name: Plotting Tests | |
| if: always() # run even if non-plotting tests fail | |
| id: plotting_tests # Add an ID to this step for reference | |
| env: | |
| MPLBACKEND: Agg # non-interactive backend for matplotlib | |
| run: | # update durations file with `pytest -vv -m "mpl_image_compare" tests --store-durations --durations-path tests/.pytest_split_durations_plotting` | |
| pytest -vv --mpl -m "mpl_image_compare" \ | |
| --splits 10 --group ${{ matrix.split }} \ | |
| --durations-path tests/.pytest_split_durations_plotting \ | |
| --splitting-algorithm least_duration tests # use this algo to avoid zero-splits | |
| - name: Generate GH Actions test plots | |
| if: failure() && steps.plotting_tests.outcome == 'failure' # Run only if plotting tests fail | |
| env: | |
| MPLBACKEND: Agg # non-interactive backend for matplotlib | |
| run: | # Generate the test plots in case there were any failures: | |
| pytest -vv --mpl-generate-path=tests/remote_baseline -m "mpl_image_compare" \ | |
| --splits 10 --group ${{ matrix.split }} \ | |
| --durations-path tests/.pytest_split_durations_plotting \ | |
| --splitting-algorithm least_duration tests # use this algo to avoid zero-splits | |
| # Upload test plots | |
| - name: Archive test plots | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: doped_GH_test_plots_${{ matrix.os }}_${{ matrix.split }} | |
| path: tests/remote_baseline |