From 04080389a9fc029ddeeabba7023ed7f40f638960 Mon Sep 17 00:00:00 2001 From: Jared Duffey Date: Tue, 13 Oct 2020 14:02:32 -0400 Subject: [PATCH] Changed CI to use CMake to drive checkout of repositories Signed-off-by: Jared Duffey --- .gitignore | 2 ++ .gitmodules | 6 ----- CMakeLists.txt | 64 +++++++++++++++++++++++++++++++++++++++++++++ EMsoft | 1 - EMsoftData | 1 - Repos.cmake | 20 ++++++++++++++ azure-pipelines.yml | 41 +++++++++++++++++++++-------- 7 files changed, 116 insertions(+), 19 deletions(-) delete mode 100644 .gitmodules create mode 100644 CMakeLists.txt delete mode 160000 EMsoft delete mode 160000 EMsoftData create mode 100644 Repos.cmake diff --git a/.gitignore b/.gitignore index 7321e5b..e8089e8 100644 --- a/.gitignore +++ b/.gitignore @@ -135,3 +135,5 @@ IDL/various /src_programs/*.c /src_programs/go* /manuals_todo/Eshelby + +Workspace/ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 0ce5edc..0000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "EMsoft"] - path = EMsoft - url = https://github.com/emsoft-org/EMsoft -[submodule "EMsoftData"] - path = EMsoftData - url = https://github.com/emsoft-org/EMsoftData diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..0b8752e --- /dev/null +++ b/CMakeLists.txt @@ -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() diff --git a/EMsoft b/EMsoft deleted file mode 160000 index cc8e5f7..0000000 --- a/EMsoft +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cc8e5f71425d856a0cc13d9ff92a1618076365a3 diff --git a/EMsoftData b/EMsoftData deleted file mode 160000 index 7549126..0000000 --- a/EMsoftData +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7549126266429e32188969319c3676ca5f9f59c3 diff --git a/Repos.cmake b/Repos.cmake new file mode 100644 index 0000000..1e51e7f --- /dev/null +++ b/Repos.cmake @@ -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") diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 55dc3ae..23be06e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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) @@ -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 @@ -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 @@ -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'