Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,18 @@ pipeline {
stash allowEmpty: true, name: 'source', useDefaultExcludes: false
}
}
stage('Sanity checks') {
stage('Lint') {
options { skipDefaultCheckout() }
environment {
HOME = "${env.WORKSPACE}"
PATH = "${env.HOME}/bin:${env.PATH}"
}
steps {
deleteDir()
unstash 'source'
dir("${BASE_DIR}"){
preCommit(commit: "${GIT_BASE_COMMIT}", junit: true)
withGithubNotify(context: 'Lint') {
deleteDir()
unstash 'source'
dir("${BASE_DIR}"){
preCommit(commit: "${GIT_BASE_COMMIT}", junit: true)
}
python(version: '3.7') {
sh('.ci/scripts/lint.sh')
}
}
}
}
Expand All @@ -62,16 +63,14 @@ pipeline {
withGithubNotify(context: "Test ${VERSION}") {
deleteDir()
unstash 'source'
dir("${BASE_DIR}"){
python(version: VERSION) {
sh(".ci/scripts/test.sh ${VERSION}")
}
}
}
post {
always {
dir("${BASE_DIR}"){
junit(allowEmptyResults: true, keepLongStdio: true, testResults: '**/junit*.xml')
}
junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/junit*.xml")
}
}
}
Expand All @@ -85,3 +84,17 @@ pipeline {
}
}
}

def python(Map v = [:], body) {
def dockerImage = v.version.equals('2.7') ? 'python:3.7' : "python:${v.version}"
// If dockerhub got issues then let's retry twice
retry(2) {
sleep 5
sh "docker pull ${dockerImage}"
}
docker.image(dockerImage).inside("-e HOME=${env.WORKSPACE}"){
dir("${BASE_DIR}"){
body()
}
}
}
7 changes: 6 additions & 1 deletion .ci/scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/usr/bin/env bash
set -e

echo 'TBD'
## When running in a docker container in the CI then it's required to set the location
## for the tools to be installed.
export PATH=${HOME}/.local/bin:${PATH}

python -m pip install -U nox
nox -s lint
9 changes: 8 additions & 1 deletion .ci/scripts/test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/usr/bin/env bash
set -e

echo 'TBD'
VERSION=${1:?Please specify the python version}

## When running in a docker container in the CI then it's required to set the location
## for the tools to be installed.
export PATH=${HOME}/.local/bin:${PATH}

python -m pip install -U nox
nox -s test-"${VERSION}"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/

# JUnit file
junit-test.xml
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def tests_impl(session):
session.install(".[develop]")
session.run(
"pytest",
"--junitxml=junit-test.xml",
*(session.posargs or ("tests/",)),
env={"PYTHONWARNINGS": "always::DeprecationWarning"}
)
Expand Down
5 changes: 5 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pytest]
junit_logging = system-out
junit_log_passing_tests = True
junit_duration_report = call
junit_family=xunit1