From 4218ebc932950a8751146784ea5dad127bc27b10 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sun, 7 Apr 2019 12:01:32 +0200 Subject: 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. --- azure-pipelines/templates/ci-opengfx.yml | 13 ++++-- azure-pipelines/templates/linux-build.yml | 5 ++- azure-pipelines/templates/linux-claim-bundles.yml | 2 +- azure-pipelines/templates/osx-build.yml | 10 +++-- azure-pipelines/templates/osx-dependencies.yml | 7 --- azure-pipelines/templates/release-bundles.yml | 11 ++++- azure-pipelines/templates/release-manifest.yml | 4 +- .../templates/release-prepare-source.yml | 4 +- azure-pipelines/templates/release.yml | 50 ++++++++++++---------- azure-pipelines/templates/windows-build.yml | 11 +++-- .../templates/windows-dependency-nsis.yml | 26 ----------- 11 files changed, 70 insertions(+), 73 deletions(-) delete mode 100644 azure-pipelines/templates/windows-dependency-nsis.yml (limited to 'azure-pipelines/templates') 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 }}) -- cgit v1.2.3-70-g09d2