diff options
author | Patric Stout <truebrain@openttd.org> | 2019-04-07 12:01:32 +0200 |
---|---|---|
committer | glx22 <glx22@users.noreply.github.com> | 2020-06-05 19:36:05 +0200 |
commit | 4218ebc932950a8751146784ea5dad127bc27b10 (patch) | |
tree | 6483a0aad91205fed7c2adfec21699e1e55847b3 | |
parent | b7643b1d36cb41eb6712042761c13b9819fcbe74 (diff) | |
download | openttd-4218ebc932950a8751146784ea5dad127bc27b10.tar.xz |
Fix: [AzurePipelines] switch the CI / CD to CMake too
This also means dropping Debian/jessie, as it has a CMake that is
too old (3.0), with no real path to upgrade.
-rw-r--r-- | azure-pipelines-ci.yml | 41 | ||||
-rw-r--r-- | azure-pipelines/templates/ci-opengfx.yml | 13 | ||||
-rw-r--r-- | azure-pipelines/templates/linux-build.yml | 5 | ||||
-rw-r--r-- | azure-pipelines/templates/linux-claim-bundles.yml | 2 | ||||
-rw-r--r-- | azure-pipelines/templates/osx-build.yml | 10 | ||||
-rw-r--r-- | azure-pipelines/templates/osx-dependencies.yml | 7 | ||||
-rw-r--r-- | azure-pipelines/templates/release-bundles.yml | 11 | ||||
-rw-r--r-- | azure-pipelines/templates/release-manifest.yml | 4 | ||||
-rw-r--r-- | azure-pipelines/templates/release-prepare-source.yml | 4 | ||||
-rw-r--r-- | azure-pipelines/templates/release.yml | 50 | ||||
-rw-r--r-- | azure-pipelines/templates/windows-build.yml | 11 | ||||
-rw-r--r-- | azure-pipelines/templates/windows-dependency-nsis.yml | 26 | ||||
-rw-r--r-- | cmake/scripts/FindVersion.cmake | 31 |
13 files changed, 119 insertions, 96 deletions
diff --git a/azure-pipelines-ci.yml b/azure-pipelines-ci.yml index 719ac84b5..463d09b8b 100644 --- a/azure-pipelines-ci.yml +++ b/azure-pipelines-ci.yml @@ -14,23 +14,34 @@ jobs: strategy: matrix: Win32: - BuildPlatform: 'Win32' + BuildArch: 'Win32' + VcpkgTargetTriplet: 'x86-windows-static' Win64: - BuildPlatform: 'x64' + BuildArch: 'x64' + VcpkgTargetTriplet: 'x64-windows-static' steps: - template: azure-pipelines/templates/ci-git-rebase.yml - template: azure-pipelines/templates/windows-dependencies.yml - template: azure-pipelines/templates/ci-opengfx.yml + parameters: + SharedFolder: C:/Users/Public/Documents/OpenTTD - template: azure-pipelines/templates/windows-build.yml parameters: - BuildPlatform: $(BuildPlatform) - BuildConfiguration: Debug - - script: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86 - cd projects - call regression.bat + BuildArch: $(BuildArch) + VcpkgTargetTriplet: $(VcpkgTargetTriplet) + BuildConfiguration: 'Debug' + - task: VSBuild@1 + displayName: 'Prepare regression files' + inputs: + solution: build/regression_files.vcxproj + configuration: 'Debug' + - task: VSBuild@1 displayName: 'Test' + inputs: + solution: build/RUN_TESTS.vcxproj + configuration: 'Debug' + - job: linux displayName: 'Linux' @@ -49,7 +60,10 @@ jobs: steps: - template: azure-pipelines/templates/ci-git-rebase.yml # The dockers already have the dependencies installed - # The dockers already have OpenGFX installed + - template: azure-pipelines/templates/ci-opengfx.yml + parameters: + SharedFolder: /usr/local/share/games/openttd + PrefixCommand: sudo - template: azure-pipelines/templates/linux-build.yml parameters: Image: compile-farm-ci @@ -67,6 +81,13 @@ jobs: - template: azure-pipelines/templates/ci-git-rebase.yml - template: azure-pipelines/templates/osx-dependencies.yml - template: azure-pipelines/templates/ci-opengfx.yml + parameters: + SharedFolder: /Library/Application Support/OpenTTD + PrefixCommand: sudo - template: azure-pipelines/templates/osx-build.yml - - script: 'make regression' + - script: | + set -ex + + cd build + CTEST_OUTPUT_ON_FAILURE=1 make test displayName: 'Test' diff --git a/azure-pipelines/templates/ci-opengfx.yml b/azure-pipelines/templates/ci-opengfx.yml index cdee9feca..60231e386 100644 --- a/azure-pipelines/templates/ci-opengfx.yml +++ b/azure-pipelines/templates/ci-opengfx.yml @@ -1,8 +1,13 @@ +parameters: + SharedFolder: '/usr/local/share/games/openttd' + PrefixCommand: '' + steps: - bash: | set -ex - cd bin/baseset - curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip > opengfx-all.zip - unzip opengfx-all.zip - rm -f opengfx-all.zip + ${{ parameters.PrefixCommand }} mkdir -p "${{ parameters.SharedFolder }}/baseset" + cd "${{ parameters.SharedFolder }}/baseset" + ${{ parameters.PrefixCommand }} curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip + ${{ parameters.PrefixCommand }} unzip opengfx-all.zip + ${{ parameters.PrefixCommand }} rm -f opengfx-all.zip displayName: 'Install OpenGFX' diff --git a/azure-pipelines/templates/linux-build.yml b/azure-pipelines/templates/linux-build.yml index a173f3364..88095c9d3 100644 --- a/azure-pipelines/templates/linux-build.yml +++ b/azure-pipelines/templates/linux-build.yml @@ -28,9 +28,12 @@ steps: inputs: command: 'Run an image' imageName: openttd/${{ parameters.Image }}:${{ parameters.Tag }} - volumes: '$(Build.SourcesDirectory):$(Build.SourcesDirectory)' + volumes: | + $(Build.SourcesDirectory):$(Build.SourcesDirectory) + /usr/local/share/games/openttd:/usr/local/share/games/openttd workingDirectory: '$(Build.SourcesDirectory)' containerCommand: ${{ parameters.ContainerCommand }} runInBackground: false envVars: | TARGET_BRANCH + CTEST_OUTPUT_ON_FAILURE=1 diff --git a/azure-pipelines/templates/linux-claim-bundles.yml b/azure-pipelines/templates/linux-claim-bundles.yml index 4434dfcc7..162584f23 100644 --- a/azure-pipelines/templates/linux-claim-bundles.yml +++ b/azure-pipelines/templates/linux-claim-bundles.yml @@ -1,5 +1,5 @@ steps: # Because we run the compile in a docker (under root), we are not owner # of the 'bundles' folder. Fix that by executing a chown on it. -- bash: sudo chown -R $(id -u):$(id -g) bundles +- bash: sudo chown -R $(id -u):$(id -g) build/bundles displayName: 'Claim bundles folder back' diff --git a/azure-pipelines/templates/osx-build.yml b/azure-pipelines/templates/osx-build.yml index ae1724125..2baabf932 100644 --- a/azure-pipelines/templates/osx-build.yml +++ b/azure-pipelines/templates/osx-build.yml @@ -1,5 +1,9 @@ steps: -- script: './configure PKG_CONFIG_PATH=/usr/local/lib/pkgconfig --enable-static' - displayName: 'Configure' -- script: 'make -j2' +- script: | + set -ex + + mkdir build + cd build + cmake .. + make -j2 displayName: 'Build' diff --git a/azure-pipelines/templates/osx-dependencies.yml b/azure-pipelines/templates/osx-dependencies.yml index 0393a5662..d918d12c5 100644 --- a/azure-pipelines/templates/osx-dependencies.yml +++ b/azure-pipelines/templates/osx-dependencies.yml @@ -2,11 +2,4 @@ steps: - script: | set -ex HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config lzo xz libpng freetype - # Remove the dynamic libraries of these libraries, to ensure we use - # the static versions. That is important, as it is unlikely any - # end-user has these brew libraries installed. - rm /usr/local/Cellar/lzo/*/lib/*.dylib - rm /usr/local/Cellar/xz/*/lib/*.dylib - rm /usr/local/Cellar/libpng/*/lib/*.dylib - rm /usr/local/Cellar/freetype/*/lib/*.dylib displayName: 'Install dependencies' diff --git a/azure-pipelines/templates/release-bundles.yml b/azure-pipelines/templates/release-bundles.yml index 9c5a48b96..f9f9fdcdd 100644 --- a/azure-pipelines/templates/release-bundles.yml +++ b/azure-pipelines/templates/release-bundles.yml @@ -5,7 +5,14 @@ steps: - ${{ if eq(parameters.CalculateChecksums, true) }}: - bash: | set -ex - cd bundles + cd build/bundles + + # CPack generates sha256, but with a slightly different name than + # our own convention. Also, because we rename files, the content + # might be out of date. To be safe, we remove it and replace it + # with our own version. + rm -f *.sha256 + for i in $(ls); do openssl dgst -r -md5 -hex $i > $i.md5sum openssl dgst -r -sha1 -hex $i > $i.sha1sum @@ -15,5 +22,5 @@ steps: - task: PublishBuildArtifacts@1 displayName: 'Publish bundles' inputs: - PathtoPublish: bundles/ + PathtoPublish: build/bundles/ ArtifactName: bundles diff --git a/azure-pipelines/templates/release-manifest.yml b/azure-pipelines/templates/release-manifest.yml index 9e8b486d5..9fe30717b 100644 --- a/azure-pipelines/templates/release-manifest.yml +++ b/azure-pipelines/templates/release-manifest.yml @@ -15,6 +15,6 @@ steps: - script: | set -ex ./azure-pipelines/manifest.sh ../a/bundles/ - mkdir -p bundles - mv manifest.yaml bundles/ + mkdir -p build/bundles + mv manifest.yaml build/bundles/ displayName: 'Create manifest.yaml' diff --git a/azure-pipelines/templates/release-prepare-source.yml b/azure-pipelines/templates/release-prepare-source.yml index b20bf0b35..3eb148aef 100644 --- a/azure-pipelines/templates/release-prepare-source.yml +++ b/azure-pipelines/templates/release-prepare-source.yml @@ -17,7 +17,9 @@ steps: git checkout -B ${BUILD_SOURCEBRANCHNAME} fi - ./findversion.sh > .ottdrev + # Generate .ottdrev, which contains the version information + cmake -DGENERATE_OTTDREV=1 -P cmake/scripts/FindVersion.cmake + ./azure-pipelines/changelog.sh > .changelog TZ='UTC' date +"%Y-%m-%d %H:%M UTC" > .release_date cat .ottdrev | cut -f 1 -d$'\t' > .version diff --git a/azure-pipelines/templates/release.yml b/azure-pipelines/templates/release.yml index b9a559726..60e2ff5fd 100644 --- a/azure-pipelines/templates/release.yml +++ b/azure-pipelines/templates/release.yml @@ -22,9 +22,9 @@ jobs: # Copy back release_date, as it is needed for the template 'release-bundles' cp openttd-$(Build.BuildNumber)/.release_date .release_date - mkdir bundles - tar --xz -cf bundles/openttd-$(Build.BuildNumber)-source.tar.xz openttd-$(Build.BuildNumber) - zip -9 -r -q bundles/openttd-$(Build.BuildNumber)-source.zip openttd-$(Build.BuildNumber) + mkdir -p build/bundles + tar --xz -cf build/bundles/openttd-$(Build.BuildNumber)-source.tar.xz openttd-$(Build.BuildNumber) + zip -9 -r -q build/bundles/openttd-$(Build.BuildNumber)-source.zip openttd-$(Build.BuildNumber) displayName: 'Create bundle' - template: release-bundles.yml @@ -39,10 +39,10 @@ jobs: - script: | set -ex - mkdir -p bundles - cp .changelog bundles/changelog.txt - cp .release_date bundles/released.txt - cp README.md bundles/README.md + mkdir -p build/bundles + cp .changelog build/bundles/changelog.txt + cp .release_date build/bundles/released.txt + cp README.md build/bundles/README.md displayName: 'Copy meta files' - template: release-bundles.yml parameters: @@ -73,33 +73,33 @@ jobs: strategy: matrix: Win32: - BuildPlatform: 'Win32' BundlePlatform: 'win32' + BuildArch: 'Win32' + VcpkgTargetTriplet: 'x86-windows-static' Win64: - BuildPlatform: 'x64' BundlePlatform: 'win64' + BuildArch: 'x64' + VcpkgTargetTriplet: 'x64-windows-static' steps: - template: release-fetch-source.yml - template: windows-dependencies.yml - template: windows-dependency-zip.yml - - ${{ if eq(parameters.IsStableRelease, true) }}: - - template: windows-dependency-nsis.yml - template: windows-build.yml parameters: - BuildPlatform: $(BuildPlatform) - BuildConfiguration: Release + BuildArch: $(BuildArch) + VcpkgTargetTriplet: $(VcpkgTargetTriplet) + BuildConfiguration: 'RelWithDebInfo' + - task: VSBuild@1 + displayName: 'Create bundles' + inputs: + solution: build/PACKAGE.vcxproj + configuration: 'RelWithDebInfo' - bash: | set -ex - make -f Makefile.msvc bundle_pdb bundle_zip PLATFORM=$(BundlePlatform) BUNDLE_NAME=openttd-$(Build.BuildNumber)-windows-$(BundlePlatform) - displayName: 'Create bundles' - - ${{ if eq(parameters.IsStableRelease, true) }}: - - bash: | - set -ex - # NSIS will be part of the Hosted image in the next update. Till then, we set the PATH ourself - export PATH="${PATH}:/c/Program Files (x86)/NSIS" - make -f Makefile.msvc bundle_exe PLATFORM=$(BundlePlatform) BUNDLE_NAME=openttd-$(Build.BuildNumber)-windows-$(BundlePlatform) - displayName: 'Create installer bundle' + + cp build/RelWithDebInfo/openttd.pdb build/bundles/openttd-$(Build.BuildNumber)-windows-$(BundlePlatform).pdb + displayName: 'Copy PDB to bundles folder' - template: release-bundles.yml - ${{ if eq(parameters.IsStableRelease, true) }}: @@ -153,7 +153,11 @@ jobs: - template: release-fetch-source.yml - template: osx-dependencies.yml - template: osx-build.yml - - script: 'make bundle_zip bundle_dmg BUNDLE_NAME=openttd-$(Build.BuildNumber)-macosx' + - script: | + set -ex + + cd build + make package displayName: 'Create bundles' - template: release-bundles.yml diff --git a/azure-pipelines/templates/windows-build.yml b/azure-pipelines/templates/windows-build.yml index 117dd062c..fccf62d7b 100644 --- a/azure-pipelines/templates/windows-build.yml +++ b/azure-pipelines/templates/windows-build.yml @@ -1,11 +1,16 @@ parameters: - BuildPlatform: '' + BuildArch: '' + VcpkgTargetTriplet: '' + BuildConfiguration: '' steps: +- task: CMake@1 + displayName: 'Configure' + inputs: + cmakeArgs: '.. -G "Visual Studio 15 2017" -A ${{ parameters.BuildArch }} -DCMAKE_TOOLCHAIN_FILE="c:\vcpkg\scripts\buildsystems\vcpkg.cmake" -DVCPKG_TARGET_TRIPLET="${{ parameters.VcpkgTargetTriplet }}"' - task: VSBuild@1 displayName: 'Build' inputs: - solution: 'projects/openttd_vs141.sln' - platform: ${{ parameters.BuildPlatform }} + solution: build/openttd.vcxproj configuration: ${{ parameters.BuildConfiguration }} maximumCpuCount: true diff --git a/azure-pipelines/templates/windows-dependency-nsis.yml b/azure-pipelines/templates/windows-dependency-nsis.yml deleted file mode 100644 index 9b54a3ac5..000000000 --- a/azure-pipelines/templates/windows-dependency-nsis.yml +++ /dev/null @@ -1,26 +0,0 @@ -parameters: - condition: true - -steps: -- bash: | - set -ex - - mkdir nsis-plugin; cd nsis-plugin - curl -L https://devs.openttd.org/~truebrain/nsis-plugins/Nsis7z.zip > Nsis7z.zip - unzip Nsis7z.zip - cp -R Plugins/* "/c/Program Files (x86)/NSIS/Plugins/" - cd ..; rm -rf nsis-plugin - - mkdir nsis-plugin; cd nsis-plugin - curl -L https://devs.openttd.org/~truebrain/nsis-plugins/NsisGetVersion.zip > NsisGetVersion.zip - unzip NsisGetVersion.zip - cp -R Plugins/* "/c/Program Files (x86)/NSIS/Plugins/x86-ansi/" - cd ..; rm -rf nsis-plugin - - mkdir nsis-plugin; cd nsis-plugin - curl -L https://devs.openttd.org/~truebrain/nsis-plugins/NsisFindProc.zip > NsisFindProc.zip - unzip NsisFindProc.zip - cp -R *.dll "/c/Program Files (x86)/NSIS/Plugins/x86-ansi/" - cd ..; rm -rf nsis-plugin - displayName: 'Install NSIS with the 7z, GetVersion, and FindProc plugins' - condition: and(succeeded(), ${{ parameters.condition }}) diff --git a/cmake/scripts/FindVersion.cmake b/cmake/scripts/FindVersion.cmake index 5edabeb19..00afa15ca 100644 --- a/cmake/scripts/FindVersion.cmake +++ b/cmake/scripts/FindVersion.cmake @@ -119,16 +119,21 @@ endif () message(STATUS "Version string: ${REV_VERSION}") -message(STATUS "Generating rev.cpp") -configure_file("${CMAKE_SOURCE_DIR}/src/rev.cpp.in" - "${FIND_VERSION_BINARY_DIR}/rev.cpp") - -if (WIN32) - message(STATUS "Generating ottdres.rc") - configure_file("${CMAKE_SOURCE_DIR}/src/os/windows/ottdres.rc.in" - "${FIND_VERSION_BINARY_DIR}/ottdres.rc") -endif (WIN32) - -message(STATUS "Generating CPackProperties.cmake") -configure_file("${CMAKE_SOURCE_DIR}/CPackProperties.cmake.in" - "${CPACK_BINARY_DIR}/CPackProperties.cmake" @ONLY) +if (GENERATE_OTTDREV) + message(STATUS "Generating .ottdrev") + file(WRITE ${CMAKE_SOURCE_DIR}/.ottdrev "${REV_VERSION}\t${REV_ISODATE}\t${REV_MODIFIED}\t${REV_HASH}\t${REV_ISTAG}\t${REV_ISSTABLETAG}\t${REV_YEAR}\n") +else (GENERATE_OTTDREV) + message(STATUS "Generating rev.cpp") + configure_file("${CMAKE_SOURCE_DIR}/src/rev.cpp.in" + "${FIND_VERSION_BINARY_DIR}/rev.cpp") + + if (WIN32) + message(STATUS "Generating ottdres.rc") + configure_file("${CMAKE_SOURCE_DIR}/src/os/windows/ottdres.rc.in" + "${FIND_VERSION_BINARY_DIR}/ottdres.rc") + endif (WIN32) + + message(STATUS "Generating CPackProperties.cmake") + configure_file("${CMAKE_SOURCE_DIR}/CPackProperties.cmake.in" + "${CPACK_BINARY_DIR}/CPackProperties.cmake" @ONLY) +endif (GENERATE_OTTDREV) |