|
| 1 | +name: Run tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + test: |
| 18 | + name: ${{ matrix.RUNNER_OS }} Py${{ matrix.PYTHON_VERSION }} - ${{ matrix.INSTALL_TYPE }} - ${{ matrix.QT_LIB }} |
| 19 | + runs-on: ${{ matrix.RUNNER_OS }}-latest |
| 20 | + timeout-minutes: 15 |
| 21 | + defaults: |
| 22 | + run: |
| 23 | + shell: ${{ matrix.SPECIAL_INVOCATION }}bash -el {0} |
| 24 | + env: |
| 25 | + CI: 'True' |
| 26 | + QTCONSOLE_TESTING: 'True' |
| 27 | + PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }} |
| 28 | + RUNNER_OS: ${{ matrix.RUNNER_OS }} |
| 29 | + INSTALL_TYPE: ${{ matrix.INSTALL_TYPE }} |
| 30 | + QT_API: ${{ matrix.QT_LIB }} |
| 31 | + PYTEST_QT_API: ${{ matrix.QT_LIB }} |
| 32 | + COVERALLS_REPO_TOKEN: 'XWVhJf2AsO7iouBLuCsh0pPhwHy81Uz1v' |
| 33 | + COVERALLS_SERVICE_NAME: 'github-actions' |
| 34 | + strategy: |
| 35 | + fail-fast: false |
| 36 | + matrix: |
| 37 | + RUNNER_OS: ['ubuntu', 'windows', 'macos'] |
| 38 | + PYTHON_VERSION: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
| 39 | + INSTALL_TYPE: ['conda', 'pip'] |
| 40 | + QT_LIB: ['pyqt5', 'pyqt6'] |
| 41 | + include: |
| 42 | + - RUNNER_OS: 'ubuntu' |
| 43 | + SPECIAL_INVOCATION: 'xvfb-run --auto-servernum ' |
| 44 | + - INSTALL_TYPE: 'conda' |
| 45 | + REQUIREMENTS_FILE: 'requirements/environment.yml' |
| 46 | + - INSTALL_TYPE: 'pip' |
| 47 | + REQUIREMENTS_FILE: 'requirements/pip.yml' |
| 48 | + exclude: |
| 49 | + # Disable unsupported configurations |
| 50 | + - RUNNER_OS: 'ubuntu' |
| 51 | + INSTALL_TYPE: 'conda' |
| 52 | + QT_LIB: 'pyqt6' |
| 53 | + - RUNNER_OS: 'ubuntu' |
| 54 | + INSTALL_TYPE: 'conda' |
| 55 | + PYTHON_VERSION: '3.8' |
| 56 | + # Prune the number of matrix jobs |
| 57 | + - RUNNER_OS: 'windows' |
| 58 | + PYTHON_VERSION: '3.10' |
| 59 | + - RUNNER_OS: 'windows' |
| 60 | + PYTHON_VERSION: '3.11' |
| 61 | + - RUNNER_OS: 'windows' |
| 62 | + PYTHON_VERSION: '3.13' |
| 63 | + - RUNNER_OS: 'windows' |
| 64 | + INSTALL_TYPE: 'pip' |
| 65 | + - RUNNER_OS: 'windows' |
| 66 | + QT_LIB: 'pyqt6' |
| 67 | + - RUNNER_OS: 'macos' |
| 68 | + PYTHON_VERSION: '3.10' |
| 69 | + - RUNNER_OS: 'macos' |
| 70 | + PYTHON_VERSION: '3.11' |
| 71 | + - RUNNER_OS: 'macos' |
| 72 | + PYTHON_VERSION: '3.13' |
| 73 | + - RUNNER_OS: 'macos' |
| 74 | + INSTALL_TYPE: 'pip' |
| 75 | + - RUNNER_OS: 'macos' |
| 76 | + QT_LIB: 'pyqt6' |
| 77 | + steps: |
| 78 | + - name: Checkout branch |
| 79 | + uses: actions/checkout@v3 |
| 80 | + - name: Install Linux packages |
| 81 | + if: matrix.RUNNER_OS == 'ubuntu' |
| 82 | + shell: bash -el {0} |
| 83 | + run: | |
| 84 | + sudo apt-get update |
| 85 | + sudo apt-get install -y --no-install-recommends '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev libegl1 |
| 86 | + - name: Install Conda and dependencies |
| 87 | + uses: conda-incubator/setup-miniconda@v3 |
| 88 | + with: |
| 89 | + activate-environment: test |
| 90 | + auto-update-conda: false |
| 91 | + auto-activate-base: false |
| 92 | + miniforge-version: latest |
| 93 | + mamba-version: "*" |
| 94 | + channels: conda-forge |
| 95 | + channel-priority: true |
| 96 | + python-version: ${{ matrix.PYTHON_VERSION }} |
| 97 | + environment-file: ${{ matrix.REQUIREMENTS_FILE }} # Need to set up dependencies in the same step due to https://github.com/conda-incubator/setup-miniconda/issues/371 |
| 98 | + - name: Install dependencies with Pip |
| 99 | + if: matrix.INSTALL_TYPE == 'pip' |
| 100 | + shell: bash -el {0} |
| 101 | + run: | |
| 102 | + pip install -e .[test] |
| 103 | + if [ ${{ matrix.QT_LIB }} = "pyqt6" ]; then |
| 104 | + pip install pyqt6!=6.4.0 pyqt6-qt6!=6.4.0 coveralls pytest-cov |
| 105 | + else |
| 106 | + pip install ${{ matrix.QT_LIB }} coveralls pytest-cov |
| 107 | + fi |
| 108 | + - name: Show environment information |
| 109 | + shell: bash -el {0} |
| 110 | + run: | |
| 111 | + conda info |
| 112 | + conda list |
| 113 | + pip list |
| 114 | + - name: Run tests |
| 115 | + run: pytest -vv -s --full-trace --color=yes --cov=qtconsole qtconsole |
| 116 | + - name: Upload coverage to coveralls |
| 117 | + if: matrix.PYTHON_VERSION == '3.8' |
| 118 | + shell: bash -el {0} |
| 119 | + run: coveralls |
0 commit comments