From 838520a459170e8210bc2972359558e91213aa57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jordi=20Puiggen=C3=A9?= Date: Sat, 15 Jun 2024 12:48:52 +0200 Subject: [PATCH] Fix build and test --- .github/ISSUE_TEMPLATE.md | 7 ++ .github/PULL_REQUEST_TEMPLATE.md | 14 ++++ .github/workflows/build-and-test.yml | 30 ++++++++ README.rst | 22 +++++- buildout.cfg | 101 +-------------------------- src/senaite/referral/tests/utils.py | 2 +- 6 files changed, 72 insertions(+), 104 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/build-and-test.yml diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..9f42775 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,7 @@ +## Steps to reproduce + +## Current behavior + +## Expected behavior + +## Screenshot (optional) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..c36449f --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,14 @@ +## Description of the issue/feature this PR addresses + +Linked issue: https://github.com/senaite/senaite.referral/issues/ + +## Current behavior before PR + +## Desired behavior after PR is merged + +-- +I confirm I have tested this PR thoroughly and coded it according to [PEP8][1] +and [Plone's Python styleguide][2] standards. + +[1]: https://www.python.org/dev/peps/pep-0008 +[2]: https://docs.plone.org/develop/styleguide/python.html diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..f969bcf --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,30 @@ +name: build and test senaite.referral +on: + - push + - pull_request +env: + PLONE_VERSION: "5.2" +jobs: + build-and-test: + runs-on: 'ubuntu-20.04' + container: + image: python:2.7.18-buster + steps: + - uses: actions/checkout@v3 + - name: cache eggs + uses: actions/cache@v3 + with: + key: eggs-cache-${{ hashFiles('buildout.cfg', 'requirements.txt') }} + path: | + eggs/ + - name: install + run: | + pip install virtualenv + virtualenv -p `which python` . + bin/pip install --upgrade pip + bin/pip install -r requirements.txt + bin/buildout -N -t 3 annotate + bin/buildout -N -t 3 + - name: test + run: | + bin/test -s senaite.referral.tests diff --git a/README.rst b/README.rst index baf8931..7b66cdb 100644 --- a/README.rst +++ b/README.rst @@ -1,18 +1,34 @@ Sample Referral for SENAITE =========================== +.. image:: https://img.shields.io/pypi/v/senaite.referral.svg?style=flat-square + :target: https://pypi.python.org/pypi/senaite.referral + +.. image:: https://img.shields.io/github/actions/workflow/status/senaite/senaite.referral/build-and-test.yml?branch=2.x + :target: https://github.com/senaite/senaite.referral/actions/workflows/build-and-test.yml?query=branch:2.x + +.. image:: https://img.shields.io/github/issues-pr/senaite/senaite.referral.svg?style=flat-square + :target: https://github.com/senaite/senaite.referral/pulls + +.. image:: https://img.shields.io/github/issues/senaite/senaite.referral.svg?style=flat-square + :target: https://github.com/senaite/senaite.referral/issues + +.. image:: https://img.shields.io/badge/Made%20for%20SENAITE-%E2%AC%A1-lightgrey.svg + :target: https://www.senaite.com + + About ----- **NOT READY FOR PRODUCTION** -SENAITE.REFERRAL adds the ability to transfer and refer samples across different -instances of `SENAITE LIMS`_. +SENAITE.REFERRAL adds the ability to transfer and refer samples across +different instances of `SENAITE LIMS`_. License ------- -**SENAITE.REFERRAL** Copyright (C) 2021 RIDING BYTES & NARALABS +**SENAITE.REFERRAL** Copyright (C) 2021-2024 RIDING BYTES & NARALABS This program is free software; you can redistribute it and/or modify it under the terms of the `GNU General Public License version 2`_ as published diff --git a/buildout.cfg b/buildout.cfg index 790ea6f..a61a7eb 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -1,102 +1,3 @@ [buildout] -index = https://pypi.org/simple/ -extends = https://dist.plone.org/release/5.2-latest/versions.cfg -find-links = - https://dist.plone.org/release/5.2-latest/ - https://dist.plone.org/thirdparty/ - -parts = - instance - test - omelette - i18ndude - zopepy - update_translations - write_code_headers - -eggs = - senaite.core - senaite.app.listing - senaite.app.spotlight - senaite.app.supermodel - senaite.impress - senaite.jsonapi - senaite.lims - senaite.referral - plone.reload - Products.PrintingMailHost - -extensions = mr.developer - +extends = https://raw.githubusercontent.com/senaite/senaite.core/2.x/buildout.base.cfg package-name = senaite.referral - -versions = versions -show-picked-versions = true - -plone-user = admin:admin - -develop = . -sources = sources -auto-checkout = * - -[sources] -senaite.core = git https://github.com/senaite/senaite.core.git pushurl=git@github.com:senaite/senaite.core.git branch=2.x -senaite.app.listing = git https://github.com/senaite/senaite.app.listing.git pushurl=git@github.com:senaite/senaite.app.listing.git branch=2.x -senaite.app.spotlight = git https://github.com/senaite/senaite.app.spotlight.git pushurl=git@github.com:senaite/senaite.app.spotlight.git branch=2.x -senaite.app.supermodel = git https://github.com/senaite/senaite.app.supermodel.git pushurl=git@github.com:senaite/senaite.app.supermodel.git branch=2.x -senaite.impress = git https://github.com/senaite/senaite.impress.git pushurl=git@github.com:senaite/senaite.impress.git branch=2.x -senaite.jsonapi = git https://github.com/senaite/senaite.jsonapi.git pushurl=git@github.com:senaite/senaite.jsonapi.git branch=2.x -senaite.lims = git https://github.com/senaite/senaite.lims.git pushurl=git@github.com:senaite/senaite.lims.git branch=2.x - -[instance] -recipe = plone.recipe.zope2instance -http-address = 127.0.0.1:8080 -user = ${buildout:plone-user} -wsgi = off -eggs = - Plone - plone.app.upgrade - ${buildout:package-name} - ${buildout:eggs} -deprecation-warnings = on -environment-vars = - zope_i18n_compile_mo_files true -zcml = - -[i18ndude] -unzip = true -recipe = zc.recipe.egg -eggs = i18ndude - -[update_translations] -recipe = collective.recipe.template -output = ${buildout:directory}/bin/update_translations -input = ${buildout:directory}/templates/update_translations.in -mode = 755 - -[write_code_headers] -recipe = collective.recipe.template -output = ${buildout:directory}/bin/write_code_headers -input = ${buildout:directory}/templates/write_code_headers.py.in -mode = 755 - -[test] -recipe = zc.recipe.testrunner -defaults = ['--auto-color', '--auto-progress'] -eggs = - senaite.referral [test] - -[omelette] -recipe = collective.recipe.omelette -eggs = ${buildout:eggs} - -[zopepy] -recipe = zc.recipe.egg -eggs = ${instance:eggs} -interpreter = zopepy -scripts = zopepy - -[versions] -# versions taken from requirements.txt -setuptools = -zc.buildout = diff --git a/src/senaite/referral/tests/utils.py b/src/senaite/referral/tests/utils.py index c929329..843ab78 100644 --- a/src/senaite/referral/tests/utils.py +++ b/src/senaite/referral/tests/utils.py @@ -44,7 +44,7 @@ def setup_baseline_data(portal): api.create(setup.bika_sampletypes, "SampleType", title="Water", Prefix="W") lab_contact = api.create(setup.bika_labcontacts, "LabContact", Firstname="Lab", Lastname="Manager") department = api.create(portal.setup.departments, "Department", title="Chemistry", Manager=lab_contact) - category = api.create(setup.bika_analysiscategories, "AnalysisCategory", title="Metals", Department=department) + category = api.create(portal.setup.analysiscategories, "AnalysisCategory", title="Metals", Department=department) api.create(setup.bika_analysisservices, "AnalysisService", title="Copper", Keyword="Cu", Category=category.UID()) api.create(setup.bika_analysisservices, "AnalysisService", title="Iron", Keyword="Fe", Category=category.UID()) api.create(portal.external_labs, "ExternalLaboratory", code="EXT1", reference=True)