From dd7734e73daf252020b7d99e10a323ea47c15fd5 Mon Sep 17 00:00:00 2001 From: Itms Date: Tue, 24 Sep 2024 18:36:43 +0200 Subject: [PATCH] Generate technical docs from CI/CD - Generate entity.rng as part of the nightly build - Generate docs from a checkout of the nightly build - Publish them to docs.wildfiregames.com --- .../jenkins/dockerfiles/docs-tools.Dockerfile | 10 +++ .../pipelines/nightly-build.Jenkinsfile | 6 ++ .../pipelines/technical-docs.Jenkinsfile | 64 ++++++++----------- 3 files changed, 44 insertions(+), 36 deletions(-) create mode 100644 build/jenkins/dockerfiles/docs-tools.Dockerfile diff --git a/build/jenkins/dockerfiles/docs-tools.Dockerfile b/build/jenkins/dockerfiles/docs-tools.Dockerfile new file mode 100644 index 0000000000..f3bcb5f76b --- /dev/null +++ b/build/jenkins/dockerfiles/docs-tools.Dockerfile @@ -0,0 +1,10 @@ +FROM debian:latest + +ARG DEBIAN_FRONTEND=noninteractive +ARG DEBCONF_NOWARNINGS="yes" +RUN apt-get -qqy update && apt-get install -qqy --no-install-recommends \ + cmake \ + doxygen \ + graphviz \ + subversion \ + && apt-get clean diff --git a/build/jenkins/pipelines/nightly-build.Jenkinsfile b/build/jenkins/pipelines/nightly-build.Jenkinsfile index 331cf6039c..66a41bb90c 100644 --- a/build/jenkins/pipelines/nightly-build.Jenkinsfile +++ b/build/jenkins/pipelines/nightly-build.Jenkinsfile @@ -78,6 +78,12 @@ pipeline { } } + stage("Generate entity XML schema") { + steps { + bat "cd binaries\\system && pyrogenesis.exe -mod=public -dumpSchema" + } + } + stage("Check-in SPIRV generation rules") { when { expression { env.spirv_rules_FILENAME } diff --git a/build/jenkins/pipelines/technical-docs.Jenkinsfile b/build/jenkins/pipelines/technical-docs.Jenkinsfile index e120f01c11..df66fd7cdb 100644 --- a/build/jenkins/pipelines/technical-docs.Jenkinsfile +++ b/build/jenkins/pipelines/technical-docs.Jenkinsfile @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2024 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -19,61 +19,53 @@ pipeline { agent { - node { - label 'LinuxSlave' + dockerfile { + label 'LinuxAgent' + customWorkspace "workspace/technical-docs" + dir 'build/jenkins/dockerfiles' + filename "docs-tools.Dockerfile" } } + options { + checkoutToSubdirectory 'git' + } + stages { - stage("Setup") { + stage("Nightly checkout") { steps { - sh "sudo zfs clone zpool0/gcc7@latest zpool0/entity-docs" + svn "https://svn.wildfiregames.com/nightly-build/trunk" } } + stage("Engine docs") { steps { - ws("/zpool0/entity-docs"){ - sh "cd docs/doxygen/ && doxygen config" - } - } - } - stage("Build") { - steps { - ws("/zpool0/entity-docs"){ - sh "build/workspaces/update-workspaces.sh --disable-atlas --without-tests -j1" - sh "cd build/workspaces/gcc/ && make pyrogenesis -j1" - } + sh "cd docs/doxygen/ && doxygen config" } } + stage("Entity docs") { steps { - ws("/zpool0/entity-docs"){ - sh "cd binaries/system/ && ./pyrogenesis -mod=public -dumpSchema" - sh "cd source/tools/entdocs/ && ./build.sh" - } + sh "cd source/tools/entdocs/ && ./build.sh" + sh "mv tools/entdocs/entity-docs.html tools/entdocs/nightly.html" } } + stage("Template Analyzer") { steps { - ws("/zpool0/entity-docs"){ - sh "cd source/tools/templatesanalyzer/ && python3 unit_tables.py" - } + sh "cd source/tools/templatesanalyzer/ && python3 unit_tables.py" + sh "mv source/tools/templatesanalyzer/unit_summary_table.html source/tools/templatesanalyzer/index.html" } } + stage("Upload") { steps { - ws("/zpool0/entity-docs"){ - sh "rsync -rti --delete-after --progress docs/doxygen/html/ docs.wildfiregames.com:~/www/pyrogenesis/" - sh "rsync -ti --progress source/tools/entdocs/entity-docs.html docs.wildfiregames.com:~/www/entity-docs/trunk.html" - sh "rsync -ti --progress source/tools/templatesanalyzer/unit_summary_table.html docs.wildfiregames.com:~/www/templatesanalyzer/index.html" - } - } - } - } - post { - always { - ws("/zpool0/trunk") { - sleep 10 - sh "sudo zfs destroy zpool0/entity-docs" + sshPublisher alwaysPublishFromMaster: true, failOnError: true, publishers: [ + sshPublisherDesc(configName: 'docs.wildfiregames.com', transfers: [ + sshTransfer(sourceFiles: 'docs/doxygen/html/**', removePrefix: 'docs/doxygen/html', remoteDirectory: 'pyrogenesis'), + sshTransfer(sourceFiles: 'tools/entdocs/nightly.html', removePrefix: 'tools/entdocs', remoteDirectory: 'entity-docs'), + sshTransfer(sourceFiles: 'source/tools/templatesanalyzer/index.html', removePrefix: 'source/tools/templatesanalyzer', remoteDirectory: 'templatesanalyzer'), + ] + )] } } }