<commit_before>trigger:

  - master
  - release
variables:
  ExternalDataVersion: 1.2.0
pr: none
jobs:
  - job: VS2019
    timeoutInMinutes: 0
    cancelTimeoutInMinutes: 300
    pool:
      vmImage: 'windows-2019'

    steps:
      - checkout: self
        clean: true
        fetchDepth: 5
      - script: |
          if DEFINED SYSTEM_PULLREQUEST_SOURCECOMMITID git checkout $(System.PullRequest.SourceCommitId)
        displayName: Checkout pull request HEAD
      - bash: |
          set -x
          # 3.14.0 is required for VS2019 by 3.14.0-rc3 does not detect the VS2019 installation
          choco install cmake.portable --pre  --version 3.14.0-rc2
        displayName: "Chocolatey install..."
      - bash: |
          git clone -b dashboard --single-branch ${BUILD_REPOSITORY_URI} SimpleITK-dashboard

          curl -L -O https://github.com/SimpleITK/SimpleITK/releases/download/v$(ExternalDataVersion)/SimpleITKData-$(ExternalDataVersion).tar.gz
          cmake -E tar xfz SimpleITKData-$(ExternalDataVersion).tar.gz
          cmake -E rename "SimpleITK-$(ExternalDataVersion)/.ExternalData/MD5" "$(Build.SourcesDirectory)/.ExternalData/MD5"
        displayName: Download dashboard scripts and testing data
        workingDirectory: $(Agent.BuildDirectory)
      - script: |
          cmake --version
          ctest -S "$(Build.SourcesDirectory)/Testing/CI/Azure/azure.cmake" -V
        displayName: Build and test
        workingDirectory: $(Agent.BuildDirectory)
        env:
          CTEST_BUILD_CONFIGURATION: MinSizeRel
          CTEST_CMAKE_GENERATOR: "Visual Studio 16 2019"
          DASHBOARD_BRANCH_DIRECTORY: $(Agent.BuildDirectory)/SimpleITK-dashboard
          ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS: 2
          CXXFLAGS: /MP
          CFLAGS: /MP

  - job: 'LinuxGCC'
    pool:
      name: 'Default'
      demands:
      - Agent.OS -equals Linux
    strategy:
      matrix:
       default: {}
       devtools-3:
         env_file: '/opt/rh/devtoolset-3/enable'
       devtools-4:
         env_file: '/opt/rh/devtoolset-4/enable'
       devtools-6:
         env_file: '/opt/rh/devtoolset-6/enable'
       devtools-7:
         env_file: '/opt/rh/devtoolset-7/enable'
       devtools-8:
         env_file: '/opt/rh/devtoolset-8/enable'
    timeoutInMinutes: 360
    workspace:
      clean: all
    steps:
        - script: |
            git clone -b dashboard --single-branch $(Build.Repository.Uri) SimpleITK-dashboard
          displayName: Download dashboard scripts and testing data
          workingDirectory: $(Agent.BuildDirectory)
        - script: |
            [[ ! -z "$(env_file)" ]] && source $(env_file)
            cmake --version
            gcc --version
            ccache -p
            ctest -S "$(Build.SourcesDirectory)/Testing/CI/Azure/azure.cmake" -V
            ccache --show-stats
          displayName: Build and test
          env:
            CTEST_OUTPUT_ON_FALURE: 1
            DASHBOARD_BRANCH_DIRECTORY: $(Agent.BuildDirectory)/SimpleITK-dashboard
            CTEST_CACHE: |
              BUILD_DOCUMENTS:BOOL=OFF
              BUILD_EXAMPLES:BOOL=ON
              BUILD_SHARED_LIBS:BOOL=OFF
              BUILD_TESTING:BOOL=ON
              WRAP_DEFAULT:BOOL=ON
              CMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache
              CMAKE_C_COMPILER_LAUNCHER=/usr/bin/ccache
          workingDirectory: $(Agent.BuildDirectory)<commit_msg>Azure batch pipeline add ctest cache variable<commit_after>trigger:

  - master
  - release
variables:
  ExternalDataVersion: 1.2.0
  ctest.cache: ''
pr: none
jobs:
  - job: VS2019
    timeoutInMinutes: 0
    cancelTimeoutInMinutes: 300
    pool:
      vmImage: 'windows-2019'

    steps:
      - checkout: self
        clean: true
        fetchDepth: 5
      - script: |
          if DEFINED SYSTEM_PULLREQUEST_SOURCECOMMITID git checkout $(System.PullRequest.SourceCommitId)
        displayName: Checkout pull request HEAD
      - bash: |
          set -x
          # 3.14.0 is required for VS2019 by 3.14.0-rc3 does not detect the VS2019 installation
          choco install cmake.portable --pre  --version 3.14.0-rc2
        displayName: "Chocolatey install..."
      - bash: |
          git clone -b dashboard --single-branch ${BUILD_REPOSITORY_URI} SimpleITK-dashboard

          curl -L -O https://github.com/SimpleITK/SimpleITK/releases/download/v$(ExternalDataVersion)/SimpleITKData-$(ExternalDataVersion).tar.gz
          cmake -E tar xfz SimpleITKData-$(ExternalDataVersion).tar.gz
          cmake -E rename "SimpleITK-$(ExternalDataVersion)/.ExternalData/MD5" "$(Build.SourcesDirectory)/.ExternalData/MD5"
        displayName: Download dashboard scripts and testing data
        workingDirectory: $(Agent.BuildDirectory)
      - script: |
          cmake --version
          ctest -S "$(Build.SourcesDirectory)/Testing/CI/Azure/azure.cmake" -V
        displayName: Build and test
        workingDirectory: $(Agent.BuildDirectory)
        env:
          CTEST_BUILD_CONFIGURATION: MinSizeRel
          CTEST_CMAKE_GENERATOR: "Visual Studio 16 2019"
          DASHBOARD_BRANCH_DIRECTORY: $(Agent.BuildDirectory)/SimpleITK-dashboard
          ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS: 2
          CXXFLAGS: /MP
          CFLAGS: /MP

  - job: 'LinuxGCC'
    pool:
      name: 'Default'
      demands:
      - Agent.OS -equals Linux
    strategy:
      matrix:
       default: {}
       devtools-3:
         env_file: '/opt/rh/devtoolset-3/enable'
       devtools-4:
         env_file: '/opt/rh/devtoolset-4/enable'
       devtools-6:
         env_file: '/opt/rh/devtoolset-6/enable'
       devtools-7:
         env_file: '/opt/rh/devtoolset-7/enable'
       devtools-8:
         env_file: '/opt/rh/devtoolset-8/enable'
    timeoutInMinutes: 360
    workspace:
      clean: all
    steps:
        - script: |
            git clone -b dashboard --single-branch $(Build.Repository.Uri) SimpleITK-dashboard
          displayName: Download dashboard scripts and testing data
          workingDirectory: $(Agent.BuildDirectory)
        - script: |
            [[ ! -z "$(env_file)" ]] && source $(env_file)
            cmake --version
            gcc --version
            ccache -p
            ctest -S "$(Build.SourcesDirectory)/Testing/CI/Azure/azure.cmake" -V
            ccache --show-stats
          displayName: Build and test
          env:
            CTEST_OUTPUT_ON_FALURE: 1
            DASHBOARD_BRANCH_DIRECTORY: $(Agent.BuildDirectory)/SimpleITK-dashboard
            CTEST_CACHE: |
              BUILD_DOCUMENTS:BOOL=OFF
              BUILD_EXAMPLES:BOOL=ON
              BUILD_SHARED_LIBS:BOOL=OFF
              BUILD_TESTING:BOOL=ON
              WRAP_DEFAULT:BOOL=ON
              CMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache
              CMAKE_C_COMPILER_LAUNCHER=/usr/bin/ccache
              $(ctest.cache)
          workingDirectory: $(Agent.BuildDirectory)
{'fraction_non_alphanumeric': 0.09681639773222853, 'fraction_numerical': 0.01773513592091874, 'mean_word_length': 2.082437275985663, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2261180', 'n_tokens_mistral': 2208, 'n_tokens_neox': 2072, 'n_words': 423}