Skip to content

Commit

Permalink
Unify and modernize CI test scripts and runner jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
CAM-Gerlach committed Oct 23, 2021
1 parent d43d848 commit 7cb7db5
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 184 deletions.
165 changes: 82 additions & 83 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,114 +1,113 @@
# Run the project's test suite
name: Tests

on:
# This avoids having duplicate builds for a pull request
push:
branches:
- master
- main
- '*.x'
pull_request:
branches:
- master
- main
- '*.x'

jobs:
linux:
name: Linux Py${{ matrix.PYTHON_VERSION }} conda=${{ matrix.USE_CONDA }}
runs-on: ubuntu-latest
test:
name: Test ${{ matrix.os }} Python ${{ matrix.python-version }} conda=${{ matrix.use-conda }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.special-invocation }}bash -l {0}
env:
CI: True
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
USE_CONDA: ${{ matrix.USE_CONDA }}
CI: 'True'
PYTHON_VERSION: ${{ matrix.python-version }}
USE_CONDA: ${{ matrix.use-conda }}
QT_VERSION_ARG: ${{ matrix.qt-version-arg }}
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.6', '3.8']
USE_CONDA: ['Yes', 'No']
include:
- os: ubuntu-latest
python-version: '3.8'
use-conda: 'Yes'
special-invocation: 'xvfb-run --auto-servernum '
coverage: 'True'
- os: ubuntu-latest
python-version: '3.8'
use-conda: 'No'
special-invocation: 'xvfb-run --auto-servernum '
- os: ubuntu-latest
python-version: '3.6'
use-conda: 'Yes'
special-invocation: 'xvfb-run --auto-servernum '
- os: ubuntu-latest
python-version: '3.6'
use-conda: 'No'
special-invocation: 'xvfb-run --auto-servernum '
- os: windows-latest
python-version: '3.8'
use-conda: 'Yes'
skip-pyside2: true
- os: windows-latest
python-version: '3.8'
use-conda: 'No'
- os: windows-latest
python-version: '3.6'
use-conda: 'Yes'
qt-version-arg: '=5.9'
- os: windows-latest
python-version: '3.6'
use-conda: 'No'
- os: macos-latest
python-version: '3.8'
use-conda: 'Yes'
skip-pyside2: true # No wheel on Windows and Python 3.8?
- os: macos-latest
python-version: '3.8'
use-conda: 'No'
- os: macos-latest
python-version: '3.6'
use-conda: 'Yes'
- os: macos-latest
python-version: '3.6'
use-conda: 'No'
steps:
- name: Checkout branch
uses: actions/checkout@v2
- name: Install System Packages
- name: Install Linux system packages
if: contains(matrix.os, 'ubuntu')
shell: bash
run: |
sudo apt update
sudo apt install libpulse-dev libegl1-mesa libopengl0
- name: Install Conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: ''
auto-activate-base: true
auto-update-conda: true
auto-activate-base: false
- name: Test PyQt5
channels: conda-forge
- name: Print Conda info
shell: bash -l {0}
run: |
eval "$(conda shell.bash hook)"
xvfb-run --auto-servernum bash -l ./.github/workflows/test-pyqt5.sh
- name: Test PySide2
shell: bash -l {0}
run: xvfb-run --auto-servernum bash -l ./.github/workflows/test-pyside2.sh
- name: Test PySide6
shell: bash -l {0}
run: xvfb-run --auto-servernum bash -l ./.github/workflows/test-pyside6.sh
- name: Upload coverage
if: matrix.PYTHON_VERSION == '3.8'
shell: bash -l {0}
run: bash -l ./.github/workflows/coverage.sh

macos:
name: Mac Py${{ matrix.PYTHON_VERSION }} conda=${{ matrix.USE_CONDA }}
runs-on: macos-latest
env:
CI: True
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
USE_CONDA: ${{ matrix.USE_CONDA }}
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.6', '3.8']
USE_CONDA: ['Yes', 'No']
steps:
- name: Checkout branch
uses: actions/checkout@v2
- name: Install Conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: ''
auto-update-conda: true
auto-activate-base: false
- name: Test PyQt5
shell: bash -l {0}
run: bash -l ./.github/workflows/test-pyqt5.sh
- name: Test PySide2
shell: bash -l {0}
run: bash -l ./.github/workflows/test-pyside2.sh
- name: Test PySide6
shell: bash -l {0}
run: bash -l ./.github/workflows/test-pyside6.sh

windows:
name: Windows Py${{ matrix.PYTHON_VERSION }} conda=${{ matrix.USE_CONDA }}
runs-on: windows-latest
env:
CI: True
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
USE_CONDA: ${{ matrix.USE_CONDA }}
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.6', '3.8']
USE_CONDA: ['Yes', 'No']
steps:
- name: Checkout branch
uses: actions/checkout@v2
- name: Install Conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: ''
auto-update-conda: true
auto-activate-base: true
conda info
conda list
- name: Test PyQt5
shell: bash -l {0}
run: bash -l ./.github/workflows/test-pyqt5.sh
if: (! matrix.skip-pyqt5)
run: ./.github/workflows/test.sh pyqt5
- name: Test PySide2
shell: bash -l {0}
run: bash -l ./.github/workflows/test-pyside2.sh
if: (! ((matrix.skip-pyside2) || (matrix.use-conda == 'Yes'))) # No conda packages for Pyside2?
run: ./.github/workflows/test.sh pyside2
- name: Test PySide6
shell: bash -l {0}
run: bash -l ./.github/workflows/test-pyside6.sh
if: (! ((matrix.skip-pyside6) || (matrix.use-conda == 'Yes'))) # No conda packages yet for Pyside6
run: ./.github/workflows/test.sh pyside6
- name: Upload coverage data to coveralls.io
if: matrix.coverage
shell: bash
env:
COVERALLS_REPO_TOKEN: 'xh75EzxFFMoTEyNPo3wXxXv8OVkul3eE5'
run: |
python3 -m pip install --upgrade coveralls
python3 -m coveralls --service=github-actions || true
11 changes: 0 additions & 11 deletions .github/workflows/coverage.sh

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/test-pyqt5.sh

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/test-pyside2.sh

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/test-pyside6.sh

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash -ex

# Activate conda properly
eval "$(conda shell.bash hook)"

# Set conda channel
if [ "$USE_CONDA" = "No" ]; then
CONDA_CHANNEL_ARG="-c anaconda"
fi

# Create conda environment for this test
conda create -q -n test-${1} ${CONDA_CHANNEL_ARG} python=${PYTHON_VERSION} coveralls pytest pytest-cov
conda activate test-${1}

if [ "$USE_CONDA" = "Yes" ]; then
conda install -q qt${QT_VERSION_ARG}

if [ "${1}" = "pyqt5" ]; then
conda install -q pyqt
else
exit 1
fi

else

if [ "${1}" = "pyqt5" ]; then
pip install pyqt5 PyQtWebEngine
elif [ "${1}" = "pyside2" ]; then
pip install pyside2==5.12
elif [ "${1}" = "pyside6" ]; then
pip install pyside6==6.2
else
exit 1
fi

fi

# Install package
pip install -e .

# Print environment information
conda list

# Run tests
python qtpy/tests/runtests.py

0 comments on commit 7cb7db5

Please sign in to comment.