From 3215aefbbfff44916369ca626e1f23ef20bcfdc7 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Wed, 13 May 2020 13:01:23 -0400 Subject: [PATCH] Change dox generation to a travis job --- .travis.yml | 23 ++++++++++++++++++----- appveyor.yml | 5 +---- build/BuildDox.ps1 | 42 ------------------------------------------ build/build_dox.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 51 deletions(-) delete mode 100644 build/BuildDox.ps1 create mode 100755 build/build_dox.sh diff --git a/.travis.yml b/.travis.yml index fdf2ca5900..38e1a220ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,15 @@ branches: jobs: include: - env: + - DoxGeneration=true + name: "Dox Generation" + addons: + apt: + packages: + - doxygen + - graphviz + - env: + - DoxGeneration=false - DockerBuild=false - DMAPI=true - BYOND_MAJOR="513" @@ -28,6 +37,7 @@ jobs: - libc6-i386 - libstdc++6:i386 - env: + - DoxGeneration=false - DockerBuild=false - DMAPI=false - CONFIG=Debug @@ -46,6 +56,7 @@ jobs: - libc6-i386 - libstdc++6:i386 - env: + - DoxGeneration=false - DockerBuild=false - DMAPI=false - CONFIG=Release @@ -64,16 +75,18 @@ jobs: - libc6-i386 - libstdc++6:i386 - env: + - DoxGeneration=false - DockerBuild=true name: "Docker Build" services: - docker install: - - if [ $DockerBuild = false ] && [ $DMAPI = true ]; then build/install_byond.sh; fi - - if [ $DockerBuild = false ] && [ $DMAPI = false ]; then dotnet restore tgstation-server.sln; fi + - if [ $DoxGeneration = false ] && [ $DockerBuild = false ] && [ $DMAPI = true ]; then build/install_byond.sh; fi + - if [ $DoxGeneration = false ] && [ $DockerBuild = false ] && [ $DMAPI = false ]; then dotnet restore tgstation-server.sln; fi script: - - if [ $DockerBuild = false ] && [ $DMAPI = true ]; then tests/DMAPI/BasicOperation/build_byond.sh || travis_terminate 1; fi - - if [ $DockerBuild = false ] && [ $DMAPI = false ]; then build/test_core.sh; fi - - if [ $DockerBuild = true ]; then docker build . -f build/Dockerfile; fi + - if [ $DoxGeneration = false ] && [ $DockerBuild = false ] && [ $DMAPI = true ]; then tests/DMAPI/BasicOperation/build_byond.sh || travis_terminate 1; fi + - if [ $DoxGeneration = false ] && [ $DockerBuild = false ] && [ $DMAPI = false ]; then build/test_core.sh; fi + - if [ $DoxGeneration = false ] && [ $DockerBuild = true ]; then docker build . -f build/Dockerfile; fi + - if [ $DoxGeneration = true ]; then build/build_dox.sh; fi diff --git a/appveyor.yml b/appveyor.yml index eda65fa50a..be9b44d4fb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,9 +36,7 @@ artifacts: name: ServerUpdatePackage - path: src/DMAPI name: DMAPI - - path: tgsdox - name: DocumentationHtml - - path: swagger.json + - path: C:/swagger.json name: SwaggerSpec cache: - ~\.nuget\packages -> **\*.csproj @@ -82,7 +80,6 @@ test_script: - lint-openapi -p -c build/OpenApiValidationSettings.json C:/swagger.json after_test: - ps: build/UploadCoverage.ps1 - - ps: build/BuildDox.ps1 #host updater - dotnet publish src/Tgstation.Server.Host/Tgstation.Server.Host.csproj -o artifacts/ServerHost -c %CONFIGURATION% #console diff --git a/build/BuildDox.ps1 b/build/BuildDox.ps1 deleted file mode 100644 index 4e0b4dcf13..0000000000 --- a/build/BuildDox.ps1 +++ /dev/null @@ -1,42 +0,0 @@ -$bf = $Env:APPVEYOR_BUILD_FOLDER - -$doxdir = "C:\tgsdox" - -New-Item -Path $doxdir -ItemType directory - -$publish_dox = (-not (Test-Path Env:APPVEYOR_PULL_REQUEST_NUMBER)) -and ("$Env:APPVEYOR_REPO_BRANCH" -eq "master") - -if($publish_dox){ - $github_url = "github.com/$Env:APPVEYOR_REPO_NAME" - echo "Cloning https://git@$github_url..." - git clone -b gh-pages --single-branch "https://git@$github_url" "$doxdir" 2>$null - rm -r "$doxdir\*" -} - -Add-Content "$bf\docs\Doxyfile" "`nPROJECT_NUMBER = $version`nINPUT = $bf`nOUTPUT_DIRECTORY = $doxdir`nPROJECT_LOGO = $bf/build/tgs.ico`nHAVE_DOT=YES" - -&"C:\Program Files\doxygen\bin\doxygen.exe" "$bf\docs\Doxyfile" - -if($publish_dox){ - cd $doxdir - git config --global push.default simple - git config user.name "tgstation-server" - git config user.email "tgstation-server@tgstation13.org" - echo '# THIS BRANCH IS AUTO GENERATED BY APPVEYOR CI' > README.md - - # Add in the swagger specification - cp C:/swagger.json "$doxdir/swagger.json" - - # Need to create a .nojekyll file to allow filenames starting with an underscore - # to be seen on the gh-pages site. Therefore creating an empty .nojekyll file. - echo "" > .nojekyll - git add --all - git commit -m "Deploy code docs to GitHub Pages for Appveyor build $Env:APPVEYOR_BUILD_NUMBER" -m "Commit: $Env:APPVEYOR_REPO_COMMIT" - git push -f "https://$Env:TGS4_TEST_GITHUB_TOKEN@$github_url" 2>&1 | out-null - cd "$bf" - rm -r "$doxdir/.git" -} -mv C:/tgsdox "$bf/tgsdox" - -# Add in the swagger specification -cp C:/swagger.json "$bf/swagger.json" diff --git a/build/build_dox.sh b/build/build_dox.sh new file mode 100755 index 0000000000..3091c8e17b --- /dev/null +++ b/build/build_dox.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +BUILD_FOLDER=$TRAVIS_BUILD_DIR + +DOXDIR=~/tgsdox + +mkdir -p $DOXDIR + +if [ "$TRAVIS_PULL_REQUEST" -eq "$false" ] && [ "$TRAVIS_BRANCH" -eq "master" ]; then + PUBLISH_DOX=true +else + PUBLISH_DOX=false +fi + +if [ "$PUBLISH_DOX" = true ] ; then + GITHUB_URL="github.com/$TRAVIS_PULL_REQUEST_SLUG" + echo "Cloning https://git@$GITHUB_URL..." + git clone -b gh-pages --single-branch "https://git@$GITHUB_URL" "$DOXDIR" 2> /dev/null + rm -r "$DOXDIR\*" +fi + +VERSION=cat "$BUILD_FOLDER/build/Version.props" | grep -oPm1 "(?<=)[^<]+" + +echo -e "\nPROJECT_NUMBER = $VERSION\nINPUT = $BUILD_FOLDER\nOUTPUT_DIRECTORY = $DOXDIR\nPROJECT_LOGO = $BUILD_FOLDER/build/tgs.ico\nHAVE_DOT=YES" >> "$BUILD_FOLDER/docs/Doxyfile" + +doxygen "$BUILD_FOLDER/docs/Doxyfile" + +if [ "$PUBLISH_DOX" = true ] ; then + cd $DOXDIR + git config --global push.default simple + git config user.name "tgstation-server" + git config user.email "tgstation-server@tgstation13.org" + echo '# THIS BRANCH IS AUTO GENERATED BY APPVEYOR CI' > README.md + + # Need to create a .nojekyll file to allow filenames starting with an underscore + # to be seen on the gh-pages site. Therefore creating an empty .nojekyll file. + echo "" > .nojekyll + git add --all + git commit -m "Deploy code docs to GitHub Pages for Travis build $TRAVIS_BUILD_NUMBER" -m "Commit: $TRAVIS_COMMIT" + git push -f "https://$TGS4_TEST_GITHUB_TOKEN@$GITHUB_URL" 2>&1 | out-null + cd "$BUILD_FOLDER" + rm -r "$DOXDIR/.git" +fi + +mv $DOXDIR "$BUILD_FOLDER/tgsdox"