-
Notifications
You must be signed in to change notification settings - Fork 51
78 lines (64 loc) · 3.17 KB
/
Copy pathtest.yml
File metadata and controls
78 lines (64 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Tests
on:
workflow_dispatch:
push:
branches:
- '*' # all branches
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-14 ] # Windows in theory possible, but needs circumventing ``vise`` issues
python-version: [ '3.11', '3.14' ] # lowest and highest supported Python versions; 3.10 should still be possible, but latest ``pymatgen`` (2026) only supports 3.11-3.14
# 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
# TODO: temporary until doped v4 released:
pip install --no-deps git+https://github.com/SMTG-Bham/ShakeNBreak@develop
pip install -e .[tests]
- name: Test
shell: bash
run: | # update durations file with ``export DOPED_SKIP_HEAVY_TESTS=False; 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
shell: bash
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 ``export DOPED_SKIP_HEAVY_TESTS=False; 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
shell: bash
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