Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 54 additions & 41 deletions .azure/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@

resources:
repositories:
- repository: simplnx
type: github
endpoint: BlueQuartzSoftware
name: BlueQuartzSoftware/simplnx

trigger:
- develop

jobs:
- job:
strategy:
matrix:
macOS:
imageName: Darwin
Windows:
imageName: Windows_NT
preset_name: azure-windows-v143
architecture: X64
Linux:
imageName: Linux
preset_name: azure-linux-x64
architecture: X64

pool:
name: BlueQuartz Self Hosted
demands:
- Agent.OS -equals $(imageName)
- BQ.COMPLEX

- BQ.SIMPLNX
- Agent.OSArchitecture -equals $(architecture)

workspace:
clean: all

Expand All @@ -34,54 +30,71 @@ jobs:
variables:
simplnx_source_dir: $(Build.Repository.LocalPath)
build_type: Release
dream3d_data_dir: $(Agent.WorkFolder)/DREAM3D_Data

steps:
- checkout: self
submodules: true

- script: |
echo System.PullRequest.SourceBranch=$(System.PullRequest.SourceBranch)
echo System.PullRequest.PullRequestNumber=$(System.PullRequest.PullRequestNumber)
- powershell: |
try {
echo System.PullRequest.SourceBranch=$(System.PullRequest.SourceBranch)
echo System.PullRequest.PullRequestNumber=$(System.PullRequest.PullRequestNumber)
} catch {
}
echo Build.SourceBranchName=$(Build.SourceBranchName)
echo Build.Repository.Name=$(Build.Repository.Name)
echo Build.Repository.Uri=$(Build.Repository.Uri)
echo Build.Repository.LocalPath=$(Build.Repository.LocalPath)
echo Build.BuildNumber=$(Build.BuildNumber)
echo Agent.WorkFolder=$(Agent.WorkFolder)
echo Agent.OS=$(Agent.OS)
echo Build.BuildNumber=$(Build.BuildNumber)
echo Agent.OSArchitecture=$(Agent.OSArchitecture)
echo preset_name=$(preset_name)
displayName: 'Dump Azure Variables'

- powershell: |
$DLL_PATH = Get-Content $(Agent.WorkFolder)/NX_DLL_PATH.txt -Raw
Write-Host "##vso[task.prependpath]$DLL_PATH"
condition: eq(variables['Agent.OS'], 'Windows_NT')
displayName: Appending to PATH

- script: |
cmake -S $(simplnx_source_dir) -B $(Build.BinariesDirectory) -G Ninja -DCMAKE_BUILD_TYPE:STRING=$(build_type) -DDREAM3D_DATA_DIR=$(dream3d_data_dir) -C $(Agent.WorkFolder)/NX.cmake -DBUILDNAME:STRING="simplnx-$(Agent.MachineName)-$(Agent.OS)-PR$(System.PullRequest.PullRequestNumber)"
#==================================================================================================
# CTest Section:
# Keep the three `ctest -S` invocations separate so configure, build, and test output
# land in separate Azure steps.
#==================================================================================================

displayName: Configure SIMPLNX

- script: |
cmake --build $(Build.BinariesDirectory) --config $(build_type) --target all
displayName: Build SIMPLNX
- powershell: |
cd "$(Build.BinariesDirectory)"
ctest -VV "-DCTEST_SOURCE_DIR=$(simplnx_source_dir)" "-DCTEST_BINARY_DIRECTORY=$(Build.BinariesDirectory)" "-DCTEST_DASHBOARD_ROOT=$(Build.Repository.LocalPath)" "-DCMAKE_PRESET_NAME=$(preset_name)" "-DCTEST_CONFIGURATION_TYPE=$(build_type)" -S "$(Build.Repository.LocalPath)/.azure/azure_ci_configure.cmake"
exit $LASTEXITCODE
displayName: CTest Configure

- script: |
cd $(Build.BinariesDirectory)
cpack -C $(build_type) --verbose
continueOnError: true
displayName: Packing SIMPLNX
- powershell: |
cd "$(Build.BinariesDirectory)"
ctest -VV "-DCTEST_SOURCE_DIR=$(simplnx_source_dir)" "-DCTEST_BINARY_DIRECTORY=$(Build.BinariesDirectory)" "-DCTEST_DASHBOARD_ROOT=$(Build.Repository.LocalPath)" "-DCMAKE_PRESET_NAME=$(preset_name)" "-DCTEST_CONFIGURATION_TYPE=$(build_type)" -S "$(Build.Repository.LocalPath)/.azure/azure_ci_build.cmake"
exit $LASTEXITCODE
displayName: CTest Build

- script: |
cd $(Build.BinariesDirectory)
ctest -C $(build_type) -D Experimental --timeout 7200 -DCTEST_SITE:STRING=$(Agent.MachineName).bluequartz.net -Ddashboard_source_name:STRING=DREAM3D
continueOnError: true
displayName: Testing SIMPLNX
- powershell: |
cd "$(Build.BinariesDirectory)"
ctest -V --output-on-failure --no-compress-output "-DCTEST_SOURCE_DIR=$(simplnx_source_dir)" "-DCTEST_BINARY_DIRECTORY=$(Build.BinariesDirectory)" "-DCTEST_DASHBOARD_ROOT=$(Build.Repository.LocalPath)" "-DCMAKE_PRESET_NAME=$(preset_name)" "-DCTEST_CONFIGURATION_TYPE=$(build_type)" -S "$(Build.Repository.LocalPath)/.azure/azure_ci_test.cmake"
exit $LASTEXITCODE
displayName: CTest Test

#==================================================================================================
# Publish Test Results
#==================================================================================================
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFormat: CTest
testResultsFiles: $(Build.BinariesDirectory)/Testing/*/Test.xml
testRunTitle: CTest_$(Agent.Name)_$(Agent.OS)
failTaskOnFailedTests: false
displayName: Publish Test Results
failTaskOnFailedTests: true
displayName: 'Publish Test Results'

#==================================================================================================
# CPack Section
#==================================================================================================
- powershell: |
cd "$(Build.BinariesDirectory)"
cpack -C $(build_type) --verbose
exit $LASTEXITCODE
condition: succeeded()
continueOnError: true
displayName: 'Packing SIMPLNX'
40 changes: 40 additions & 0 deletions .azure/azure_ci_build.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

#==================================================================================================
# Define these variables
#==================================================================================================
# get_filename_component(HOST_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE)
## This is the Fully Qualified host name of your system
set(CTEST_SITE "$ENV{AGENT_NAME}.bluequartz.net")
## The name for this build. Combine the build type, compiler, and OS into a single string
include("${CMAKE_CURRENT_LIST_DIR}/azure_ci_mode.cmake")
ci_validate_cache()
set(CTEST_BUILD_NAME "${CMAKE_PRESET_NAME}-$ENV{BUILD_BUILDNUMBER}-PR$ENV{SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}")
## The type of build we are going to do "Release | Debug"
#set(CTEST_CONFIGURATION_TYPE Release)
## The type of generator we are going to use "Make | Ninja | NMake | JOM"
set(CTEST_CMAKE_GENERATOR "Ninja")

#==================================================================================================
# Append to the existing CTEST TAG
#==================================================================================================
ctest_start(Experimental "${CTEST_SOURCE_DIR}" "${CTEST_BINARY_DIRECTORY}" APPEND)

#==================================================================================================
# Build the project
#==================================================================================================
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}"
CONFIGURATION "${CTEST_CONFIGURATION_TYPE}"
NUMBER_ERRORS ctest_build_errors
NUMBER_WARNINGS ctest_build_warnings
RETURN_VALUE ctest_build_result
CAPTURE_CMAKE_ERROR ctest_cmake_result
)

if(NOT "${ctest_build_result}" STREQUAL "0" OR NOT "${ctest_cmake_result}" STREQUAL "0" OR ctest_build_errors GREATER 0)
message(FATAL_ERROR "BUILD ERRORS: See the ctest output above in this step's log.
Site: ${CTEST_SITE}
Build Name: ${CTEST_BUILD_NAME}
CMake returned the following error code during build: ${ctest_cmake_result}
ctest_build() returned the following error code during build: ${ctest_build_result}")
endif()

79 changes: 79 additions & 0 deletions .azure/azure_ci_configure.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@

#==================================================================================================
# Define these variables
#==================================================================================================
# get_filename_component(HOST_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE)
## This is the Fully Qualified host name of your system
set(CTEST_SITE "$ENV{AGENT_NAME}.bluequartz.net")
## The name for this build. Combine the build type, compiler, and OS into a single string
include("${CMAKE_CURRENT_LIST_DIR}/azure_ci_mode.cmake")
set(CTEST_BUILD_NAME "${CMAKE_PRESET_NAME}-$ENV{BUILD_BUILDNUMBER}-PR$ENV{SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}")
## The type of build we are going to do "Release | Debug"
#set(CTEST_CONFIGURATION_TYPE Release)
## The type of generator we are going to use "Make | Ninja | NMake | JOM"
set(CTEST_CMAKE_GENERATOR "Ninja")

#==================================================================================================
# Look for a GIT command-line client.
#==================================================================================================
if(NOT DEFINED CTEST_GIT_COMMAND)
find_program(CTEST_GIT_COMMAND NAMES git git.exe git.cmd)
endif()

if(NOT EXISTS "${CTEST_GIT_COMMAND}")
message(FATAL_ERROR "CONFIGURE ERRORS: Git is required to record the Azure-selected commit.
Site: ${CTEST_SITE}
Build Name: ${CTEST_BUILD_NAME}
No Git Found.")
endif()


#==================================================================================================
# Configure the project
#==================================================================================================
file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "
SITE:STRING=${CTEST_SITE}
BUILDNAME:STRING=${CTEST_BUILD_NAME}
CMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE}
DART_TESTING_TIMEOUT:STRING=1500"
)

#==================================================================================================
# Start CTest the project. This will create the TAG that is APPENDED to for the other 2 steps in
# the process.
#==================================================================================================
ctest_start(Experimental "${CTEST_SOURCE_DIR}" "${CTEST_BINARY_DIRECTORY}")

#==================================================================================================
# Record the Git hash for the project
#==================================================================================================
# Azure has already selected the commit. Record it without fetching or pulling.
execute_process(COMMAND "${CTEST_GIT_COMMAND}" -C "${CTEST_SOURCE_DIR}" rev-parse HEAD
RESULT_VARIABLE git_result OUTPUT_VARIABLE source_hash OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT "${git_result}" STREQUAL "0")
message(FATAL_ERROR "Cannot read the Azure-selected commit for simplnx: ${git_result}")
endif()
message(STATUS "Azure-selected simplnx: ${source_hash}")
file(WRITE "${CTEST_BINARY_DIRECTORY}/CISourceVersions.txt" "simplnx: ${source_hash}\n")


#==================================================================================================
# Configure the project
#==================================================================================================
ctest_configure( BUILD "${CTEST_BINARY_DIRECTORY}"
SOURCE "${CTEST_SOURCE_DIR}"
OPTIONS "${ci_configure_options}"
RETURN_VALUE ctest_configure_result
CAPTURE_CMAKE_ERROR ctest_cmake_result)

message(STATUS "ctest_configure_result: ${ctest_configure_result}")
message(STATUS " ctest_cmake_result: ${ctest_cmake_result}")

if(NOT "${ctest_cmake_result}" STREQUAL "0" OR NOT "${ctest_configure_result}" STREQUAL "0")
message(FATAL_ERROR "CONFIGURE ERRORS: See the ctest output above in this step's log.
Site: ${CTEST_SITE}
Build Name: ${CTEST_BUILD_NAME}
CMake returned the following error code during configure: ${ctest_cmake_result}
ctest_configure() returned the following error code during configure: ${ctest_configure_result}")
endif()
ci_validate_cache()
33 changes: 33 additions & 0 deletions .azure/azure_ci_mode.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Keep the simplnx in-core CI preset options and generated cache in agreement.
if(NOT DEFINED CMAKE_PRESET_NAME)
message(FATAL_ERROR "CMAKE_PRESET_NAME must be defined for CI.")
endif()

set(ci_configure_options
"--preset=${CMAKE_PRESET_NAME}"
"-B${CTEST_BINARY_DIRECTORY}"
"-DSIMPLNX_TEST_ALGORITHM_PATH:STRING=0"
"-DSIMPLNX_BUILD_TESTS:BOOL=ON"
)

function(ci_validate_cache)
set(cache_file "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt")
if(NOT EXISTS "${cache_file}")
message(FATAL_ERROR "CI cache is missing: ${cache_file}")
endif()

set(expected_SIMPLNX_TEST_ALGORITHM_PATH "0")
set(expected_SIMPLNX_BUILD_TESTS "ON")
foreach(key IN ITEMS SIMPLNX_TEST_ALGORITHM_PATH SIMPLNX_BUILD_TESTS)
file(STRINGS "${cache_file}" entries REGEX "^${key}:[^=]+=")
list(LENGTH entries entry_count)
if(NOT entry_count EQUAL 1)
message(FATAL_ERROR "Expected one ${key} entry in ${cache_file}; found ${entry_count}.")
endif()
string(REGEX REPLACE "^[^=]+=" "" actual "${entries}")
if(NOT "${actual}" STREQUAL "${expected_${key}}")
message(FATAL_ERROR "${cache_file}: ${key} is '${actual}'; expected '${expected_${key}}'.")
endif()
message(STATUS "Verified ${key}=${actual}")
endforeach()
endfunction()
45 changes: 45 additions & 0 deletions .azure/azure_ci_test.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

#==================================================================================================
# Define these variables
#==================================================================================================
# get_filename_component(HOST_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE)
## This is the Fully Qualified host name of your system
set(CTEST_SITE "$ENV{AGENT_NAME}.bluequartz.net")
## The name for this build. Combine the build type, compiler, and OS into a single string
include("${CMAKE_CURRENT_LIST_DIR}/azure_ci_mode.cmake")
ci_validate_cache()
if(NOT DEFINED CTEST_TEST_TIMEOUT)
load_cache("${CTEST_BINARY_DIRECTORY}" READ_WITH_PREFIX ci_cache_ DART_TESTING_TIMEOUT)
if(DEFINED ci_cache_DART_TESTING_TIMEOUT AND NOT "${ci_cache_DART_TESTING_TIMEOUT}" STREQUAL "")
set(CTEST_TEST_TIMEOUT "${ci_cache_DART_TESTING_TIMEOUT}")
endif()
endif()
set(CTEST_BUILD_NAME "${CMAKE_PRESET_NAME}-$ENV{BUILD_BUILDNUMBER}-PR$ENV{SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}")
## The type of build we are going to do "Release | Debug"
#set(CTEST_CONFIGURATION_TYPE Release)
## The type of generator we are going to use "Make | Ninja | NMake | JOM"
set(CTEST_CMAKE_GENERATOR "Ninja")


#==================================================================================================
# Append to the existing CTEST TAG
#==================================================================================================
ctest_start(Experimental "${CTEST_SOURCE_DIR}" "${CTEST_BINARY_DIRECTORY}" APPEND)

#==================================================================================================
# Run the unit tests serially
#==================================================================================================
# In ctest -S mode, capture test failures and report a fatal error to set the process exit code.
# ctest_test writes Test.xml, which the pipeline PublishTestResults task publishes to Azure.
ctest_test(APPEND PARALLEL_LEVEL 1
RETURN_VALUE ctest_test_result CAPTURE_CMAKE_ERROR ctest_cmake_result)
message(STATUS "ctest_test_result: ${ctest_test_result}")
message(STATUS "ctest_cmake_result: ${ctest_cmake_result}")

if(NOT "${ctest_test_result}" STREQUAL "0" OR NOT "${ctest_cmake_result}" STREQUAL "0")
message(FATAL_ERROR "TEST FAILURES: See the failed tests above in this step's log and in the build's Tests tab.
Site: ${CTEST_SITE}
Build Name: ${CTEST_BUILD_NAME}
CMake returned the following error code during testing: ${ctest_cmake_result}
ctest_test() returned the following error code during testing: ${ctest_test_result}")
endif()
Loading