Skip to content

pip install doped

pip install doped #95

name: pip install doped
on:
workflow_dispatch:
workflow_run:
workflows: ["Release and publish"]
branches: [main]
types:
- completed # only test when new release has been deployed to PyPI
jobs:
test:
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') }}
# only run when tests have passed (or manually triggered)
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: |
sleep 360 # wait 10 minutes for PyPI to update with the new release
python -m pip install --upgrade pip
pip install doped[tests] # install only from PyPI
- 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