diff --git a/jobs/templates/includes/agent-docker-sphinx.groovy.j2 b/jobs/templates/includes/agent-docker-sphinx.groovy.j2 new file mode 100644 index 0000000..a563683 --- /dev/null +++ b/jobs/templates/includes/agent-docker-sphinx.groovy.j2 @@ -0,0 +1,7 @@ +agent { + docker { + reuseNode true + image 'swh-jenkins/{{sphinx_docker_image}}' + args '--mount type=volume,src=shared-jenkins-cachedir,dst=/home/jenkins/.cache' + } +} diff --git a/jobs/templates/swh-pipeline-diff.yaml b/jobs/templates/swh-pipeline-diff.yaml index 7b311e2..e65d1d0 100644 --- a/jobs/templates/swh-pipeline-diff.yaml +++ b/jobs/templates/swh-pipeline-diff.yaml @@ -1,40 +1,41 @@ - job-template: name: "{name}/tests-on-diff" display-name: Phab. Diff project-type: pipeline docker_image: tox cypress_docker_image: cypress + sphinx_docker_image: sphinx default-tox-environment: py3 sandbox: true auth-token: 'ph4br1cat0r' phabricator_diff: true do_cypress: false properties: - build-discarder: artifact-num-to-keep: 20 parameters: - git-parameter: name: REVISION type: PT_REVISION defaultValue: master description: Git revision to build. - string: name: PHID description: PHID of the Phabricator target object on which results will be reported. - string: name: DIFF_ID description: ID of the Diff patch to apply, if any - string: name: REV_ID description: ID of the Phabricator revision, if any - string: name: STAGING_URI description: URI of the staging repository - string: name: TOX_ENVIRONMENT description: tox environment to use for the main tox run default: "{default-tox-environment}" dsl: !include-jinja2: swh-pipeline.groovy.j2 diff --git a/jobs/templates/swh-pipeline.groovy.j2 b/jobs/templates/swh-pipeline.groovy.j2 index 40e0781..d491eec 100644 --- a/jobs/templates/swh-pipeline.groovy.j2 +++ b/jobs/templates/swh-pipeline.groovy.j2 @@ -1,121 +1,138 @@ pipeline { {% filter indent(width=2) %} {%- include 'includes/agent-docker.groovy.j2' -%} {% endfilter %} environment { PHAB_CONDUIT_URL = 'https://forge.softwareheritage.org/api/' } stages { stage('Checkout') { steps { {% filter indent(width=8) %} {%- include 'includes/create-phabricator-artifacts.groovy.j2' -%} {% endfilter %} checkout([ $class: 'GitSCM', branches: [[name: "${params.REVISION}"]], doGenerateSubmoduleConfigurations: false, extensions: [], gitTool: 'Default', submoduleCfg: [], userRemoteConfigs: [ [url: 'https://forge.softwareheritage.org/source/{{repo_name}}.git'], ], browser: [$class: 'Phabricator', repoUrl: 'https://forge.softwareheritage.org', repo: '{{name}}'] ]) } } {%- if phabricator_diff %} {% filter indent(width=4) %} {%- include 'includes/stage-apply-phabricator-diff.groovy.j2' -%} {% endfilter %} {%- endif %} stage('Static analysis') { parallel { stage ('flake8') { steps { sh '''python3 -m tox -e flake8''' } } stage ('mypy') { steps { sh '''python3 -m tox -e mypy''' } } stage ('radon') { steps { sh ''' mkdir -p reports python3 -m radon raw --json swh/ > reports/raw_report.json python3 -m radon cc --json swh/ > reports/cc_report.json python3 -m radon mi --json swh/ > reports/mi_report.json python3 -m radon hal --json swh/ > reports/hal_report.json python3 -m radon cc --xml swh/ > reports/cc_report.xml ''' } post { always { // Archive a few report files archiveArtifacts( allowEmptyArchive: true, artifacts: 'reports/*', fingerprint: true, ) // Warnings NG recordIssues( enabledForFailure: true, tools: [ ccm(pattern: '**/reports/cc_report.xml'), ], ) } } } } } // static analysis stage('Tests') { options { timeout(time: 20, unit: 'MINUTES') } parallel { {% filter indent(width=8) %} {%- include 'includes/stage-python-tests.groovy.j2' -%} {% endfilter %} {%- if do_cypress %} {% filter indent(width=8) %} {%- include 'includes/stage-cypress-tests.groovy.j2' -%} {% endfilter %} {%- endif %} } } + + stage('Sphinx documentation') { + {% filter indent(width=6) %} + {%- include 'includes/agent-docker-sphinx.groovy.j2' -%} + {% endfilter %} + + steps { + sh ''' + if tox -a | grep -qx sphinx + then + tox -e sphinx + else + echo WARNING: no sphinx environment in tox.ini + fi + ''' + } + } // sphinx doc } // stages post { always { step([$class: 'PhabricatorNotifier', commentOnSuccess: true, commentWithConsoleLinkOnFailure: true, commentFile: '.phabricator-comment', commentSize: '1000000', preserveFormatting: true, processLint: true, lintFile: '.phabricator-lint', lintFileSize: '1000000', ]) } // always cleanup { cleanWs() } } // post } // pipeline diff --git a/jobs/templates/swh-pipeline.yaml b/jobs/templates/swh-pipeline.yaml index f7f0d88..afca2a6 100644 --- a/jobs/templates/swh-pipeline.yaml +++ b/jobs/templates/swh-pipeline.yaml @@ -1,33 +1,34 @@ - job-template: name: "{name}/tests" display-name: "master branch" project-type: pipeline docker_image: tox cypress_docker_image: cypress + sphinx_docker_image: sphinx default-tox-environment: py3 triggers: - timed: '@daily' sandbox: true auth-token: 'ph4br1cat0r' properties: - build-discarder: artifact-num-to-keep: 20 phabricator_diff: false do_cypress: false parameters: - git-parameter: name: REVISION type: PT_REVISION defaultValue: master description: Git revision to build. - string: name: PHID description: PHID of the Phabricator target object on which results will be reported. - string: name: TOX_ENVIRONMENT description: tox environment to use for the main tox run default: "{default-tox-environment}" dsl: !include-jinja2: swh-pipeline.groovy.j2