Skip to content

Commit

Permalink
Merge pull request #51 from eea/develop
Browse files Browse the repository at this point in the history
First release
  • Loading branch information
laszlocseh authored Jul 26, 2024
2 parents 9cd607f + 6eeec2b commit d477ca4
Show file tree
Hide file tree
Showing 35 changed files with 1,093 additions and 136 deletions.
1 change: 1 addition & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
static/*
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Changelog
=========


1.0a1 (unreleased)
1.1-dev0 (unreleased)
------------------

- Initial release.
Expand Down
226 changes: 226 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
pipeline {
agent any

environment {
GIT_NAME = "wise.theme"
GIT_HISTORYFILE = "CHANGES.rst"
SONARQUBE_TAGS = "water.eea.europa.eu-marine"
// LINK_FREETDS_STATICALLY = "YES"
// LINK_OPENSSL = "YES"
// LINK_KRB5 = "YES"
}

stages {

stage('Cosmetics') {
steps {
parallel(

"JS Hint": {
node(label: 'docker') {
script {
sh '''docker run -i --rm --name="$BUILD_TAG-jshint" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/jshint --exclude-path wise.theme/.jshintignore'''
}
}
},

// "CSS Lint": {
// node(label: 'docker') {
// script {
// sh '''docker run -i --rm --name="$BUILD_TAG-csslint" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/csslint --exclude-list=static'''
// }
// }
// },

"PEP8": {
node(label: 'docker') {
script {
sh '''docker run -i --rm --name="$BUILD_TAG-pep8" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/pep8 --exclude=sql2018.py,sql.py,sql_extra.py,db.py,data.py,utils.py,search,compliance,translation /code'''
}
}
},

// "PyLint": {
// node(label: 'docker') {
// script {
// sh '''docker run -i --rm --name="$BUILD_TAG-pylint" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/pylint'''
// }
// }
// }

)
}
}

stage('Code') {
steps {
parallel(

"ZPT Lint": {
node(label: 'docker') {
sh '''docker run -i --rm --name="$BUILD_TAG-zptlint" -e GIT_BRANCH="$BRANCH_NAME" -e ADDONS="$GIT_NAME" -e DEVELOP="src/$GIT_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plone-test:4 zptlint'''
}
},

// "JS Lint": {
// node(label: 'docker') {
// sh '''docker run -i --rm --name="$BUILD_TAG-jslint" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/jslint4java'''
// }
// },

// "PyFlakes": {
// node(label: 'docker') {
// sh '''docker run -i --rm --name="$BUILD_TAG-pyflakes" -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/pyflakes'''
// }
// },

// "i18n": {
// node(label: 'docker') {
// sh '''docker run -i --rm --name=$BUILD_TAG-i18n -e GIT_SRC="https://github.com/eea/$GIT_NAME.git" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/i18ndude'''
// }
// }
)
}
}

stage('Tests') {
steps {
parallel(

// "WWW": {
// node(label: 'docker') {
// script {
// try {
// sh '''docker run -i --name="$BUILD_TAG-www" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/www-devel /debug.sh coverage'''
// sh '''mkdir -p xunit-reports; docker cp $BUILD_TAG-www:/plone/instance/parts/xmltestreport/testreports/. xunit-reports/'''
// stash name: "xunit-reports", includes: "xunit-reports/*.xml"
// sh '''docker cp $BUILD_TAG-www:/plone/instance/src/$GIT_NAME/coverage.xml coverage.xml'''
// stash name: "coverage.xml", includes: "coverage.xml"
// } finally {
// sh '''docker rm -v $BUILD_TAG-www'''
// }
// junit 'xunit-reports/*.xml'
// }
// }
// },


// "KGS": {
// node(label: 'docker') {
// sh '''docker run -i --rm --name="$BUILD_TAG-kgs" -e GIT_NAME="$GIT_NAME" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/kgs-devel /debug.sh bin/test --test-path /plone/instance/src/$GIT_NAME -v -vv -s $GIT_NAME'''
// }
// },

// "Plone4": {
// node(label: 'docker') {
// sh '''docker run -i --rm --name="$BUILD_TAG-plone4" -e GIT_BRANCH="$BRANCH_NAME" -e ADDONS="$GIT_NAME" -e DEVELOP="src/$GIT_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plone-test:4 -v -vv -s $GIT_NAME'''
// }
// },

// "Plone5": {
// node(label: 'docker') {
// sh '''docker run -i --rm --name="$BUILD_TAG-plone5" -e GIT_BRANCH="$BRANCH_NAME" -e ADDONS="$GIT_NAME" -e DEVELOP="src/$GIT_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plone-test:5 -v -vv -s $GIT_NAME'''
// }
// },

"Python3": {
node(label: 'docker') {
sh '''docker run -i --rm --name="$BUILD_TAG-python3" -e GIT_BRANCH="$BRANCH_NAME" -e ADDONS="$GIT_NAME" -e DEVELOP="src/$GIT_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plone-test:5-python3 -v -vv -s $GIT_NAME'''
}
}
)
}
}

stage('Report to SonarQube') {
when {
allOf {
environment name: 'CHANGE_ID', value: ''
}
}
steps {
node(label: 'swarm') {
script{
checkout scm
// dir("xunit-reports") {
// unstash "xunit-reports"
// }
// unstash "coverage.xml"
// dir('xunit-functional') {
// unstash "xunit-functional"
// }
def scannerHome = tool 'SonarQubeScanner';
def nodeJS = tool 'NodeJS11';
withSonarQubeEnv('Sonarqube') {
// sh '''sed -i "s|/plone/instance/src/$GIT_NAME|$(pwd)|g" coverage.xml'''
// sh '''find xunit-functional -type f -exec mv {} xunit-reports/ ";"'''
sh "export PATH=$PATH:${scannerHome}/bin:${nodeJS}/bin; sonar-scanner -Dsonar.python.xunit.skipDetails=true -Dsonar.python.xunit.reportPath=xunit-reports/*.xml -Dsonar.python.coverage.reportPath=coverage.xml -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done'''
}
}
}
}
}

stage('Pull Request') {
when {
not {
environment name: 'CHANGE_ID', value: ''
}
environment name: 'CHANGE_TARGET', value: 'master'
}
steps {
node(label: 'docker') {
script {
if ( env.CHANGE_BRANCH != "develop" && !( env.CHANGE_BRANCH.startsWith("hotfix")) ) {
error "Pipeline aborted due to PR not made from develop or hotfix branch"
}
withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) {
sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-pr" -e GIT_CHANGE_BRANCH="$CHANGE_BRANCH" -e GIT_CHANGE_AUTHOR="$CHANGE_AUTHOR" -e GIT_CHANGE_TITLE="$CHANGE_TITLE" -e GIT_TOKEN="$GITHUB_TOKEN" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e GIT_ORG="$GIT_ORG" -e GIT_NAME="$GIT_NAME" eeacms/gitflow'''
}
}
}
}
}

stage('Release') {
when {
allOf {
environment name: 'CHANGE_ID', value: ''
branch 'master'
}
}
steps {
node(label: 'docker') {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'eea-jenkins', usernameVariable: 'EGGREPO_USERNAME', passwordVariable: 'EGGREPO_PASSWORD'],string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'),[$class: 'UsernamePasswordMultiBinding', credentialsId: 'pypi-jenkins', usernameVariable: 'PYPI_USERNAME', passwordVariable: 'PYPI_PASSWORD']]) {
sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-master" -e GIT_BRANCH="$BRANCH_NAME" -e EGGREPO_USERNAME="$EGGREPO_USERNAME" -e EGGREPO_PASSWORD="$EGGREPO_PASSWORD" -e GIT_NAME="$GIT_NAME" -e PYPI_USERNAME="$PYPI_USERNAME" -e PYPI_PASSWORD="$PYPI_PASSWORD" -e GIT_ORG="$GIT_ORG" -e GIT_TOKEN="$GITHUB_TOKEN" eeacms/gitflow'''
}
}
}
}

}

post {
changed {
script {
def url = "${env.BUILD_URL}/display/redirect"
def status = currentBuild.currentResult
def subject = "${status}: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'"
def summary = "${subject} (${url})"
def details = """<h1>${env.JOB_NAME} - Build #${env.BUILD_NUMBER} - ${status}</h1>
<p>Check console output at <a href="${url}">${env.JOB_BASE_NAME} - #${env.BUILD_NUMBER}</a></p>
"""

def color = '#FFFF00'
if (status == 'SUCCESS') {
color = '#00FF00'
} else if (status == 'FAILURE') {
color = '#FF0000'
}

emailext (subject: '$DEFAULT_SUBJECT', to: '$DEFAULT_RECIPIENTS', body: details)
}
}
}
}
8 changes: 5 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
recursive-include wise *
include docs/*
include *.md *.rst *.txt
graft docs
graft src
global-exclude *pyc

global-exclude *~
global-exclude *.un~
global-include *.mo
11 changes: 4 additions & 7 deletions README.md → README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@ Installation

* Install ``wise.theme`` by adding it to your buildout:

```
[buildout]

...

eggs =
...
wise.theme
```
* And then running:

``bin/buildout``

and then running ``bin/buildout``

Contribute
----------
Expand All @@ -32,4 +29,4 @@ Contribute
Support
-------

If you are having issues, please let us know.
If you are having issues, please let us know.
6 changes: 5 additions & 1 deletion docs/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
Changelog
=========

1.0dev (unreleased)
1.1 - (2024-07-26)
---------------------------
* Change: First release [laszlocseh]

1.0dev (2024-07-26)
------------------
* Added override template for voltobackendwarning
[olimpiurob refs #261847]
Expand Down
25 changes: 20 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
# -*- coding: utf-8 -*-
"""Installer for the wise.theme package."""

from setuptools import find_packages, setup
import os
from os.path import join
from setuptools import setup, find_packages

NAME = 'wise.theme'
PATH = ['src'] + NAME.split('.') + ['version.txt']
VERSION = open(join(*PATH)).read().strip()

long_description = '\n\n'.join([
open('README.md').read(),
open('README.rst').read(),
open('CONTRIBUTORS.rst').read(),
open('CHANGES.rst').read(),
open(os.path.join("docs", "HISTORY.txt")).read()
])


setup(
name='wise.theme',
version='2.0a1',
name=NAME,
version=VERSION,
description="Installable theme: wise.theme",
long_description_content_type="text/x-rst",
long_description=long_description,
# Get more from https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
Expand Down Expand Up @@ -42,8 +49,16 @@
'z3c.jbot',
'plone.app.theming',
'plone.app.themingplugins',
'plone.app.robotframework',
'plone.app.testing',
'eea.api.dataconnector',
'webcouturier.dropdownmenu',
'robotsuite',
'wise.msfd@git+ssh://git@github.com:eea/wise.msfd.git',
'pyexcel==0.6.7',
'pyexcel-xlsx==0.6.0',
'openpyxl==3.0.10',
'pdfkit',
],
extras_require={
'test': [
Expand Down
1 change: 1 addition & 0 deletions src/wise/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
# pylint: skip-file
__import__('pkg_resources').declare_namespace(__name__)
17 changes: 9 additions & 8 deletions src/wise/theme/behavior.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

# pylint: skip-file
from __future__ import absolute_import
import requests

Expand Down Expand Up @@ -46,13 +46,14 @@ class CatalogueMetadata(MetadataBase):
thumbnail = DCFieldProperty(ICatalogueMetadata["thumbnail"])
sources = DCFieldProperty(ICatalogueMetadata["sources"])

#subtheme = DCFieldProperty(ICatalogueMetadata["subtheme"])
# publication_year = DCFieldProperty(ICatalogueMetadata["publication_year"])
#license_copyright = DCFieldProperty(
# subtheme = DCFieldProperty(ICatalogueMetadata["subtheme"])
# publication_year = DCFieldProperty(
# ICatalogueMetadata["publication_year"])
# license_copyright = DCFieldProperty(
# ICatalogueMetadata["license_copyright"])
#temporal_coverage = DCFieldProperty(
# temporal_coverage = DCFieldProperty(
# ICatalogueMetadata["temporal_coverage"])
#geo_coverage = DCFieldProperty(ICatalogueMetadata["geo_coverage"])
# geo_coverage = DCFieldProperty(ICatalogueMetadata["geo_coverage"])


def set_thumbnail(context, event):
Expand Down Expand Up @@ -97,7 +98,7 @@ def unset_effective_date(context, event):

if event.old_state.id != 'published':
return

context.effective_date = None

return context
return context
1 change: 1 addition & 0 deletions src/wise/theme/blocks.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pylint: skip-file
""" blocks.py """

import json
Expand Down
Loading

0 comments on commit d477ca4

Please sign in to comment.