From f2f2f92aa656f3298e64e6ef7a340d0933040453 Mon Sep 17 00:00:00 2001 From: Michael Legleux Date: Fri, 29 Apr 2022 13:33:07 -0700 Subject: [PATCH] changes for external build use XRPLF repos build develop-next branch; self-hosted runner force linux runner --- .github/workflows/build.yml | 40 +++++++++++++++++++-------------- CMake/deps/Postgres.cmake | 3 ++- CMake/install/PostInstall.cmake | 4 ---- CMake/install/clio.service.in | 16 +++++++++++++ CMake/install/install.cmake | 9 +++++--- CMakeLists.txt | 3 +++ 6 files changed, 50 insertions(+), 25 deletions(-) delete mode 100644 CMake/install/PostInstall.cmake create mode 100644 CMake/install/clio.service.in diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d8df6f3c..3a5f970a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,10 +1,10 @@ name: Build Clio on: push: - branches: [master, develop] + branches: [master, develop, develop-next] pull_request: - branches: [master, develop] - + branches: [master, develop, develop-next] + jobs: lint: name: Lint @@ -12,30 +12,36 @@ jobs: steps: - name: Get source uses: actions/checkout@v3 - + - name: Run clang-format - uses: XRPLF/clio-build/lint@main - - build_clio: + uses: XRPLF/clio-gha/lint@main + + build_clio: name: Build - runs-on: ubuntu-20.04 + runs-on: [self-hosted, Linux] needs: lint steps: - - name: Get clio repo + - name: Get Clio repo uses: actions/checkout@v3 with: path: clio_src - - - name: Get gha repo + ref: 'develop-next' + + - name: Get Clio CI repo uses: actions/checkout@v3 with: - repository: XRPLF/clio-build - ref: main - path: gha # must be the same as defined in XRPLF/clio-build - + path: clio_ci + repository: 'XRPLF/clio-ci' + + - name: Get GitHub actions repo + uses: actions/checkout@v3 + with: + repository: XRPLF/clio-gha + path: gha # must be the same as defined in XRPLF/clio-gha + - name: Build - uses: XRPLF/clio-build/build@main - + uses: XRPLF/clio-gha/build@main + # - name: Artifact clio_tests # uses: actions/upload-artifact@v2 # with: diff --git a/CMake/deps/Postgres.cmake b/CMake/deps/Postgres.cmake index e21bc5fc..c37f9934 100644 --- a/CMake/deps/Postgres.cmake +++ b/CMake/deps/Postgres.cmake @@ -16,6 +16,7 @@ ExternalProject_Add(postgres ${POSTGRES_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}pgcommon${CMAKE_STATIC_LIBRARY_SUFFIX}} ${POSTGRES_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}pgport${CMAKE_STATIC_LIBRARY_SUFFIX}} ) +ExternalProject_Get_Property (postgres BINARY_DIR) foreach(_lib ${POSTGRES_LIBS}) add_library(${_lib} STATIC IMPORTED GLOBAL) @@ -26,5 +27,5 @@ foreach(_lib ${POSTGRES_LIBS}) INTERFACE_INCLUDE_DIRECTORIES ${POSTGRES_INSTALL_DIR}/include) target_link_libraries(clio PUBLIC ${POSTGRES_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${_lib}${CMAKE_STATIC_LIBRARY_SUFFIX}) endforeach() - +add_dependencies(clio postgres) target_include_directories(clio PUBLIC ${POSTGRES_INSTALL_DIR}/include) diff --git a/CMake/install/PostInstall.cmake b/CMake/install/PostInstall.cmake deleted file mode 100644 index 1b7191b1..00000000 --- a/CMake/install/PostInstall.cmake +++ /dev/null @@ -1,4 +0,0 @@ -execute_process( - COMMAND ln -s ${CMAKE_INSTALL_PREFIX}/${CLIO_INSTALL_DIR}/bin/clio_server /usr/local/bin/clio_server - COMMAND_ECHO STDOUT - ) \ No newline at end of file diff --git a/CMake/install/clio.service.in b/CMake/install/clio.service.in new file mode 100644 index 00000000..4d825d08 --- /dev/null +++ b/CMake/install/clio.service.in @@ -0,0 +1,16 @@ +[Unit] +Description=Clio XRPL API server +Documentation=https://github.com/XRPLF/clio.git + +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +ExecStart=@CLIO_INSTALL_DIR@/bin/clio_server @CLIO_INSTALL_DIR@/etc/config.json +Restart=on-failure +User=clio +Group=clio + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/CMake/install/install.cmake b/CMake/install/install.cmake index a1ee4b82..0caeeb25 100644 --- a/CMake/install/install.cmake +++ b/CMake/install/install.cmake @@ -1,7 +1,10 @@ -set(CLIO_INSTALL_DIR /opt/clio) +set(CLIO_INSTALL_DIR "/opt/clio") set(CMAKE_INSTALL_PREFIX ${CLIO_INSTALL_DIR}) install(TARGETS clio_server DESTINATION bin) # install(TARGETS clio_tests DESTINATION bin) # NOTE: Do we want to install the tests? -install(FILES example-config.json DESTINATION etc/clio) -install(SCRIPT "${CMAKE_SOURCE_DIR}/CMake/install/PostInstall.cmake") +install(FILES example-config.json DESTINATION etc RENAME config.json) + +configure_file("${CMAKE_SOURCE_DIR}/CMake/install/clio.service.in" "${CMAKE_BINARY_DIR}/clio.service") + +install(FILES "${CMAKE_BINARY_DIR}/clio.service" DESTINATION /lib/systemd/system) \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 687fd1dd..e9d2f2fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,3 +81,6 @@ if(BUILD_TESTS) endif() include(CMake/install/install.cmake) +if(PACKAGING) + include(CMake/packaging.cmake) +endif()