Continuous Integration #780
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration | |
on: | |
schedule: | |
- cron: '0 0 * * 2' | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
paths: | |
- .github/workflows/ci.yml | |
- "enaml/**" | |
- "examples/**" | |
- "tests/**" | |
- setup.py | |
- pyproject.toml | |
jobs: | |
tests: | |
name: Unit tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ['3.10', '3.11', '3.12', '3.13'] | |
qt-version: [5, 6] | |
qt-binding: [pyqt, pyside] | |
exclude: | |
- python-version: '3.10' | |
qt-version: 5 | |
qt-binding: pyside | |
- python-version: '3.11' | |
qt-version: 5 | |
- python-version: '3.12' | |
qt-version: 5 | |
- python-version: '3.13' | |
qt-version: 5 | |
- python-version: '3.12' | |
qt-version: 6 | |
qt-binding: pyside | |
- python-version: '3.13' | |
qt-version: 6 | |
qt-binding: pyside | |
- os: ubuntu-latest | |
qt-version: 6 | |
qt-binding: pyside | |
fail-fast: false | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Install linux only test dependency | |
if: matrix.os == 'ubuntu-latest' | |
# Install all dependencies needed to run Qt on linux (taken from the qt website) | |
run: | | |
sudo apt-get update --fix-missing; | |
if [ "${{ matrix.qt-version }}" == 5 ]; then | |
cat ci/qt5_linux.txt | xargs sudo apt-get -y install | |
else | |
cat ci/qt6_linux.txt | xargs sudo apt-get -y install | |
fi | |
sudo apt-get install -y herbstluftwm scrot | |
- name: Get history and tags for SCM versioning to work | |
run: | | |
git fetch --prune --unshallow | |
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: 'test_requirements.txt' | |
- name: Install dependencies | |
# Skip pegen deps because of https://github.com/we-like-parsers/pegen/issues/53 | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools-scm[toml] | |
pip install numpy | |
pip install git+https://github.com/nucleic/cppy@main | |
pip install git+https://github.com/nucleic/atom@main | |
pip install git+https://github.com/MatthieuDartiailh/bytecode@main | |
pip install git+https://github.com/nucleic/kiwi@main | |
- name: Install project (no-extras) | |
if: matrix.python-version != '3.10' | |
env: | |
CPPFLAGS: --coverage | |
# Build extensions manually to allow getting C coverage data | |
run: | | |
pip install -e .[qt${{ matrix.qt-version }}-${{ matrix.qt-binding }}] | |
- name: Install project (with-extras pyqt) | |
if: matrix.python-version == '3.10' && matrix.qt-binding == 'pyqt' | |
env: | |
CPPFLAGS: --coverage | |
# Build extensions manually to allow getting C coverage data | |
run: | | |
pip install -e .[qt${{ matrix.qt-version }}-${{ matrix.qt-binding }},ipython-qt,matplotlib-qt,scintilla-qt${{ matrix.qt-version }}-pyqt,webview-qt${{ matrix.qt-version }}-pyqt] | |
- name: Install project (with-extras pyside) | |
if: matrix.python-version == '3.10' && matrix.qt-binding != 'pyqt' | |
env: | |
CPPFLAGS: --coverage | |
# Build extensions manually to allow getting C coverage data | |
run: | | |
pip install -e .[qt${{ matrix.qt-version }}-${{ matrix.qt-binding }},ipython-qt,matplotlib-qt] | |
- name: Install test requirements | |
run: | | |
pip install -r test_requirements.txt | |
- name: Run tests (Windows, Mac) | |
if: matrix.os != 'ubuntu-latest' | |
run: python -X dev -m pytest tests -v --cov --cov-report xml -rs | |
- name: Run tests (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
shell: bash -l {0} | |
run: | | |
pip uninstall python3-xlib --yes | |
pip install python-xlib | |
export DISPLAY=:99.0 | |
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX +render -noreset | |
sleep 3 | |
herbstluftwm & | |
sleep 1 | |
python -X dev -m pytest tests -v --cov --cov-report xml -rs | |
- name: Generate C++ coverage reports | |
if: (github.event_name != 'schedule' && matrix.os != 'windows-latest') | |
run: | | |
bash -c "find . -type f -name '*.gcno' -exec gcov -pb --all-blocks {} +" || true | |
ls | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: unittests | |
name: codecov-umbrella | |
fail_ci_if_error: true | |
verbose: true | |
files: ./coverage.xml,*.gcov |