Changeset - r24246:d76075baa37e
[Not reviewed]
master
1 12 0
Patric Stout - 6 years ago 2019-04-07 10:01:32
truebrain@openttd.org
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.
13 files changed with 117 insertions and 94 deletions:
0 comments (0 inline, 0 general)
azure-pipelines-ci.yml
Show inline comments
 
@@ -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'
azure-pipelines/templates/ci-opengfx.yml
Show inline comments
 
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'
azure-pipelines/templates/linux-build.yml
Show inline comments
 
@@ -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
azure-pipelines/templates/linux-claim-bundles.yml
Show inline comments
 
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'
azure-pipelines/templates/osx-build.yml
Show inline comments
 
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'
azure-pipelines/templates/osx-dependencies.yml
Show inline comments
 
@@ -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'
azure-pipelines/templates/release-bundles.yml
Show inline comments
 
@@ -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
azure-pipelines/templates/release-manifest.yml
Show inline comments
 
@@ -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'
azure-pipelines/templates/release-prepare-source.yml
Show inline comments
 
@@ -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
azure-pipelines/templates/release.yml
Show inline comments
 
@@ -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
 

	
azure-pipelines/templates/windows-build.yml
Show inline comments
 
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
azure-pipelines/templates/windows-dependency-nsis.yml
Show inline comments
 
deleted file
cmake/scripts/FindVersion.cmake
Show inline comments
 
@@ -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 (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)
 
    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)
 
    message(STATUS "Generating CPackProperties.cmake")
 
    configure_file("${CMAKE_SOURCE_DIR}/CPackProperties.cmake.in"
 
            "${CPACK_BINARY_DIR}/CPackProperties.cmake" @ONLY)
 
endif (GENERATE_OTTDREV)
0 comments (0 inline, 0 general)