/* Copyright (C) 2026 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * 0 A.D. is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with 0 A.D. If not, see . */ // This pipeline is used to build the documentation and the engine test coverage. pipeline { agent { node { label 'LinuxAgent' customWorkspace 'workspace/technical-docs' } } stages { // The LFS files are checked out on the agent, git-lfs is not installed in the image. stage('Pull assets') { steps { sh 'git lfs pull -I "docs/doxygen,binaries/data/tests,binaries/data/mods/_test.*"' } } stage('Build and upload') { agent { dockerfile { reuseNode true dir 'build/jenkins/dockerfiles' filename 'debian-12.Dockerfile' // Prevent Jenkins from running commands with the UID of the host's jenkins user // https://stackoverflow.com/a/42822143 args '-u root' } } stages { stage('Engine docs') { steps { sh 'cd docs/doxygen/ && cmake -S . -B output && cmake --build output' // The upload silently sends nothing when the output is missing, so fail here instead. sh 'test -f docs/doxygen/output/html/index.html' } } stage('Entity docs') { steps { sh 'cd binaries/system/ && svn export --force https://svn.wildfiregames.com/nightly-build/trunk/binaries/system/entity.rng' sh 'cd source/tools/entdocs/ && ./build.sh' sh 'cd source/tools/entdocs/ && mv entity-docs.html nightly.html' } } stage('Template Analyzer') { steps { sh 'cd source/tools/templatesanalyzer/ && python3 unit_tables.py' sh 'mv source/tools/templatesanalyzer/unit_summary_table.html source/tools/templatesanalyzer/index.html' } } stage('Engine coverage') { environment { INFO_FILE = 'coverage.info' REPORT_PATH = "${WORKSPACE}/coverage-results" } steps { sh "libraries/build-source-libs.sh ${JOBS}" sh 'build/workspaces/update-workspaces.sh --coverage' dir('build/workspaces/gcc') { // Reset everything in case there were leftovers. sh 'lcov --directory . --zerocounters' sh 'make ${JOBS} config=release' // The executable must be launched from the same path as where it was built, // else no data is generated. timeout(time: 15) { sh '../../../binaries/system/test' } sh "lcov --directory . --capture --output-file ${INFO_FILE}" // Remove the tests, the bundled libraries and the system headers. sh "lcov --remove ${INFO_FILE} '*/tests/*' '*/libraries/*' '/usr/*' --output-file ${INFO_FILE}" sh "mkdir -p ${REPORT_PATH}" sh "genhtml -o ${REPORT_PATH} -t '0 A.D. test coverage report' --num-spaces 4 --demangle-cpp ${INFO_FILE}" } sh "test -f ${REPORT_PATH}/index.html" } } stage('Upload') { steps { sshPublisher alwaysPublishFromMaster: true, failOnError: true, publishers: [ sshPublisherDesc(configName: 'docs.wildfiregames.com', transfers: [ sshTransfer(sourceFiles: 'docs/doxygen/output/html/**', removePrefix: 'docs/doxygen/output/html/', remoteDirectory: 'pyrogenesis'), sshTransfer(sourceFiles: 'source/tools/entdocs/nightly.html', removePrefix: 'source/tools/entdocs', remoteDirectory: 'entity-docs'), sshTransfer(sourceFiles: 'source/tools/templatesanalyzer/index.html', removePrefix: 'source/tools/templatesanalyzer', remoteDirectory: 'templatesanalyzer'), sshTransfer(sourceFiles: 'coverage-results/**', removePrefix: 'coverage-results/', remoteDirectory: 'coverage', cleanRemote: true), ] )] } } } } } }