CI setup
Some checks failed
Gitea/python-cryptbase/pipeline/head There was a failure building this commit

This commit is contained in:
2021-10-09 00:37:11 +02:00
parent 510409f074
commit 7a8cd52858
4 changed files with 163 additions and 2 deletions

93
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,93 @@
pipeline {
agent none
stages {
stage ('Dependency check') {
agent { label 'use' }
steps {
script {
sh '''#!/usr/bin/env bash
source /opt/conda/etc/profile.d/conda.sh
conda create --yes -p "${WORKSPACE}@tmp/${BUILD_NUMBER}" python=3.9
conda activate "${WORKSPACE}@tmp/${BUILD_NUMBER}"
pip install --use-deprecated=legacy-resolver -r requirements.dev.txt
pip check
pip list --outdated
conda deactivate
'''
}
}
}
stage('Tests') {
agent { label 'use' }
steps {
script {
script {
sh '''#!/usr/bin/env bash
source /opt/conda/etc/profile.d/conda.sh
conda activate "${WORKSPACE}@tmp/${BUILD_NUMBER}"
tox --recreate
conda deactivate
'''
}
}
}
}
stage('Lint') {
agent { label 'use' }
when {
anyOf {
branch 'develop'
branch pattern: "hotfix/.+", comparator: "REGEXP"
}
}
steps {
script {
sh '''#!/usr/bin/env bash
source /opt/conda/etc/profile.d/conda.sh
conda activate "${WORKSPACE}@tmp/${BUILD_NUMBER}"
pip install prospector[with_everything]
cd src/; prospector -0
conda deactivate
'''
}
}
}
stage('Sonar') {
agent { label 'use' }
when { branch 'master' }
steps {
script {
sh '''#!/usr/bin/env bash
source /opt/conda/etc/profile.d/conda.sh
conda activate "${WORKSPACE}@tmp/${BUILD_NUMBER}"
pip install prospector[with_everything]
cd src; prospector -0 -o pylint:prospector.txt tsa
conda deactivate
'''
def scannerHome = tool name: 'SonarQubeScanner', type: 'hudson.plugins.sonar.SonarRunnerInstallation';
withSonarQubeEnv('sonar') {
GIT_COMMIT_HASH = sh (script: "git log -n 1 --pretty=format:'%H'", returnStdout: true)
sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=cryptbase -Dsonar.projectVersion=${GIT_COMMIT_HASH} -Dsonar.python.pylint.reportPaths=prospector.txt -Dsonar.junit.reportsPath=junit-py39.xml -Dsonar.python.coverage.reportPaths=cov-py39.xml -Dsonar.coverage.dtdVerification=false"
}
}
}
}
stage('Cleanup') {
agent { label 'use' }
steps {
dir("${env.WORKSPACE}@tmp") {
deleteDir()
}
}
}
}
post {
always {
mattermostSend "Completed ${env.JOB_NAME} ${env.BUILD_NUMBER}: ${currentBuild.currentResult}"
}
}
}

35
requirements.dev.txt Normal file
View File

@@ -0,0 +1,35 @@
arrow==1.2.0
backports.entry-points-selectable==1.1.0
binaryornot==0.4.4
build==0.7.0
certifi==2021.5.30
chardet==4.0.0
charset-normalizer==2.0.6
check-manifest==0.47
click==8.0.1
cookiecutter==1.7.3
distlib==0.3.3
filelock==3.3.0
greenlet==1.1.2
idna==3.2
Jinja2==3.0.2
jinja2-time==0.2.0
MarkupSafe==2.0.1
packaging==21.0
pep517==0.11.0
platformdirs==2.4.0
pluggy==1.0.0
poyo==0.5.0
py==1.10.0
pyparsing==2.4.7
python-dateutil==2.8.2
python-slugify==5.0.2
requests==2.26.0
six==1.16.0
SQLAlchemy==1.4.25
text-unidecode==1.3
toml==0.10.2
tomli==1.2.1
tox==3.24.4
urllib3==1.26.7
virtualenv==20.8.1

33
src/.prospector.yaml Normal file
View File

@@ -0,0 +1,33 @@
output-format: pylint
strictness: veryhigh
max-line-length: 200
doc-warnings: false
pylint:
member-warnings: false
disable:
- too-few-public-methods
bandit:
run: true
dodgy:
run: true
mccabe:
run: true
pep8:
run: true
full: true
frosted:
run: false
pyflakes:
run: true
pyroma:
run: true
pylint:
run: true
disable:
- too-few-public-methods
vulture:
run: true
mypy:
run: true
options:
ignore-missing-imports: true

View File

@@ -13,7 +13,7 @@ passenv =
envlist = envlist =
clean, clean,
check, check,
docs, ; docs,
{py36,py37,py38,py39,pypy3}, {py36,py37,py38,py39,pypy3},
report report
ignore_basepython_conflict = true ignore_basepython_conflict = true
@@ -38,7 +38,7 @@ deps =
pytest pytest
pytest-cov pytest-cov
commands = commands =
{posargs:pytest --cov --cov-report=term-missing -vv tests} {posargs:pytest --junitxml=junit-{envname}.xml --cov --cov-report=xml:cov-{envname}.xml -vv tests}
[testenv:check] [testenv:check]
deps = deps =