Skip to content

Commit

Permalink
Changed CI to use CMake to drive checkout of repositories
Browse files Browse the repository at this point in the history
Signed-off-by: Jared Duffey <[email protected]>
  • Loading branch information
JDuffeyBQ committed Oct 14, 2020
1 parent 853a810 commit 0408038
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,5 @@ IDL/various
/src_programs/*.c
/src_programs/go*
/manuals_todo/Eshelby

Workspace/
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

64 changes: 64 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
cmake_minimum_required(VERSION 3.14.0)

project(EMSoftCI VERSION 2.0.0.0 LANGUAGES NONE)

include(ExternalProject)

set(EMSOFT_WORKSPACE ${PROJECT_SOURCE_DIR}/Workspace CACHE PATH "Root directory where repos will be cloned")

include(${PROJECT_SOURCE_DIR}/Repos.cmake)

#------------------------------------------------------------------------------
# Function to clone the repository using ExternalProject_Add
#------------------------------------------------------------------------------
function(CloneRepo)
set(options)
set(oneValueArgs NAME ROOT_DIR GIT_REPO GIT_TAG)
set(multiValueArgs)
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

set(CLONE_DIR ${ARGS_ROOT_DIR}/${ARGS_NAME})

message(STATUS "Cloning \"${ARGS_GIT_REPO}\" at tag \"${ARGS_GIT_TAG}\" in \"${CLONE_DIR}\"" )
ExternalProject_Add(${ARGS_NAME}
GIT_REPOSITORY ${ARGS_GIT_REPO}
GIT_TAG ${ARGS_GIT_TAG}
GIT_PROGRESS ON

SOURCE_DIR ${CLONE_DIR}

UPDATE_COMMAND ""
PATCH_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""

TMP_DIR ${PROJECT_BINARY_DIR}/${ARGS_NAME}/temp
STAMP_DIR ${PROJECT_BINARY_DIR}/${ARGS_NAME}/stamp
DOWNLOAD_DIR ${PROJECT_BINARY_DIR}/${ARGS_NAME}/download
BINARY_DIR ${PROJECT_BINARY_DIR}/${ARGS_NAME}/binary
INSTALL_DIR ${PROJECT_BINARY_DIR}/${ARGS_NAME}/install

LOG_DOWNLOAD ON
LOG_UPDATE ON
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_TEST ON
LOG_INSTALL ON
)
endfunction()

if("${EMSOFT_WORKSPACE}" STREQUAL "")
message(FATAL_ERROR "EMSOFT_WORKSPACE is empty. Cloning EMsoft can not continue. \
Please set the -EMSOFT_WORKSPACE=/Path/to/Directory/of/EMsoft to the directory where you want to clone all the DREAM3D \
repositories. Anything in that directory may be over written.")
endif()

foreach(repo ${EMSOFT_REPOS})
CloneRepo(NAME ${repo}
GIT_REPO "${${repo}_BASE_URL}/${${repo}_GH_ORG}/${${repo}_REPO_NAME}.git"
GIT_TAG "${${repo}_GIT_BRANCH}"
ROOT_DIR "${EMSOFT_WORKSPACE}"
)
endforeach()
1 change: 0 additions & 1 deletion EMsoft
Submodule EMsoft deleted from cc8e5f
1 change: 0 additions & 1 deletion EMsoftData
Submodule EMsoftData deleted from 754912
20 changes: 20 additions & 0 deletions Repos.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
set(EMSOFT_REPOS
EMsoft
EMsoftData
)

#--------------------------------------------------------------------------------------------------
# EMsoft Details
#--------------------------------------------------------------------------------------------------
set(EMsoft_REPO_NAME "EMsoft")
set(EMsoft_BASE_URL "https://www.github.com")
set(EMsoft_GH_ORG "EMsoft-org")
set(EMsoft_GIT_BRANCH "develop")

#--------------------------------------------------------------------------------------------------
# EMsoftData Details
#--------------------------------------------------------------------------------------------------
set(EMsoftData_REPO_NAME "EMsoftData")
set(EMsoftData_BASE_URL "https://www.github.com")
set(EMsoftData_GH_ORG "EMsoft-org")
set(EMsoftData_GIT_BRANCH "develop")
41 changes: 30 additions & 11 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ stages:
echo BUILDNAME=$(Agent.OS)-$(Agent.MachineName)-$(Build.SourceBranchName)_$(Build.BuildNumber)
echo Build.BuildNumber=$(Build.BuildNumber)
displayName: 'Dump Azure Variables'
- script: |
cd $(Build.Repository.LocalPath)
cmake -G "Unix Makefiles" -S $(Build.Repository.LocalPath) -B $(Build.Repository.LocalPath)/Build
cmake --build $(Build.Repository.LocalPath)/Build
displayName: 'Clone Repositories'
- script: |
cd $(Build.BinariesDirectory)
cmake -G "Unix Makefiles" -DEMsoft_SDK=$(Agent.WorkFolder) -DEMsoftData_DIR=$(Build.Repository.LocalPath)/EMsoftData -DCMAKE_BUILD_TYPE=Release -DBUILDNAME="$(Agent.MachineName)-$(Agent.OS)-$(Build.SourceBranchName)_$(Build.BuildNumber)" $(Build.Repository.LocalPath)/EMsoft
cmake -G "Unix Makefiles" -DEMsoft_SDK=$(Agent.WorkFolder) -DEMsoftData_DIR=$(Build.Repository.LocalPath)/Workspace/EMsoftData -DCMAKE_BUILD_TYPE=Release -DBUILDNAME="$(Agent.MachineName)-$(Agent.OS)-$(Build.SourceBranchName)_$(Build.BuildNumber)" $(Build.Repository.LocalPath)/Workspace/EMsoft
displayName: 'Configure EMsoft'
- script: |
cd $(Build.BinariesDirectory)
Expand All @@ -45,6 +50,8 @@ stages:
cpack --verbose
displayName: 'Packing EMsoft'
- job: Windows_10_19_03
variables:
cmake_dir: '$(Agent.WorkFolder)\..\cmake-3.16.2-win64-x64'
timeoutInMinutes: 120
workspace:
clean: all
Expand All @@ -67,23 +74,30 @@ stages:
echo BUILDNAME=$(Agent.OS)-$(Agent.MachineName)-$(Build.SourceBranchName)_$(Build.BuildNumber)
echo Build.BuildNumber=$(Build.BuildNumber)
displayName: 'Dump Azure Variables'
- script: |
cd $(Build.Repository.LocalPath)
$(cmake_dir)\bin\cmake.exe -G "NMake Makefiles" -S $(Build.Repository.LocalPath) -B $(Build.Repository.LocalPath)/Build
$(cmake_dir)\bin\cmake.exe --build $(Build.Repository.LocalPath)/Build
displayName: 'Clone Repositories'
- script: |
cd $(Build.BinariesDirectory)
$(Agent.WorkFolder)\..\cmake-3.16.2-win64-x64\bin\cmake.exe -G "NMake Makefiles" -DEMsoft_SDK=$(Agent.WorkFolder) -DEMsoftData_DIR=$(Build.Repository.LocalPath)/EMsoftData -DBUILDNAME="$(Agent.MachineName)-$(Agent.OS)-$(Build.SourceBranchName)_$(Build.BuildNumber)" -DCMAKE_BUILD_TYPE=Release $(Build.Repository.LocalPath)/EMsoft
$(cmake_dir)\bin\cmake.exe -G "NMake Makefiles" -DEMsoft_SDK=$(Agent.WorkFolder) -DEMsoftData_DIR=$(Build.Repository.LocalPath)/Workspace/EMsoftData -DBUILDNAME="$(Agent.MachineName)-$(Agent.OS)-$(Build.SourceBranchName)_$(Build.BuildNumber)" -DCMAKE_BUILD_TYPE=Release $(Build.Repository.LocalPath)/Workspace/EMsoft
displayName: 'Configure EMsoft'
- script: |
cd $(Build.BinariesDirectory)
$(Agent.WorkFolder)\..\cmake-3.16.2-win64-x64\bin\cmake --build . --config Release --target all --parallel 12
$(cmake_dir)\bin\cmake.exe --build . --config Release --target all --parallel 12
displayName: 'Compile EMsoft'
- script: |
cd $(Build.BinariesDirectory)
$(Agent.WorkFolder)\..\cmake-3.16.2-win64-x64\bin\ctest -D Experimental --timeout 7200 -DCTEST_SITE=$(Agent.MachineName).bluequartz.net -Ddashboard_source_name=EMsoft
$(cmake_dir)\bin\ctest.exe -D Experimental --timeout 7200 -DCTEST_SITE=$(Agent.MachineName).bluequartz.net -Ddashboard_source_name=EMsoft
displayName: 'Testing EMsoft'
- script: |
cd $(Build.BinariesDirectory)
$(Agent.WorkFolder)\..\cmake-3.16.2-win64-x64\bin\cpack --verbose
$(cmake_dir)\bin\cpack.exe --verbose
displayName: 'Packing EMsoft'
- job: Linux_Ubuntu_16_04
- job: Linux_Ubuntu_18_04
variables:
cmake_dir: '$(Agent.WorkFolder)/../cmake-3.16.6-Linux-x86_64'
timeoutInMinutes: 120
workspace:
clean: all
Expand All @@ -106,23 +120,28 @@ stages:
echo BUILDNAME=$(Agent.OS)-$(Agent.MachineName)-$(Build.SourceBranchName)_$(Build.BuildNumber)
echo Build.BuildNumber=$(Build.BuildNumber)
displayName: 'Dump Azure Variables'
- script: |
cd $(Build.Repository.LocalPath)
$(cmake_dir)/bin/cmake -S $(Build.Repository.LocalPath) -B $(Build.Repository.LocalPath)/Build
$(cmake_dir)/bin/cmake --build $(Build.Repository.LocalPath)/Build
displayName: 'Clone Repositories'
- script: |
cd $(Build.BinariesDirectory)
export CXX=/usr/bin/g++-7
export CC=/usr/bin/gcc-7
export FC=/usr/bin/gfortran-7
$(Agent.WorkFolder)/../cmake-3.16.2-Linux-x86_64/bin/cmake -G "Unix Makefiles" -DEMsoft_SDK=$(Agent.WorkFolder) -DEMsoftData_DIR=$(Build.Repository.LocalPath)/EMsoftData -DCMAKE_BUILD_TYPE=Release -DBUILDNAME="$(Agent.MachineName)-$(Agent.OS)-$(Build.SourceBranchName)_$(Build.BuildNumber)" $(Build.Repository.LocalPath)/EMsoft
$(cmake_dir)/bin/cmake -G "Unix Makefiles" -DEMsoft_SDK=$(Agent.WorkFolder) -DEMsoftData_DIR=$(Build.Repository.LocalPath)/Workspace/EMsoftData -DCMAKE_BUILD_TYPE=Release -DBUILDNAME="$(Agent.MachineName)-$(Agent.OS)-$(Build.SourceBranchName)_$(Build.BuildNumber)" $(Build.Repository.LocalPath)/Workspace/EMsoft
displayName: 'Configure EMsoft'
- script: |
cd $(Build.BinariesDirectory)
$(Agent.WorkFolder)/../cmake-3.16.2-Linux-x86_64/bin/cmake --build . --config Release --target all --parallel 10
$(cmake_dir)/bin/cmake --build . --config Release --target all --parallel 10
displayName: 'Compile EMsoft'
- script: |
cd $(Build.BinariesDirectory)
export EMSOFTPATHNAME=$(Build.Repository.LocalPath)/EMsoft
$(Agent.WorkFolder)/../cmake-3.16.2-Linux-x86_64/bin/ctest -D Experimental --timeout 7200 -DCTEST_SITE=$(Agent.MachineName).bluequartz.net -Ddashboard_source_name=EMsoft
export EMSOFTPATHNAME=$(Build.Repository.LocalPath)/Workspace/EMsoft
$(cmake_dir)/bin/ctest -D Experimental --timeout 7200 -DCTEST_SITE=$(Agent.MachineName).bluequartz.net -Ddashboard_source_name=EMsoft
displayName: 'Testing EMsoft'
- script: |
cd $(Build.BinariesDirectory)
$(Agent.WorkFolder)/../cmake-3.16.2-Linux-x86_64/bin/cpack --verbose
$(cmake_dir)/bin/cpack --verbose
displayName: 'Packing EMsoft'

0 comments on commit 0408038

Please sign in to comment.