Skip to content

Commit 40c30a7

Browse files
authored
Merge pull request #101 from rosette-api/RCB-616-release-python-binding
RCB-616: update python Jenkins script
2 parents 57b6ed3 + f651461 commit 40c30a7

File tree

8 files changed

+65
-33
lines changed

8 files changed

+65
-33
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
ehthumbs.db
88
Thumbs.db
99

10+
# VS Code
11+
.vscode
12+
1013
# Jetbrains
1114
**/.idea/*
1215
!**/.idea/runConfigurations/
@@ -59,6 +62,7 @@ htmlcov/
5962
nosetests.xml
6063
coverage.xml
6164
*,cover
65+
.scannerwork/
6266

6367
# Translations
6468
*.mo

.travis.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

CI.Jenkinsfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
3+
def versions = [3.11, 3.10, 3.9, 3.8, 3.7]
4+
5+
def runSonnarForPythonVersion(sourceDir, ver){
6+
mySonarOpts="-Dsonar.sources=/source -Dsonar.host.url=${env.SONAR_HOST_URL} -Dsonar.login=${env.SONAR_AUTH_TOKEN}"
7+
if("${env.CHANGE_ID}" != "null"){
8+
mySonarOpts = "$mySonarOpts -Dsonar.pullrequest.key=${env.CHANGE_ID} -Dsonar.pullrequest.branch=${env.BRANCH_NAME}"
9+
} else {
10+
mySonarOpts = "$mySonarOpts -Dsonar.branch.name=${env.BRANCH_NAME}"
11+
}
12+
if ("${env.CHANGE_BRANCH}" != "null") {
13+
mySonarOpts="$mySonarOpts -Dsonar.pullrequest.base=${env.CHANGE_TARGET} -Dsonar.pullrequest.branch=${env.CHANGE_BRANCH}"
14+
}
15+
16+
// TODO: find a way to skip the Sonar scan for all those version, but one (maybe the latest?).
17+
sh "docker run \
18+
--pull always \
19+
--rm --volume ${sourceDir}:/source \
20+
python:${ver}-slim \
21+
bash -c \"apt-get update && \
22+
apt-get install -y wget unzip && \
23+
pip3 install tox && \
24+
cd /root/ && \
25+
wget -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.0.2856-linux.zip && \
26+
unzip -q sonar-scanner-cli-4.8.0.2856-linux.zip && \
27+
cd /source && \
28+
tox && \
29+
/root/sonar-scanner-4.8.0.2856-linux/bin/sonar-scanner \
30+
${mySonarOpts}\""
31+
}
32+
33+
node ("docker-light") {
34+
def sourceDir = pwd()
35+
try {
36+
stage("Clean up") {
37+
step([$class: 'WsCleanup'])
38+
}
39+
stage("Checkout Code") {
40+
checkout scm
41+
}
42+
stage("Build & Test") {
43+
withSonarQubeEnv {
44+
45+
versions.each { ver ->
46+
runSonnarForPythonVersion(sourceDir, ver)
47+
}
48+
}
49+
}
50+
} catch (e) {
51+
currentBuild.result = "FAILED"
52+
throw e
53+
}
54+
}

Jenkinsfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ node ("docker-light") {
1515
echo "${env.ALT_URL}"
1616
def useUrl = ("${env.ALT_URL}" == "null") ? "${env.BINDING_TEST_URL}" : "${env.ALT_URL}"
1717
withEnv(["API_KEY=${env.ROSETTE_API_KEY}", "ALT_URL=${useUrl}"]) {
18-
sh "docker pull rosetteapi/docker-python"
19-
sh "docker run --rm -e API_KEY=${API_KEY} -e ALT_URL=${ALT_URL} -v ${SOURCEDIR}:/source rosetteapi/docker-python"
18+
sh "docker pull rosette/docker-python"
19+
sh "docker run --rm -e API_KEY=${API_KEY} -e ALT_URL=${ALT_URL} -v ${SOURCEDIR}:/source rosette/docker-python"
2020
}
2121
}
2222
slack(true)

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
---
44

5-
[![Build Status](https://travis-ci.org/rosette-api/python.svg?branch=develop)](https://travis-ci.org/rosette-api/python)
65
[![PyPI version](https://badge.fury.io/py/rosette-api.svg)](https://badge.fury.io/py/rosette-api)
76
[![Python Versions](https://img.shields.io/pypi/pyversions/rosette-api.svg?color=dark%20green&label=Python%20Versions)](https://img.shields.io/pypi/pyversions/rosette-api.svg?color=dark%20green&label=Python%20Versions)
87

rosette/api.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,12 @@ class DocumentParameters(_DocumentParamSetBase):
153153
def __init__(self):
154154
"""Create a L{DocumentParameters} object."""
155155
_DocumentParamSetBase.__init__(
156-
self, ("content", "contentUri", "genre", "language", "profileId"))
156+
self, ("content", "contentUri", "language", "profileId"))
157157
self.file_name = ""
158158
self.use_multipart = False
159159

160160
def validate(self):
161161
"""Internal. Do not use."""
162-
if self["genre"] is not None:
163-
warnings.warn("genre is deprecated and will be removed in the next release.")
164162
if self["content"] is None:
165163
if self["contentUri"] is None:
166164
raise RosetteException(

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ def read(*filenames, **kwargs):
4949
'Natural Language :: English',
5050
'Operating System :: OS Independent',
5151
'Programming Language :: Python',
52-
'Programming Language :: Python :: 2.7',
53-
'Programming Language :: Python :: 3.5',
54-
'Programming Language :: Python :: 3.6',
5552
'Programming Language :: Python :: 3.7',
5653
'Programming Language :: Python :: 3.8',
54+
'Programming Language :: Python :: 3.9',
55+
'Programming Language :: Python :: 3.10',
56+
'Programming Language :: Python :: 3.11',
5757
'Topic :: Software Development :: Libraries :: Python Modules'
5858
]
5959
)

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
[tox]
77
skipsdist = True
8-
envlist = py2, py3
8+
envlist = py3
99

1010
[testenv]
1111
commands =

0 commit comments

Comments
 (0)