| 1 |
name: Test family projects |
| 2 |
|
| 3 |
on: |
| 4 |
workflow_dispatch: |
| 5 |
inputs: |
| 6 |
version: |
| 7 |
description: 'Which version, empty for development, `release` for latest released version' |
| 8 |
default: "" |
| 9 |
|
| 10 |
pull_request: |
| 11 |
|
| 12 |
defaults: |
| 13 |
run: |
| 14 |
|
| 15 |
|
| 16 |
shell: bash -l -e {0} |
| 17 |
|
| 18 |
jobs: |
| 19 |
tests: |
| 20 |
name: ${{ matrix.repo }} |
| 21 |
runs-on: ubuntu-latest |
| 22 |
strategy: |
| 23 |
fail-fast: false |
| 24 |
matrix: |
| 25 |
repo: [qutip-qip, qutip-jax, qutip-qoc, qutip-qtrl] |
| 26 |
|
| 27 |
steps: |
| 28 |
- uses: actions/checkout@v6 |
| 29 |
- uses: conda-incubator/setup-miniconda@v4 |
| 30 |
with: |
| 31 |
auto-update-conda: true |
| 32 |
python-version: 3.11 |
| 33 |
|
| 34 |
- name: Install QuTiP and dependencies |
| 35 |
run: | |
| 36 |
# Install the extra requirement |
| 37 |
python -m pip install pytest pytest-rerunfailures # tests |
| 38 |
python -m pip install numpy scipy cython filelock |
| 39 |
python -m pip install -e . -v --no-build-isolation |
| 40 |
- name: Install QuTiP family package |
| 41 |
run: | |
| 42 |
# jax cannot be installed from requirement (cpu vs gpu issue) |
| 43 |
python -m pip install jax[cpu] |
| 44 |
cd .. |
| 45 |
git clone https://github.com/qutip/${{ matrix.repo }}.git |
| 46 |
cd ${{ matrix.repo }} |
| 47 |
if [[ $inputs.version == "release" ]]; then |
| 48 |
# Checkout the latest tag as the latest release |
| 49 |
git fetch --tags |
| 50 |
git checkout $(git describe --tags "$(git rev-list --tags --max-count=1)") |
| 51 |
elif [[ "${{ inputs.version }}" ]]; then |
| 52 |
git checkout ${{ inputs.version }} |
| 53 |
fi |
| 54 |
python -m pip install .[full] |
| 55 |
- name: Print python environment |
| 56 |
run: | |
| 57 |
pip list |
| 58 |
- name: Run test |
| 59 |
run: | |
| 60 |
cd ../${{ matrix.repo }} |
| 61 |
pytest tests -vv -W "ignore::DeprecationWarning" |