Skip to content

Commit

Permalink
github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
flowerthrower committed Nov 22, 2023
1 parent 2cd77c4 commit affe934
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 98 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
# For the sdist we should be as conservative as possible with our
# Python version. This should be the lowest supported version. This
# means that no unsupported syntax can sneak through.
python-version: '3.7'
python-version: '3.8'

- name: Install pip build
run: |
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
name: Install Python
with:
# This is about the build environment, not the released wheel version.
python-version: '3.7'
python-version: '3.8'

- name: Install pip build
run: |
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.7'
python-version: '3.8'

- name: Verify this is not a dev version
shell: bash
Expand Down
19 changes: 7 additions & 12 deletions .github/workflows/build_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,20 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.9'

- name: Install Pandoc
run: |
sudo apt update
sudo apt install -y pandoc
python-version: '3.11'

- name: Install documentation dependencies
run: |
python -mpip install -r doc/requirements.txt
python -m pip install -r doc/requirements.txt
- name: Install qutip-qoc from GitHub
run: |
python -mpip install -e .[full]
python -m pip install -e .[full]
# Install in editable mode so it doesn't matter if we import from
# inside the installation directory, otherwise we can get some errors
# because we're importing from the wrong location.
Expand All @@ -44,8 +39,8 @@ jobs:
# -T : display a full traceback if a Python exception occurs
- name: Upload built files
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: qutip-qoc_html_docs
name: qutip_qoc_html_docs
path: doc/_build/html/*
if-no-files-found: error
97 changes: 14 additions & 83 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Tests

on:
push:
branches: [ master ]
pull_request:
on: [push, pull_request]

jobs:
cases:
Expand All @@ -12,51 +9,23 @@ jobs:
strategy:
matrix:
include:
- case-name: [email protected]
os: ubuntu-latest
qutip-version: '==5.0.0a1'
pyqir-version: ''
python-version: '3.10'
- case-name: [email protected]
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.11'
- case-name: [email protected]
os: windows-latest
qutip-version: '==4.6.*'
qiskit-version: ''
pyqir-version: ''
python-version: '3.8'
- case-name: [email protected]
os: macOS-latest
qutip-version: '==4.7.*'
qiskit-version: ''
pyqir-version: ''
python-version: '3.9'
- case-name: qiskit+qir
- case-name: qutip@master
os: windows-latest
qutip-version: ''
qiskit-version: '==0.36.*'
pyqir-version: '==0.6.2'
python-version: '3.8'
- case-name: qiskit+qir
os: macOS-latest
qutip-version: ''
qiskit-version: '==0.36.*'
pyqir-version: '==0.6.2'
qutip-version: '@master'
python-version: '3.10'
- case-name: qutip@master
os: macos-latest
qutip-version: '@master'
python-version: '3.9'
- case-name: qiskit+qir
- case-name: qutip-5.0
os: ubuntu-latest
qutip-version: ''
qiskit-version: '==0.36.*'
pyqir-version: '==0.6.2'
python-version: '3.7'
qutip-version: '==5.0.0a1'
qutip-pre: '--pre'
python-version: '3.8'

steps:
- uses: actions/checkout@v3
Expand All @@ -67,66 +36,28 @@ jobs:

- name: Install QuTiP from PyPI
if: ${{ matrix.qutip-version != '' && ! startsWith( matrix.qutip-version, '@') }}
run: python -m pip install 'qutip${{ matrix.qutip-version }}'
run: python -m pip install ${{ matrix.qutip-pre }} 'qutip${{ matrix.qutip-version }}'

- name: Install QuTiP from GitHub
if: ${{ startsWith( matrix.qutip-version, '@') }}
run: |
python -m pip install numpy scipy cython
python -m pip install 'git+https://github.com/qutip/qutip.git${{ matrix.qutip-version }}'
# For qutip-v5 qutip.control is replaced by qutip-qtrl
- name: Install qutip-qtrl from PyPI
if: ${{ matrix.qutip-version == '@master'}}
run: |
python -m pip install 'git+https://github.com/qutip/qutip-qtrl.git'
- name: Install Qiskit from PyPI
if: ${{ matrix.qiskit-version != '' }}
run: python -m pip install 'qiskit${{ matrix.qiskit-version }}'

- 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-qoc
# 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_qoc --cov-report= --color=yes
pytest tests --strict-markers --cov=qutip_qoc --cov=tests --cov-report=
- 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.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -mpip install -r doc/requirements.txt
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]
Expand Down

0 comments on commit affe934

Please sign in to comment.