Add a Jenkinsfile linter

This commit is contained in:
Stan 2025-05-08 18:53:20 +02:00
parent 1adab34511
commit 934ca601d7
No known key found for this signature in database
GPG key ID: 244943DFF8370D60
13 changed files with 850 additions and 751 deletions

View file

@ -27,3 +27,10 @@ indent_size = 2
[build/premake/premake5/**]
ignore = true
[*.Jenkinsfile]
indent_size = 4
# Jenkins recommends using spaces for indentation. See:
# https://wiki.jenkins.io/display/JENKINS/Code+Style+Guidelines
# Additionally, our linter npm-groovy-lint does not support tabs.
indent_style = space

View file

@ -59,3 +59,19 @@ jobs:
- name: Check for issues with copyright
run: ./source/tools/lint/copyright/copyright.sh --from ${{ env.BASE_SHA }} --to ${{ env.HEAD_SHA }}
jenkinsfiles:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install npm-groovy-lint
run: npm install -g npm-groovy-lint
- name: Check for issues with jenkins files
run: ./source/tools/lint/jenkinsfiles/jenkinsfiles.sh --from ${{ env.BASE_SHA }} --to ${{ env.HEAD_SHA }}

15
.groovylintrc.json Normal file
View file

@ -0,0 +1,15 @@
{
"extends": "recommended-jenkinsfile",
"rules": {
"formatting.LineLength": {
"length": 300,
"severity": "info"
},
"size.NestedBlockDepth": {
"maxNestedBlockDepth": 15
},
"formatting.DuplicateNumberLiteral": "off",
"formatting.DuplicateMapLiteral": "off",
"formatting.DuplicateStringLiteral": "off"
}
}

View file

@ -36,38 +36,38 @@ pipeline {
}
environment {
MIN_OSX_VERSION = "10.15"
MIN_OSX_VERSION = '10.15'
}
stages {
stage("Checkout Nightly Build") {
stage('Checkout Nightly Build') {
steps {
checkout changelog: false, poll: false, scm: [
$class: 'SubversionSCM',
locations: [[local: '.', remote: 'https://svn.wildfiregames.com/nightly-build/trunk']],
quietOperation: false,
workspaceUpdater: [$class: 'UpdateWithCleanUpdater']]
sh "svn cleanup"
sh 'svn cleanup'
}
}
stage("Compile Native macOS Executable") {
stage('Compile Native macOS Executable') {
steps {
sh "cd libraries/ && MIN_OSX_VERSION=${env.MIN_OSX_VERSION} ./build-macos-libs.sh ${JOBS} --force-rebuild"
sh "cd build/workspaces/ && ./update-workspaces.sh --macosx-version-min=${env.MIN_OSX_VERSION}"
sh "cd build/workspaces/gcc/ && make ${JOBS}"
sh "svn cleanup --remove-unversioned build"
sh "svn cleanup --remove-unversioned libraries"
sh 'svn cleanup --remove-unversioned build'
sh 'svn cleanup --remove-unversioned libraries'
}
}
stage("Create Mod Archives") {
stage('Create Mod Archives') {
steps {
sh "source/tools/dist/build-archives.sh"
sh 'source/tools/dist/build-archives.sh'
}
}
stage("Create Native macOS Bundle") {
stage('Create Native macOS Bundle') {
steps {
withCredentials([
string(credentialsId: 'apple-keychain', variable: 'KEYCHAIN_PW'),
@ -88,22 +88,22 @@ pipeline {
}
}
stage("Compile Intel macOS Executable") {
stage('Compile Intel macOS Executable') {
environment {
ARCH = "x86_64"
HOSTTYPE = "x86_64"
ARCH = 'x86_64'
HOSTTYPE = 'x86_64'
}
steps {
sh "cd libraries/ && MIN_OSX_VERSION=${env.MIN_OSX_VERSION} ./build-macos-libs.sh ${JOBS} --force-rebuild"
sh "cd build/workspaces/ && ./update-workspaces.sh --macosx-version-min=${env.MIN_OSX_VERSION}"
sh "cd build/workspaces/gcc/ && make clean"
sh 'cd build/workspaces/gcc/ && make clean'
sh "cd build/workspaces/gcc/ && make ${JOBS}"
sh "svn cleanup --remove-unversioned build"
sh "svn cleanup --remove-unversioned libraries"
sh 'svn cleanup --remove-unversioned build'
sh 'svn cleanup --remove-unversioned libraries'
}
}
stage("Create Intel macOS Bundle") {
stage('Create Intel macOS Bundle') {
steps {
withCredentials([
string(credentialsId: 'apple-keychain', variable: 'KEYCHAIN_PW'),
@ -125,13 +125,13 @@ pipeline {
}
}
stage("Create Windows Installer & Tarballs") {
stage('Create Windows Installer & Tarballs') {
steps {
sh "BUNDLE_VERSION=${params.BUNDLE_VERSION} DO_GZIP=${params.DO_GZIP} source/tools/dist/build-unix-win32.sh"
}
}
stage("Generate Signatures and Checksums") {
stage('Generate Signatures and Checksums') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'minisign-releases-key', keyFileVariable: 'MINISIGN_KEY', passphraseVariable: 'MINISIGN_PASS')]) {
sh 'echo ${MINISIGN_PASS} | minisign -s ${MINISIGN_KEY} -Sm *.{dmg,exe,tar.gz,tar.xz}'

View file

@ -39,46 +39,48 @@ pipeline {
LLVM_OBJDUMP = '/usr/bin/llvm-objdump'
}
stages {
stage ("Pre-build") {
stage('Pre-build') {
steps {
discoverGitReferenceBuild()
sh "git lfs pull -I binaries/data/tests"
sh "git lfs pull -I \"binaries/data/mods/_test.*\""
sh 'git lfs pull -I binaries/data/tests'
sh 'git lfs pull -I "binaries/data/mods/_test.*"'
sh "libraries/build-source-libs.sh ${JOBS} 2> freebsd-prebuild-errors.log"
sh "build/workspaces/update-workspaces.sh --jenkins-tests 2>> freebsd-prebuild-errors.log"
sh 'build/workspaces/update-workspaces.sh --jenkins-tests 2>> freebsd-prebuild-errors.log'
script {
if (params.CLEANBUILD) {
sh "cd build/workspaces/gcc/ && gmake clean config=release"
sh 'cd build/workspaces/gcc/ && gmake clean config=release'
}
}
}
post {
failure {
echo (message: readFile (file: "freebsd-prebuild-errors.log"))
echo(message: readFile(file: 'freebsd-prebuild-errors.log'))
}
}
}
stage ("Release Build") {
stage('Release Build') {
steps {
sh "cd build/workspaces/gcc/ && gmake ${JOBS} config=release"
}
post {
failure {
script { if (!params.CLEANBUILD) {
script {
if (!params.CLEANBUILD) {
build wait: false, job: "$JOB_NAME", parameters: [booleanParam(name: 'CLEANBUILD', value: true)]
}}
}
}
}
}
}
stage ("Release Tests") {
stage('Release Tests') {
steps {
timeout(time: 15) {
sh "cd binaries/system/ && ./test > cxxtest-release.xml"
sh 'cd binaries/system/ && ./test > cxxtest-release.xml'
}
}
post {

View file

@ -17,27 +17,27 @@
// This pipeline builds the game on Linux (with minimum supported versions of GCC and clang) and runs tests.
def tc_getCC(tc) {
def tc_getCC(String tc) {
def map = ['gcc12': 'gcc-12', 'clang14': 'clang-14']
return map[tc]
}
def tc_getCXX(tc) {
def tc_getCXX(String tc) {
def map = ['gcc12': 'g++-12', 'clang14': 'clang++-14']
return map[tc]
}
def tc_getLDFLAGS(tc) {
def tc_getLDFLAGS(String tc) {
def map = ['gcc12': '', 'clang14': '-fuse-ld=lld-14']
return map[tc]
}
def getParserConfig(tc, buildType) {
def getParserConfig(String tc, String buildType) {
def config
if (tc.startsWith("gcc")) {
if (tc.startsWith('gcc')) {
config = [ 'tool': 'gcc', 'name': 'GCC', 'id': 'gcc-' + buildType]
} else {
config = [ 'tool': 'clang', 'name': 'Clang', 'id': 'clang-' + buildType ]
}
if (buildType.matches("debug")) {
if (buildType.matches('debug')) {
config['name'] += ' Debug Build'
} else {
config['name'] += ' Release Build'
@ -56,7 +56,7 @@ pipeline {
agent none
stages {
stage("Linux Build") {
stage('Linux Build') {
failFast true
matrix {
@ -78,23 +78,23 @@ pipeline {
}
stages {
stage("Checkout") {
stage('Checkout') {
agent {
node {
label "LinuxAgent"
label 'LinuxAgent'
customWorkspace "workspace/${JENKINS_COMPILER}-pch-${BUILD_TYPE}"
}
}
steps {
sh "git lfs fetch -I binaries/data/tests"
sh "git lfs checkout binaries/data/tests"
sh "git lfs fetch -I \"binaries/data/mods/_test.*\""
sh "git lfs checkout binaries/data/mods/_test.*"
sh 'git lfs fetch -I binaries/data/tests'
sh 'git lfs checkout binaries/data/tests'
sh 'git lfs fetch -I "binaries/data/mods/_test.*"'
sh 'git lfs checkout binaries/data/mods/_test.*'
}
}
stage("Container") {
stage('Container') {
agent {
dockerfile {
label 'LinuxAgent'
@ -108,7 +108,7 @@ pipeline {
}
stages {
stage("Pre-build") {
stage('Pre-build') {
steps {
sh "libraries/build-source-libs.sh ${JOBS} 2> ${JENKINS_COMPILER}-prebuild-errors.log"
@ -122,12 +122,12 @@ pipeline {
}
post {
failure {
echo (message: readFile (file: "${JENKINS_COMPILER}-prebuild-errors.log"))
echo(message: readFile(file: "${JENKINS_COMPILER}-prebuild-errors.log"))
}
}
}
stage("Build") {
stage('Build') {
steps {
sh '''
rm -f thepipe
@ -141,9 +141,11 @@ pipeline {
}
post {
failure {
script { if (!params.CLEANBUILD) {
script {
if (!params.CLEANBUILD) {
build wait: false, job: "$JOB_NAME", parameters: [booleanParam(name: 'CLEANBUILD', value: true)]
}}
}
}
}
always {
script {
@ -153,7 +155,7 @@ pipeline {
analysisModelId: config['tool'],
name: config['name'],
id : config['id'],
pattern: "build.log"
pattern: 'build.log'
),
skipPublishingChecks: true,
enabledForFailure: true,
@ -164,11 +166,11 @@ pipeline {
}
}
stage("Test") {
stage('Test') {
steps {
timeout(time: 15) {
script {
def bin = env.BUILD_TYPE == "debug" ? "test_dbg" : "test"
def bin = env.BUILD_TYPE == 'debug' ? 'test_dbg' : 'test'
sh "binaries/system/${bin} > cxxtest.xml"
}
}

View file

@ -33,47 +33,49 @@ pipeline {
}
stages {
stage ("Pre-build") {
stage('Pre-build') {
steps {
discoverGitReferenceBuild()
sh "git lfs pull -I binaries/data/tests"
sh "git lfs pull -I \"binaries/data/mods/_test.*\""
sh 'git lfs pull -I binaries/data/tests'
sh 'git lfs pull -I "binaries/data/mods/_test.*"'
sh "libraries/build-macos-libs.sh ${JOBS} 2> macos-prebuild-errors.log"
sh "build/workspaces/update-workspaces.sh --jenkins-tests 2>> macos-prebuild-errors.log"
sh 'build/workspaces/update-workspaces.sh --jenkins-tests 2>> macos-prebuild-errors.log'
script {
if (params.CLEANBUILD) {
sh "cd build/workspaces/gcc/ && make clean config=debug"
sh "cd build/workspaces/gcc/ && make clean config=release"
sh 'cd build/workspaces/gcc/ && make clean config=debug'
sh 'cd build/workspaces/gcc/ && make clean config=release'
}
}
}
post {
failure {
echo (message: readFile (file: "macos-prebuild-errors.log"))
echo(message: readFile(file: 'macos-prebuild-errors.log'))
}
}
}
stage("Debug Build") {
stage('Debug Build') {
steps {
sh "cd build/workspaces/gcc/ && make ${JOBS} config=debug"
}
post {
failure {
script { if (!params.CLEANBUILD) {
script {
if (!params.CLEANBUILD) {
build wait: false, job: "$JOB_NAME", parameters: [booleanParam(name: 'CLEANBUILD', value: true)]
}}
}
}
}
}
}
stage("Debug Tests") {
stage('Debug Tests') {
steps {
timeout(time: 15) {
sh "cd binaries/system/ && ./test_dbg > cxxtest-debug.xml"
sh 'cd binaries/system/ && ./test_dbg > cxxtest-debug.xml'
}
}
post {
@ -83,16 +85,16 @@ pipeline {
}
}
stage("Release Build") {
stage('Release Build') {
steps {
sh "cd build/workspaces/gcc/ && make ${JOBS} config=release"
}
}
stage("Release Tests") {
stage('Release Tests') {
steps {
timeout(time: 15) {
sh "cd binaries/system/ && ./test > cxxtest-release.xml"
sh 'cd binaries/system/ && ./test > cxxtest-release.xml'
}
}
post {

View file

@ -17,10 +17,10 @@
// This pipeline is used to generate the nightly builds.
def visualStudioPath = "\"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe\""
def buildOptions = "/p:PlatformToolset=v141_xp /p:XPDeprecationWarning=false /t:pyrogenesis /t:AtlasUI %JOBS% /nologo -clp:Warningsonly -clp:ErrorsOnly"
def visualStudioPath = '"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe"'
def buildOptions = '/p:PlatformToolset=v141_xp /p:XPDeprecationWarning=false /t:pyrogenesis /t:AtlasUI %JOBS% /nologo -clp:Warningsonly -clp:ErrorsOnly'
def gitHash = ""
def gitHash = ''
def buildSPIRV = false
pipeline {
@ -37,21 +37,21 @@ pipeline {
}
stages {
stage("Generate build version") {
stage('Generate build version') {
steps {
checkout scmGit(branches: [[name: "${GIT_BRANCH}"]], extensions: [cleanAfterCheckout(), localBranch()])
script { gitHash = bat(script:"@git rev-parse --short HEAD", returnStdout: true ).trim() }
bat "cd build\\build_version && build_version.bat"
script { gitHash = bat(script:'@git rev-parse --short HEAD', returnStdout: true).trim() }
bat 'cd build\\build_version && build_version.bat'
}
}
stage("Pull game assets") {
stage('Pull game assets') {
steps {
bat "git lfs pull"
bat 'git lfs pull'
}
}
stage("Check for shader changes") {
stage('Check for shader changes') {
when {
anyOf {
changeset 'binaries/data/mods/**/shaders/**/*.xml'
@ -63,35 +63,35 @@ pipeline {
}
}
stage ("Pre-build") {
stage('Pre-build') {
steps {
bat "cd libraries && get-windows-libs.bat"
bat "(robocopy E:\\wxWidgets-3.2.6\\lib libraries\\win32\\wxwidgets\\lib /MIR /NDL /NJH /NJS /NP /NS /NC) ^& IF %ERRORLEVEL% LEQ 1 exit 0"
bat "(robocopy E:\\wxWidgets-3.2.6\\include libraries\\win32\\wxwidgets\\include /MIR /NDL /NJH /NJS /NP /NS /NC) ^& IF %ERRORLEVEL% LEQ 1 exit 0"
bat "cd build\\workspaces && update-workspaces.bat --without-pch --without-tests"
bat 'cd libraries && get-windows-libs.bat'
bat '(robocopy E:\\wxWidgets-3.2.6\\lib libraries\\win32\\wxwidgets\\lib /MIR /NDL /NJH /NJS /NP /NS /NC) ^& IF %ERRORLEVEL% LEQ 1 exit 0'
bat '(robocopy E:\\wxWidgets-3.2.6\\include libraries\\win32\\wxwidgets\\include /MIR /NDL /NJH /NJS /NP /NS /NC) ^& IF %ERRORLEVEL% LEQ 1 exit 0'
bat 'cd build\\workspaces && update-workspaces.bat --without-pch --without-tests'
}
}
stage ("Build") {
stage('Build') {
steps {
bat("cd build\\workspaces\\vs2017 && ${visualStudioPath} pyrogenesis.sln /p:Configuration=Release ${buildOptions}")
}
}
stage("Generate entity XML schema") {
stage('Generate entity XML schema') {
steps {
bat "cd binaries\\system && pyrogenesis.exe -mod=public -dumpSchema"
bat 'cd binaries\\system && pyrogenesis.exe -mod=public -dumpSchema'
}
}
stage("Mirror to SVN") {
stage('Mirror to SVN') {
steps {
ws("workspace/nightly-svn") {
bat "svn co https://svn.wildfiregames.com/nightly-build/trunk ."
bat "svn revert -R ."
ws('workspace/nightly-svn') {
bat 'svn co https://svn.wildfiregames.com/nightly-build/trunk .'
bat 'svn revert -R .'
script { env.NIGHTLY_PATH = env.WORKSPACE }
}
bat """
bat '''
(robocopy . %NIGHTLY_PATH% ^
/XD .git ^
/XF .gitattributes ^
@ -108,68 +108,71 @@ pipeline {
/XF %NIGHTLY_PATH%\\source\\tools\\spirv\\rules.json ^
/XF %NIGHTLY_PATH%\\binaries\\data\\mods\\public\\gui\\credits\\texts\\translators.json ^
/MIR /NDL /NJH /NJS /NP /NS /NC) ^& IF %ERRORLEVEL% LEQ 1 exit 0
"""
bat """
'''
bat '''
(robocopy binaries\\system ..\\nightly-svn\\binaries\\system ^
/XF *.exp ^
/XF *.lib ^
/MIR /NDL /NJH /NJS /NP /NS /NC) ^& IF %ERRORLEVEL% LEQ 1 exit 0
"""
'''
}
}
stage("Check-in SPIR-V rules") {
stage('Check-in SPIR-V rules') {
when {
expression { env.spirv_rules_FILENAME }
}
steps {
ws("workspace/nightly-svn") {
ws('workspace/nightly-svn') {
unstash 'spirv_rules'
bat "move spirv_rules source\\tools\\spirv\\rules.json"
bat 'move spirv_rules source\\tools\\spirv\\rules.json'
}
script { buildSPIRV = true }
}
}
stage("Recompile SPIR-V shaders") {
stage('Recompile SPIR-V shaders') {
when {
expression { buildSPIRV }
}
steps {
ws("workspace/nightly-svn") {
bat "del /s /q binaries\\data\\mods\\mod\\shaders\\spirv"
bat "del /s /q binaries\\data\\mods\\public\\shaders\\spirv"
bat "python source/tools/spirv/compile.py -d binaries/data/mods/mod binaries/data/mods/mod source/tools/spirv/rules.json binaries/data/mods/mod"
bat "python source/tools/spirv/compile.py -d binaries/data/mods/mod binaries/data/mods/public source/tools/spirv/rules.json binaries/data/mods/public"
ws('workspace/nightly-svn') {
bat 'del /s /q binaries\\data\\mods\\mod\\shaders\\spirv'
bat 'del /s /q binaries\\data\\mods\\public\\shaders\\spirv'
bat 'python source/tools/spirv/compile.py -d binaries/data/mods/mod binaries/data/mods/mod source/tools/spirv/rules.json binaries/data/mods/mod'
bat 'python source/tools/spirv/compile.py -d binaries/data/mods/mod binaries/data/mods/public source/tools/spirv/rules.json binaries/data/mods/public'
}
}
}
stage("Update translations") {
stage('Update translations') {
steps {
ws("workspace/nightly-svn") {
bat "cd source\\tools\\i18n && python update_templates.py"
ws('workspace/nightly-svn') {
bat 'cd source\\tools\\i18n && python update_templates.py'
withCredentials([string(credentialsId: 'TX_TOKEN', variable: 'TX_TOKEN')]) {
bat "cd source\\tools\\i18n && python pull_translations.py"
bat 'cd source\\tools\\i18n && python pull_translations.py'
}
bat "cd source\\tools\\i18n && python generate_debug_translation.py --long"
bat "cd source\\tools\\i18n && python clean_translation_files.py"
script { if (!params.NEW_REPO) {
bat "python source\\tools\\i18n\\check_diff.py --verbose"
}}
bat "cd source\\tools\\i18n && python credit_translators.py"
bat 'cd source\\tools\\i18n && python generate_debug_translation.py --long'
bat 'cd source\\tools\\i18n && python clean_translation_files.py'
script {
if (!params.NEW_REPO) {
bat 'python source\\tools\\i18n\\check_diff.py --verbose'
}
}
bat 'cd source\\tools\\i18n && python credit_translators.py'
}
}
}
stage("Commit") {
stage('Commit') {
steps {
ws("workspace/nightly-svn") {
ws('workspace/nightly-svn') {
bat "(for /F \"tokens=* delims=? \" %%A in ('svn status ^| findstr /R \"^?\"') do (svn add \"%%A\")) || (echo No new files found) ^& exit 0"
bat "(for /F \"tokens=* delims=! \" %%A in ('svn status ^| findstr /R \"^!\"') do (svn delete \"%%A\")) || (echo No deleted files found) ^& exit 0"
bat "for /R %%F in (*.sh) do (svn propset svn:executable ON %%F)"
bat 'for /R %%F in (*.sh) do (svn propset svn:executable ON %%F)'
withCredentials([usernamePassword(credentialsId: 'nightly-autobuild', passwordVariable: 'SVNPASS', usernameVariable: 'SVNUSER')]) {
script { env.GITHASH = gitHash
script {
env.GITHASH = gitHash
bat 'svn commit --username %SVNUSER% --password %SVNPASS% --no-auth-cache --non-interactive -m "Nightly build for %GITHASH% (%DATE%)"'
}
}
@ -180,8 +183,8 @@ pipeline {
post {
always {
ws("workspace/nightly-svn") {
bat "svn cleanup"
ws('workspace/nightly-svn') {
bat 'svn cleanup'
}
}
}

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -28,32 +28,32 @@ pipeline {
REPORT_PATH = '../../../coverage-results/'
}
stages {
stage("Setup") {
stage('Setup') {
steps {
sh "sudo zfs clone zpool0/gcc7@latest zpool0/docker-coverage"
sh 'sudo zfs clone zpool0/gcc7@latest zpool0/docker-coverage'
}
}
stage("Build") {
stage('Build') {
steps {
ws("/zpool0/docker-coverage"){
dir('build/workspaces/'){
sh "./update-workspaces.sh -j1 --jenkins-tests --coverage"
dir('gcc/'){
ws('/zpool0/docker-coverage') {
dir('build/workspaces/') {
sh './update-workspaces.sh -j1 --jenkins-tests --coverage'
dir('gcc/') {
// Reset everything in case there were ever leftovers
sh "lcov --directory . --zerocounters"
sh "make -B -j1 test"
sh 'lcov --directory . --zerocounters'
sh 'make -B -j1 test'
}
}
}
}
}
stage("Generation") {
stage('Generation') {
steps {
ws("/zpool0/docker-coverage"){
dir('build/workspaces/gcc'){
ws('/zpool0/docker-coverage') {
dir('build/workspaces/gcc') {
// The executable must be launched from the same path
// as where it was built else nothing is generated.
sh "../../../binaries/system/test"
sh '../../../binaries/system/test'
// Capture the symbols.
sh "lcov --directory . --capture --output-file ${INFO_FILE}"
// Remove things we don't need to analyze like external
@ -65,19 +65,19 @@ pipeline {
}
}
}
stage("Upload") {
stage('Upload') {
steps {
ws("/zpool0/docker-coverage"){
sh "rsync -airt --progress coverage-results/* docs.wildfiregames.com:~/www/coverage/"
ws('/zpool0/docker-coverage') {
sh 'rsync -airt --progress coverage-results/* docs.wildfiregames.com:~/www/coverage/'
}
}
}
}
post {
always {
ws("/zpool0/trunk") {
ws('/zpool0/trunk') {
sleep 10
sh "sudo zfs destroy zpool0/docker-coverage"
sh 'sudo zfs destroy zpool0/docker-coverage'
}
}
}

View file

@ -31,34 +31,34 @@ pipeline {
}
stages {
stage("Pull documentation assets") {
stage('Pull documentation assets') {
steps {
sh "git lfs pull -I docs/doxygen"
sh 'git lfs pull -I docs/doxygen'
}
}
stage("Engine docs") {
stage('Engine docs') {
steps {
sh "cd docs/doxygen/ && cmake -S . -B build-docs && cmake --build build-docs"
sh 'cd docs/doxygen/ && cmake -S . -B build-docs && cmake --build build-docs'
}
}
stage("Entity docs") {
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"
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") {
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"
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") {
stage('Upload') {
steps {
sshPublisher alwaysPublishFromMaster: true, failOnError: true, publishers: [
sshPublisherDesc(configName: 'docs.wildfiregames.com', transfers: [

View file

@ -17,8 +17,8 @@
// This pipeline builds the game on Windows (with the MSVC 15.0 compiler) and runs tests.
def visualStudioPath = "\"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe\""
def buildOptions = "/p:PlatformToolset=v141_xp /p:XPDeprecationWarning=false /t:pyrogenesis /t:AtlasUI /t:test %JOBS% /nologo -clp:NoSummary"
def visualStudioPath = '"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe"'
def buildOptions = '/p:PlatformToolset=v141_xp /p:XPDeprecationWarning=false /t:pyrogenesis /t:AtlasUI /t:test %JOBS% /nologo -clp:NoSummary'
pipeline {
// Stop previous build in pull requests, but not in branches
@ -36,17 +36,17 @@ pipeline {
}
stages {
stage ("Pre-build") {
stage('Pre-build') {
steps {
discoverGitReferenceBuild()
bat "git lfs pull -I binaries/data/tests"
bat "git lfs pull -I \"binaries/data/mods/_test.*\""
bat 'git lfs pull -I binaries/data/tests'
bat 'git lfs pull -I "binaries/data/mods/_test.*"'
bat "cd libraries && get-windows-libs.bat"
bat "(robocopy /MIR /NDL /NJH /NJS /NP /NS /NC E:\\wxWidgets-3.2.6\\lib libraries\\win32\\wxwidgets\\lib) ^& IF %ERRORLEVEL% LEQ 1 exit 0"
bat "(robocopy /MIR /NDL /NJH /NJS /NP /NS /NC E:\\wxWidgets-3.2.6\\include libraries\\win32\\wxwidgets\\include) ^& IF %ERRORLEVEL% LEQ 1 exit 0"
bat "cd build\\workspaces && update-workspaces.bat --jenkins-tests"
bat 'cd libraries && get-windows-libs.bat'
bat '(robocopy /MIR /NDL /NJH /NJS /NP /NS /NC E:\\wxWidgets-3.2.6\\lib libraries\\win32\\wxwidgets\\lib) ^& IF %ERRORLEVEL% LEQ 1 exit 0'
bat '(robocopy /MIR /NDL /NJH /NJS /NP /NS /NC E:\\wxWidgets-3.2.6\\include libraries\\win32\\wxwidgets\\include) ^& IF %ERRORLEVEL% LEQ 1 exit 0'
bat 'cd build\\workspaces && update-workspaces.bat --jenkins-tests'
script {
if (params.CLEANBUILD) {
@ -57,23 +57,25 @@ pipeline {
}
}
stage("Debug Build") {
stage('Debug Build') {
steps {
bat "cd build\\workspaces\\vs2017 && ${visualStudioPath} pyrogenesis.sln /p:Configuration=Debug ${buildOptions}"
}
post {
failure {
script { if (!params.CLEANBUILD) {
script {
if (!params.CLEANBUILD) {
build wait: false, job: "$JOB_NAME", parameters: [booleanParam(name: 'CLEANBUILD', value: true)]
}}
}
}
}
}
}
stage("Debug Tests") {
stage('Debug Tests') {
steps {
timeout(time: 15) {
bat "cd binaries\\system && test_dbg.exe > cxxtest-debug.xml"
bat 'cd binaries\\system && test_dbg.exe > cxxtest-debug.xml'
}
}
post {
@ -83,16 +85,16 @@ pipeline {
}
}
stage ("Release Build") {
stage('Release Build') {
steps {
bat "cd build\\workspaces\\vs2017 && ${visualStudioPath} pyrogenesis.sln /p:Configuration=Release ${buildOptions}"
}
}
stage ("Release Tests") {
stage('Release Tests') {
steps {
timeout(time: 5) {
bat "cd binaries\\system && test.exe > cxxtest-release.xml"
bat 'cd binaries\\system && test.exe > cxxtest-release.xml'
}
}
post {

View file

@ -0,0 +1,43 @@
#!/bin/sh
set -e
cd "$(dirname "$0")/../../../.." || exit 1
while [ "$#" -gt 0 ]; do
case "$1" in
--from)
from_commitish=$2
shift
;;
--to)
to_commitish=$2
shift
;;
-j*) ;;
*)
printf "Unknown option: %s\n\n" "$1"
exit 1
;;
esac
shift
done
if [ -n "${from_commitish}" ]; then
if [ -n "${to_commitish}" ]; then
diff="${from_commitish}..${to_commitish}"
else
diff="${from_commitish}..$(git rev-parse HEAD)"
fi
printf "Running npm-groovy-lint linter for range\n%s\n\n" "${diff}"
fi
if [ -n "${diff}" ]; then
git diff --name-status --no-renames "${diff}" |
awk '!/^D/{if ($2 ~ /(\.Jenkinsfile)$/) {print "./" $2}}' |
xargs -n 1 npm-groovy-lint -r .groovylintrc.json
else
echo "WARNING: running npm-groovy-lint linter without base commit, likely not what you want."
find "build/jenkins/pipelines" \( -name '*.Jenkinsfile' \) >npm-groovy-lint-file-list.txt
xargs -n 1 npm-groovy-lint -r .groovylintrc.json <npm-groovy-lint-file-list.txt
rm npm-groovy-lint-file-list.txt
fi

View file

@ -23,6 +23,13 @@ done
has_errors=false
if command -v npm-groovy-lint >/dev/null; then
# shellcheck disable=SC2086
./jenkinsfiles/jenkinsfiles.sh ${args} || has_errors=true
else
echo "npm-groovy-lint not found in path"
fi
if command -v cppcheck >/dev/null; then
# shellcheck disable=SC2086
./cppcheck/cppcheck.sh ${args} || has_errors=true