Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actions #128

Merged
merged 7 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,56 @@ jobs:
- '3.8'
os:
- ubuntu-20.04
commands:
- 'install'
runs-on: ${{ matrix.os }}
services:
postgres:
image: postgres:11
env:
POSTGRES_DB: omero
POSTGRES_PASSWORD: omero
POSTGRES_USER: omero
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- name: Install Ice Java and Python binding
uses: ome/action-ice@v1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- name: Install Python dependencies
run: |
pip install flake8 tox wheel pytest
pip install omero-server[default]
- name: Run flake8
run: flake8 .
- name: Set up OMERO config
run: |
mkdir $HOME/OMERO
echo "config set omero.data.dir $HOME/OMERO" > $HOME/config.omero
echo "config set omero.db.name omero" >> $HOME/config.omero
echo "config set Ice.IPv6 0" >> $HOME/config.omero
- name: Get tox target
id: toxtarget
run: |
py=$(echo ${{ matrix.python-version }} | tr -d .)
echo "::set-output name=py::$py"
- name: Check Ice version
run: python -c 'import Ice; print(Ice.stringVersion())'
- name: Run tests
run:
tox -e py${{ steps.toxtarget.outputs.py }}
env:
# The hostname used to communicate with the PostgreSQL service container
POSTGRES_HOST: localhost
# The default PostgreSQL port
POSTGRES_PORT: 5432
POSTGRES_DB: omero
POSTGRES_PASSWORD: omero
POSTGRES_USER: omero
TEST: ${{ matrix.commands }}
3 changes: 2 additions & 1 deletion omego/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from __future__ import print_function
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases() # noqa

from builtins import str
from past.builtins import basestring
from builtins import object
Expand All @@ -27,6 +27,7 @@
except ImportError:
from elementtree.ElementTree import XML

standard_library.install_aliases() # noqa
log = logging.getLogger("omego.artifacts")


Expand Down
20 changes: 10 additions & 10 deletions omego/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ def parse(filename, MAX_TERM_COUNT=1000):
parents = []

termCount = 0
for l in f.readlines():
if l.startswith("id:"):
termId = l.strip()[4:]
if l.startswith("name:"):
name = l.strip()[6:]
elif l.startswith("def:"):
desc = l.strip()[5:]
elif l.startswith("is_a:"):
pid = l.strip()[6:].split(" ", 1)[0]
for line in f.readlines():
if line.startswith("id:"):
termId = line.strip()[4:]
if line.startswith("name:"):
name = line.strip()[6:]
elif line.startswith("def:"):
desc = line.strip()[5:]
elif line.startswith("is_a:"):
pid = line.strip()[6:].split(" ", 1)[0]
parents.append(pid)
if len(l) == 1: # newline
if len(line) == 1: # newline
# save
if termId is not None and name is not None:
terms[termId] = {'name': name, 'desc': desc,
Expand Down
2 changes: 1 addition & 1 deletion omego/fileutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from __future__ import division
from __future__ import print_function
from future import standard_library
standard_library.install_aliases() # noqa
from past.builtins import basestring
from builtins import object
from past.utils import old_div
Expand All @@ -20,6 +19,7 @@
import zipfile
from yaclifw.framework import Stop

standard_library.install_aliases() # noqa
log = logging.getLogger("omego.fileutils")


Expand Down
9 changes: 9 additions & 0 deletions test/integration/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,22 @@ def setup_class(self):
self.branch = 'OMERO-DEV-latest'
self.ice = '3.6'

@pytest.mark.skipif(True, reason='URL to be updated')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "URL to be updated" mean?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant: Change URL since it uses the old ci

def testDownloadNoUnzip(self, tmpdir):
with tmpdir.as_cwd():
self.download('--skipunzip', '--branch', self.branch,
'--ice', self.ice)
files = tmpdir.listdir()
assert len(files) == 1

@pytest.mark.skipif(True, reason='URL to be updated')
def testDownloadUnzip(self, tmpdir):
with tmpdir.as_cwd():
self.download('--branch', self.branch, '--ice', self.ice)
files = tmpdir.listdir()
assert len(files) == 2

@pytest.mark.skipif(True, reason='URL to be updated')
def testDownloadUnzipDir(self, tmpdir):
with tmpdir.as_cwd():
self.download('--unzipdir', 'OMERO.py', '--branch', self.branch,
Expand All @@ -66,6 +69,7 @@ def testDownloadUnzipDir(self, tmpdir):
assert expected.exists()
assert expected.isdir()

@pytest.mark.skipif(True, reason='URL to be updated')
def testDownloadSym(self, tmpdir):
with tmpdir.as_cwd():
self.download('--branch', self.branch, '--ice', self.ice,
Expand All @@ -88,6 +92,7 @@ def testDownloadSym(self, tmpdir):
assert sym2 == (old_div(tmpdir, 'custom.sym'))
assert sym2.isdir()

@pytest.mark.skipif(True, reason='URL to be updated')
def testDownloadRelease(self, tmpdir):
with tmpdir.as_cwd():
self.download('--release', 'latest', '--ice', self.ice)
Expand All @@ -98,6 +103,7 @@ def testDownloadNonExistingArtifact(self):
with pytest.raises(AttributeError):
self.download('-n', '--release', '5.3', '--ice', '3.3')

@pytest.mark.skipif(True, reason='URL to be updated')
def testDownloadBuildNumber(self):
# Old Jenkins artifacts are deleted so we can't download.
# Instead assert that an AttributeError is raised.
Expand All @@ -113,6 +119,7 @@ class TestDownloadBioFormats(Downloader):
def setup_class(self):
self.branch = 'BIOFORMATS-DEV-latest'

@pytest.mark.skipif(True, reason='URL to be updated')
def testDownloadJar(self, tmpdir):
self.artifact = 'formats-api'
with tmpdir.as_cwd():
Expand All @@ -121,6 +128,7 @@ def testDownloadJar(self, tmpdir):
assert len(files) == 1
assert files[0].basename == 'formats-api.jar'

@pytest.mark.skipif(True, reason='URL to be updated')
def testDownloadFullFilename(self, tmpdir):
self.artifact = 'formats-api'
with tmpdir.as_cwd():
Expand All @@ -136,6 +144,7 @@ def setup_class(self):
self.artifact = ''
self.branch = 'latest'

@pytest.mark.skipif(True, reason='URL to be updated')
def testDownloadList(self, tmpdir):
with tmpdir.as_cwd():
self.download('--branch', self.branch)
Expand Down
5 changes: 2 additions & 3 deletions test/integration/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def testSkipunzip(self):
self.upgrade("--skipunzip")

@pytest.mark.slowtest
@pytest.mark.skipif(True, reason='URL to be updated')
def testUpgrade(self):
args = ["--branch=OMERO-DEV-latest"]
# Python 3.6 on Travis: Force OMERO to run with 2.7 instead
Expand All @@ -58,9 +59,7 @@ def testUpgrade(self):
self.upgrade(*args)

@pytest.mark.slowtest
@pytest.mark.skipif(
getenv('TRAVIS_PYTHON_VERSION') == '3.6',
reason='OMERO not supported on Python 3.6')
@pytest.mark.skipif(True, reason='OMERO not supported on Python 3.6')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this still hold if you've bumped to Py38?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not re-activated the tests in this PR. I have actually skipped a good number due to URL.
This will be a second body of work

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not re-activated the tests in this PR

Fair enough. The comment might just be slightly confusing.

def testUpgradePython3(self):
self.upgrade("--branch=OMERO-DEV-latest")

Expand Down
12 changes: 6 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# and then run "tox" from this directory.

[tox]
envlist = py27, py36
envlist = py27, py38
# https://tox.readthedocs.io/en/latest/config.html#conf-requires
# Ensure pip is new so we can install manylinux wheel
requires = pip >= 19.0.0
Expand All @@ -24,15 +24,15 @@ deps =
setuptools>=40.0
https://github.com/ome/zeroc-ice-py-manylinux/releases/download/0.1.0/zeroc_ice-3.6.5-cp27-cp27mu-manylinux2010_x86_64.whl

[testenv:py36travis]
basepython = python3.6
[testenv:py38travis]
basepython = python3.8
platform = linux.*
deps =
setuptools>=40.0
https://github.com/ome/zeroc-ice-py-manylinux/releases/download/0.1.0/zeroc_ice-3.6.5-cp36-cp36m-manylinux2010_x86_64.whl
https://github.com/ome/zeroc-ice-ubuntu2004/releases/download/0.2.0/zeroc_ice-3.6.5-cp38-cp38-linux_x86_64.whl

; [testenv:py27]
; basepython = /CONDA/envs/tox-py27/bin/python

; [testenv:py36]
; basepython = /CONDA/envs/tox-py36/bin/python
; [testenv:py38]
; basepython = /CONDA/envs/tox-py38/bin/python
10 changes: 6 additions & 4 deletions travis-build
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,18 @@ fi
#Install a new server without web
#Tests rely on a non-zero error code being returned on failure
if [ $TEST = install ]; then
omego install --initdb --dbhost localhost --dbname omero --prestartfile $HOME/config.omero -v --release 5.3.5 --ice 3.6 --no-web $OMEGO_OMERO_PYTHON
export OMERODIR='./OMERO.server-5.6.4-ice36-b232'
omego install --initdb --dbhost localhost --dbname omero --prestartfile $HOME/config.omero -v --release 5.6.4 --ice 3.6 --no-web --no-start

ls OMERO.server
# Should return 0 DB_UPTODATE
omego db upgrade -n --dbhost localhost --dbname omero --serverdir OMERO.server-5.3.5-ice36-b73 $OMEGO_OMERO_PYTHON
omego db upgrade -n --dbhost localhost --dbname omero --serverdir OMERO.server

# Check the expected server version was downloaded
test $(readlink OMERO.server) = './OMERO.server-5.3.5-ice36-b73'
test $(readlink OMERO.server) = $OMERODIR

# Check db dump file
omego db dump --serverdir OMERO.server --dumpfile travis-omero.pgdump $OMEGO_OMERO_PYTHON
omego db dump --serverdir OMERO.server --dumpfile travis-omero.pgdump

pg_restore -l travis-omero.pgdump | grep 'dbpatch_versions_trigger'
fi
Expand Down