-
Notifications
You must be signed in to change notification settings - Fork 3
110 lines (97 loc) · 4.14 KB
/
Copy pathci.yml
File metadata and controls
110 lines (97 loc) · 4.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# CI for this library is a bit tricky, as an working display/GFX card is
# expected to do the rendering. We use a fake display for Windows/Linux, and
# don't run CI on Mac. Running tests locally is simpler!
on: push
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-ver: [3.9, '3.10', 3.11, 3.12, 3.13]
experimental: [false]
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
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 python dependencies in requirements-dev
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 ./sksurgeryutils -m pytest -v -s
coverage report -m
- name: Run tests Windows/Mac
if: contains(matrix.os, 'o')
run: |
coverage erase
coverage run -a --source ./sksurgeryutils -m pytest -v -s
coverage report -m
- name: Linting
run: |
pylint --rcfile=tests/pylintrc sksurgeryutils
- name: Run coveralls
run: |
coveralls
deploy:
runs-on: ubuntu-latest
needs: test
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.13
- name: Install dependencies
run: python -m pip install wheel twine setuptools
- name: Build wheel
run: |
python setup.py sdist bdist_wheel
- 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