Skip to content

Commit

Permalink
Merge pull request #70 from sbesson/ghactions
Browse files Browse the repository at this point in the history
Switch from Travis CI to GitHub workflows
  • Loading branch information
jburel authored Dec 16, 2020
2 parents 6e22ad6 + c22dbf5 commit 5f690f9
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 55 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: PyPI
on: push

jobs:
build-n-publish:
name: Build and publish Python distribution to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Build a binary wheel and a source tarball
run: |
python -mpip install wheel
python setup.py sdist bdist_wheel
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@v1.3.0
with:
password: ${{ secrets.PYPI_PASSWORD }}
32 changes: 32 additions & 0 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Tox
on:
push:
pull_request:

jobs:
test:
name: Run tox tests
strategy:
fail-fast: false
matrix:
python-version:
- '3.6'
- '3.7'
- '3.8'
- '3.9'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: python -mpip install --upgrade wheel pytest tox
- name: Get tox target
id: toxtarget
run: |
py=$(echo ${{ matrix.python-version }} | tr -d .)
echo "::set-output name=py::$py"
- name: Run tests
run: tox -e py${{ steps.toxtarget.outputs.py }}
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.. image:: https://travis-ci.org/ome/omero-marshal.png
:target: https://travis-ci.org/ome/omero-marshal
.. image:: https://github.com/ome/omero-marshal/workflows/Tox/badge.svg
:target: https://github.com/ome/omero-marshal/actions

.. image:: https://img.shields.io/pypi/v/omero-marshal.svg
:alt: PyPI
Expand Down
47 changes: 23 additions & 24 deletions tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ def roi_with_shapes_and_annotations(roi, ellipse, rectangle):
return roi


def populate_shape(o, set_unit_attributes=True):
def populate_shape(o, transform, set_unit_attributes=True):
o.fillColor = rint(0xffffffff)
o.fillRule = rstring('solid')
o.fontFamily = rstring('cursive')
Expand All @@ -503,11 +503,10 @@ def populate_shape(o, set_unit_attributes=True):
o.theC = rint(1)
o.theT = rint(2)
o.theZ = rint(3)
t = identity_transform()
if SCHEMA_VERSION == '2015-01':
o.transform = t.svg_transform
o.transform = transform.svg_transform
else:
o.transform = t
o.transform = transform
return o


Expand Down Expand Up @@ -576,9 +575,9 @@ def scale_transform():


@pytest.fixture()
def ellipse():
def ellipse(identity_transform):
o = EllipseI()
populate_shape(o)
populate_shape(o, identity_transform)
if SCHEMA_VERSION == '2015-01':
o.cx = rdouble(1.0)
o.cy = rdouble(2.0)
Expand All @@ -594,16 +593,16 @@ def ellipse():


@pytest.fixture()
def ellipse_with_annotations():
o = ellipse()
def ellipse_with_annotations(ellipse):
o = ellipse
add_annotations(o)
return o


@pytest.fixture()
def rectangle():
def rectangle(identity_transform):
o = RectangleI()
populate_shape(o)
populate_shape(o, identity_transform)
o.x = rdouble(1.0)
o.y = rdouble(2.0)
o.width = rdouble(3.0)
Expand All @@ -613,9 +612,9 @@ def rectangle():


@pytest.fixture()
def point():
def point(identity_transform):
o = PointI()
populate_shape(o)
populate_shape(o, identity_transform)
if SCHEMA_VERSION == '2015-01':
o.cx = rdouble(1.0)
o.cy = rdouble(2.0)
Expand All @@ -627,19 +626,19 @@ def point():


@pytest.fixture()
def label():
def label(identity_transform):
o = LabelI()
populate_shape(o)
populate_shape(o, identity_transform)
o.x = rdouble(1.0)
o.y = rdouble(2.0)
o.id = rlong(7)
return o


@pytest.fixture()
def polyline():
def polyline(identity_transform):
o = PolylineI()
populate_shape(o)
populate_shape(o, identity_transform)
o.points = rstring('0,0 1,2 3,5')
if SCHEMA_VERSION != '2015-01':
o.setMarkerStart('Arrow')
Expand All @@ -649,18 +648,18 @@ def polyline():


@pytest.fixture()
def polygon():
def polygon(identity_transform):
o = PolygonI()
populate_shape(o)
populate_shape(o, identity_transform)
o.points = rstring('0,0 1,2 3,5')
o.id = rlong(5)
return o


@pytest.fixture()
def line():
def line(identity_transform):
o = LineI()
populate_shape(o)
populate_shape(o, identity_transform)
o.setX1(0)
o.setY1(0)
o.setX2(1)
Expand All @@ -673,19 +672,19 @@ def line():


@pytest.fixture()
def opt_unit_label():
def opt_unit_label(identity_transform):
o = LabelI()
populate_shape(o, False)
populate_shape(o, identity_transform, False)
o.x = rdouble(1.0)
o.y = rdouble(2.0)
o.id = rlong(7)
return o


@pytest.fixture()
def mask():
def mask(identity_transform):
o = MaskI()
populate_shape(o)
populate_shape(o, identity_transform)
o.x = rdouble(0.0)
o.y = rdouble(0.0)
o.width = rdouble(1.0)
Expand Down
30 changes: 30 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[tox]
envlist = py36, py37, py38, py39
# https://tox.readthedocs.io/en/latest/config.html#conf-requires
# Ensure pip is new enough
requires = pip >= 19.0.0
virtualenv >= 16.0.0

[testenv]
# For environment markers see
# https://www.python.org/dev/peps/pep-0508/#environment-markers
deps =
flake8
omero-py
pytest-rerunfailures
pytest-xdist
restructuredtext-lint
https://github.com/ome/zeroc-ice-py-github-ci/releases/download/0.1.0/zeroc_ice-3.6.5-cp36-cp36m-linux_x86_64.whl; platform_system=="Linux" and python_version=="3.6"
https://github.com/ome/zeroc-ice-py-github-ci/releases/download/0.1.0/zeroc_ice-3.6.5-cp37-cp37m-linux_x86_64.whl; platform_system=="Linux" and python_version=="3.7"
https://github.com/ome/zeroc-ice-py-github-ci/releases/download/0.1.0/zeroc_ice-3.6.5-cp38-cp38-linux_x86_64.whl; platform_system=="Linux" and python_version=="3.8"
https://github.com/ome/zeroc-ice-py-github-ci/releases/download/0.1.0/zeroc_ice-3.6.5-cp39-cp39-linux_x86_64.whl; platform_system=="Linux" and python_version=="3.9"
commands =
rst-lint README.rst
flake8 .
python setup.py sdist install --record files.txt
python -c 'import omero.clients; import omero_marshal.encode'
pytest {posargs:-n4 -rf tests -s}
sh -c 'cat files.txt | xargs rm -rf'
python setup.py bdist_egg
sh -c 'easy_install dist/*.egg'
python -c 'import omero.clients; import omero_marshal.encode'

0 comments on commit 5f690f9

Please sign in to comment.