Skip to content

Commit

Permalink
Issue #5 added github actions CI
Browse files Browse the repository at this point in the history
  • Loading branch information
thompson318 committed Aug 10, 2020
1 parent 3e23112 commit 904f2fa
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 119 deletions.
1 change: 1 addition & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repo_token: DtQcYGAe3jLrJRcrzliM3lstQJiqIP930
109 changes: 109 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# 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.6, 3.7]
experimental: [false]
include:
- python-ver: 3.8
os: ubuntu-latest
experimental: true
- python-ver: 3.8
os: windows-latest
experimental: true
- python-ver: 3.8
os: macos-latest
experimental: true

runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
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 pip-tools
pip-compile requirements-dev.txt
pip install -r requirements-dev.txt
- name: Run tests using xvfb (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get install xvfb libxkbcommon-x11-0
sudo Xvfb :1 -screen 0 1024x768x24 </dev/null &
export DISPLAY=":1"
export LD_LIBRARY_PATH=$pythonLocation"/lib/python3.6/site-packages/PySide2/Qt/plugins/platfoms"
coverage erase
coverage run -a --source ./sksurgeryeval -m pytest
coverage report -m
- name: Run tests Windows/Mac
if: contains(matrix.os, 'o')
run: |
coverage erase
coverage run -a --source ./sksurgeryeval -m pytest
coverage report -m
- name: Linting
run: |
pylint --rcfile=tests/pylintrc sksurgeryeval
- name: Run coveralls
run: |
coveralls
deploy:
runs-on: ubuntu-18.04
needs: test
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@master
- name: Set up Python
uses: actions/setup-python@v1
with:
# TODO: python version for deploy?
python-version: 3.6

- 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@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
117 changes: 0 additions & 117 deletions .gitlab-ci.yml

This file was deleted.

2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ sphinx_rtd_theme
pyinstaller
pytest
tox
coveralls
pyyaml
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
description='A python library for performing surgical skills evaluation',
long_description=long_description,
long_description_content_type='text/x-rst',
url='https://weisslab.cs.ucl.ac.uk/WEISS/SoftwareRepositories/SNAPPY/scikit-surgery-evaluation',
url='https://github.com/UCL/scikit-surgery-evaluation',
author='Stephen Thompson',
author_email='YOUR-EMAIL@ucl.ac.uk',
license='BSD-3 license',
Expand Down Expand Up @@ -52,7 +52,7 @@
),

install_requires=[
'numpy>=1.11',
'numpy',
'ipykernel',
'nbsphinx',
'vtk',
Expand Down

0 comments on commit 904f2fa

Please sign in to comment.