-
Notifications
You must be signed in to change notification settings - Fork 65
130 lines (119 loc) · 4.05 KB
/
test.yml
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Tests
on:
push:
branches: [ master ]
pull_request:
jobs:
cases:
name: ${{ matrix.os }}, python${{ matrix.python-version }}, ${{ matrix.case-name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- case-name: qutip@5.0.0
os: ubuntu-latest
qutip-version: '==5.0.0'
pyqir-version: ''
python-version: '3.11'
- case-name: qutip@qutip-4.7.X
os: ubuntu-latest
qutip-version: '@qutip-4.7.X'
pyqir-version: ''
python-version: '3.10'
- case-name: qutip@master
os: ubuntu-latest
qutip-version: '@master'
pyqir-version: ''
python-version: '3.12'
- case-name: qutip@4.7
os: macOS-latest
qutip-version: '==4.7.*'
qiskit-version: ''
pyqir-version: ''
python-version: '3.11'
- case-name: qiskit+qir
os: windows-latest
qutip-version: ''
qiskit-version: '==0.46.*'
pyqir-version: '==0.6.2'
python-version: '3.9'
- case-name: qiskit+qir
os: macOS-latest
qutip-version: ''
qiskit-version: '==0.46.*'
pyqir-version: '==0.6.2'
python-version: '3.9'
- case-name: qiskit+qir
os: ubuntu-latest
qutip-version: ''
qiskit-version: '==0.46.*'
pyqir-version: '==0.6.2'
python-version: '3.9'
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install QuTiP from PyPI
if: ${{ matrix.qutip-version != '' && ! startsWith( matrix.qutip-version, '@') }}
run: python -m pip install 'qutip${{ matrix.qutip-version }}'
- name: Install QuTiP from GitHub
if: ${{ startsWith( matrix.qutip-version, '@') }}
run: |
python -m pip install 'git+https://github.com/qutip/qutip.git${{ matrix.qutip-version }}'
- name: Install Qiskit from PyPI
if: ${{ matrix.qiskit-version != '' }}
run: python -m pip install 'qiskit${{ matrix.qiskit-version }}' qiskit-aer
- name: Install PyQIR from PyPI
if: ${{ matrix.pyqir-version != '' }}
# We use each subpackage explicitly here; see https://github.com/qir-alliance/pyqir/issues/167.
run: python -m pip install 'pyqir-generator${{ matrix.pyqir-version }}' 'pyqir-parser${{ matrix.pyqir-version }}'
- name: Install qutip-qip
# Installing in-place so that coveralls can locate the source code.
run: |
pip install -e .[full]
- name: Test with pytest and generate coverage report
run: |
pip install pytest-cov coveralls
pytest tests --strict-markers --cov=qutip_qip --cov-report= --color=yes
- name: Upload to Coveralls
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
COVERALLS_PARALLEL: true
run: coveralls --service=github
doctest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -mpip install -r doc/requirements.txt
pip install qutip==4.7.3
pip install .
- name: Test code snippets in the documentation
run: |
cd doc
make doctest
- name: Test code examples for the pulse paper
run: |
python -m pip install joblib pytest pytest-custom_exit_code
cd doc/pulse-paper
pytest *.py --suppress-no-test-exit-code
finalise:
name: Finalise coverage reporting
needs: [cases]
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finalise coverage reporting
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
run: |
python -m pip install coveralls
coveralls --service=github --finish