Skip to content

Merge pull request #121 from enkaoua/master #199

Merge pull request #121 from enkaoua/master

Merge pull request #121 from enkaoua/master #199

Workflow file for this run

on: push
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-ver: [3.8]
experimental: [false]
include:
- python-ver: 3.9
os: ubuntu-latest
experimental: true
- python-ver: 3.9
os: windows-latest
experimental: true
- python-ver: 3.9
os: macos-latest
experimental: true
- python-ver: '3.10'
os: ubuntu-latest
experimental: true
- python-ver: '3.10'
os: macos-latest
experimental: true
- python-ver: '3.10'
os: windows-latest
experimental: true
- python-ver: 3.11
os: ubuntu-latest
experimental: true
- python-ver: 3.11
os: macos-latest
experimental: true
- python-ver: 3.11
os: windows-latest
experimental: true
- python-ver: 3.12-dev
os: ubuntu-latest
experimental: true
- python-ver: 3.12-dev
os: macos-latest
experimental: true
- python-ver: 3.12-dev
os: windows-latest
experimental: true
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-ver }}
# VTK uses OpenGL 2.0, but the windows Server version used on
# GitHub actions only has 1.1, so need to setup software rendering
# with Mesa.
# https://github.com/pal1000/mesa-dist-win
- name: Setup Mesa (Windows)
if: matrix.os == 'windows-latest'
run: |
curl --output mesa.7z -L https://github.com/pal1000/mesa-dist-win/releases/download/20.1.1-2/mesa3d-20.1.1-release-mingw.7z
7z x mesa.7z -omesa -y
# The script requires user input (choice of options) so need to
# fiddle to get it to run automatically. Not a clean way to do it,
# but works.
sed -i 's/@echo Please make a deployment choice:/@GOTO desktopgl/g' mesa\systemwidedeploy.cmd
sed -i 's/@echo Desktop OpenGL drivers deploy complete./@exit/g' mesa\systemwidedeploy.cmd
mesa\systemwidedeploy.cmd
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Install dependencies and run tests using xvfb (ubuntu-latest)
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install xvfb
sudo apt-get install libegl-dev
sudo apt-get install libxcb-cursor-dev
## Qt for X11 Requirements> https://doc.qt.io/qt-6/linux-requirements.html
sudo apt-get install libfontconfig1-dev libfreetype6-dev
sudo apt-get install libx11-dev libx11-xcb-dev
sudo apt-get install libxext-dev libxfixes-dev
sudo apt-get install libxi-dev libxrender-dev
sudo apt-get install libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev
sudo apt-get install libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev
sudo apt-get install libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev
sudo apt-get install libxcb-render-util0-dev libxcb-util-dev libxcb-xinerama0-dev libxcb-xkb-dev
sudo apt-get install libxkbcommon-dev libxkbcommon-x11-dev
export DISPLAY=:1
sudo Xvfb $DISPLAY -screen 0 1024x768x24 </dev/null &
export QT_DEBUG_PLUGINS=0
export QT_QPA_PLATFORM=xcb
export LD_LIBRARY_PATH=$pythonLocation"/lib/python${{ matrix.python-version }}/site-packages/PySide6/Qt/plugins/platforms"
coverage erase
coverage run -a --source ./sksurgerybard -m pytest -v -s
coverage report -m
- name: Run tests Windows/Mac
# Matches the 'o' in 'windows' or 'macos'
if: contains(matrix.os, 'o')
run: |
coverage erase
coverage run -a --source ./sksurgerybard -m pytest -v -s
coverage report -m
- name: Linting
run: |
pylint --rcfile=tests/pylintrc sksurgerybard
- name: Run coveralls
run: |
coveralls
deploy:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@master
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: python -m pip install wheel twine setuptools versioneer
- name: Build wheel
run: |
versioneer install
git restore --staged sksurgerybard/_version.py
git update-index --assume-unchanged sksurgerybard/_version.py
python setup.py sdist
- name: Publish package if tagged release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}