-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Build new docker image | ||
|
||
on: | ||
# Triggers the workflow on push or pull request events but only for the 2.x branch | ||
push: | ||
branches: [ 2.x ] | ||
# pull_request: | ||
# branches: [ 2.x ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: 'ubuntu-latest' | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Show workspace | ||
run: echo ${{ github.workspace }} | ||
|
||
- name: Checkout senaite.docker | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: "senaite/senaite.docker" | ||
path: "senaite.docker" | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ${{ github.workspace }}/senaite.docker/latest | ||
file: ${{ github.workspace }}/senaite.docker/latest/Dockerfile | ||
no-cache: true | ||
push: true | ||
# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context | ||
tags: senaite/senaite:edge,senaite/senaite:${{ github.ref_name }} | ||
|
||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<configure | ||
xmlns="http://namespaces.zope.org/zope" | ||
xmlns:browser="http://namespaces.zope.org/browser" | ||
xmlns:plone="http://namespaces.plone.org/plone" | ||
xmlns:zcml="http://namespaces.zope.org/zcml" | ||
i18n_domain="plone"> | ||
|
||
<include package="plone.behavior" file="meta.zcml"/> | ||
|
||
<!-- -*- extra stuff goes here -*- --> | ||
|
||
<plone:behavior | ||
name="bika.aquaculture.ext_sample_point" | ||
title="ExtSamplePoint" | ||
description="Extends/Customises Sample Point" | ||
provides=".ext_sample_point.IExtSamplePoint" | ||
factory=".ext_sample_point.ExtSamplePoint" | ||
marker=".ext_sample_point.IExtSamplePointMarker" | ||
/> | ||
|
||
|
||
</configure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from bika.aquaculture import _ | ||
from plone import schema | ||
from plone.autoform.interfaces import IFormFieldProvider | ||
from plone.supermodel import model | ||
from Products.CMFPlone.utils import safe_hasattr | ||
from zope.component import adapter | ||
from zope.interface import Interface | ||
from zope.interface import implementer | ||
from zope.interface import provider | ||
|
||
|
||
class IExtSamplePointMarker(Interface): | ||
pass | ||
|
||
|
||
@provider(IFormFieldProvider) | ||
class IExtSamplePoint(model.Schema): | ||
""" | ||
""" | ||
|
||
project = schema.TextLine( | ||
title=_(u'Project'), | ||
description=_(u'Give in a project name'), | ||
required=False, | ||
) | ||
|
||
|
||
@implementer(IExtSamplePoint) | ||
@adapter(IExtSamplePointMarker) | ||
class ExtSamplePoint(object): | ||
def __init__(self, context): | ||
self.context = context | ||
|
||
@property | ||
def project(self): | ||
if safe_hasattr(self.context, 'project'): | ||
return self.context.project | ||
return None | ||
|
||
@project.setter | ||
def project(self, value): | ||
self.context.project = value |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/bika/aquaculture/tests/test_behavior_ext_sample_point.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# -*- coding: utf-8 -*- | ||
from bika.aquaculture.behaviors.ext_sample_point import IExtSamplePointMarker | ||
from bika.aquaculture.testing import BIKA_AQUACULTURE_INTEGRATION_TESTING # noqa | ||
from plone.app.testing import setRoles | ||
from plone.app.testing import TEST_USER_ID | ||
from plone.behavior.interfaces import IBehavior | ||
from zope.component import getUtility | ||
|
||
import unittest | ||
|
||
|
||
class ExtSamplePointIntegrationTest(unittest.TestCase): | ||
|
||
layer = BIKA_AQUACULTURE_INTEGRATION_TESTING | ||
|
||
def setUp(self): | ||
"""Custom shared utility setup for tests.""" | ||
self.portal = self.layer['portal'] | ||
setRoles(self.portal, TEST_USER_ID, ['Manager']) | ||
|
||
def test_behavior_ext_sample_point(self): | ||
behavior = getUtility(IBehavior, 'bika.aquaculture.ext_sample_point') | ||
self.assertEqual( | ||
behavior.marker, | ||
IExtSamplePointMarker, | ||
) |