This is an automated email from the ASF dual-hosted git repository.
jdanek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-cpp.git
The following commit(s) were added to refs/heads/main by this push:
new da9e2200f QPID-8610: add GitHub Actions workflow to build project and
run ctest (#34)
da9e2200f is described below
commit da9e2200f0e6b0e7e04ed41a015051341b3502f8
Author: Jiri Daněk <[email protected]>
AuthorDate: Sat Apr 8 11:22:16 2023 +0200
QPID-8610: add GitHub Actions workflow to build project and run ctest (#34)
Github Actions don't run on the PR, so I am monitoring it on my fork,
https://github.com/jiridanek/qpid-cpp/actions/runs/4644235028
Using Focal (`runs-on: ubuntu-20.04`) for now, as it has the old
requirements we need. Travis used to run Xenial, that worked even better,
without workarounds for swig and ruby.
Python 2.7 is required
([QPID-8516](https://issues.apache.org/jira/browse/QPID-8516),
[QPID-4982](https://issues.apache.org/jira/browse/QPID-4982),
[QPID-8517](https://issues.apache.org/jira/browse/QPID-8517))
Linux environment requires swig3.0 and ruby2.6 to compile and work
([QPID-8606](https://issues.apache.org/jira/browse/QPID-8606),
https://github.com/swig/swig/issues/1689)
The vcpkg version of Boost requires some changes to how dependencies are
linked. What's in the PR now works on both Appveyor and Github Actions.
Caching is very important. Both installing boost with vcpkg on Windows and
compiling the broker code takes a lot of time without cache. With cache, vcpkg
is nearly instantaneous and broker compile takes only a few minutes on Linux,
and few more on Windows. When using sccache, make or ninja CMake generators
have to be used. MSBuild is not supported for `-DCMAKE_C_COMPILER_LAUNCHER`
CMake option. This can be workarounded in the future by the usual trick of
renaming `sccache.exe` to `cl.exe`.
Tests run very long. I am afraid to run them in parallel as part of this
PR. I want to leave that for later. But it is going to be necessary, because
the CI just takes way too much time otherwise.
Broker tests don't run on Windows and AFAIK they did not run there for a
very long time.
---
.github/workflows/build.yml | 180 +++++++++++++++++++++++++++++++++++
CMakeLists.txt | 8 +-
src/CMakeLists.txt | 22 ++---
src/qpid/store/CMakeLists.txt | 6 +-
src/tests/CMakeLists.txt | 2 +-
src/tests/legacystore/CMakeLists.txt | 2 +-
6 files changed, 197 insertions(+), 23 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 000000000..adc80f68d
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,180 @@
+name: Build
+
+on: [ push, pull_request, workflow_dispatch ]
+
+jobs:
+ build:
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ ubuntu-20.04, windows-latest ]
+ buildType: [ RelWithDebInfo ]
+ include:
+ - os: ubuntu-20.04
+ # QPID-8606: we don't support swig 4.0, it produces runtime errors
when used
+ cmake_extra: '-DSWIG_EXECUTABLE="/usr/bin/swig3.0"
-DRUBY_EXECUTABLE="/usr/bin/ruby2.6"'
+ - os: windows-latest
+ cmake_extra: '-DBUILD_BINDING_DOTNET=OFF
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake'
+ env:
+ BuildType: ${{matrix.buildType}}
+ BuildDir: ${{github.workspace}}/BLD
+ InstallPrefix: ${{github.workspace}}/INSTALL
+ PKG_CONFIG_PATH: ${{matrix.pkg_config_path}}
+ VCPKG_DEFAULT_TRIPLET: x64-windows
+ VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
+ SCCACHE_DIR: ${{github.workspace}}/SCCACHE
+
+ steps:
+
+ - uses: actions/checkout@v3
+
+ - name: Setup python
+ uses: actions/setup-python@v4
+ with:
+ python-version: 2.7
+ architecture: x64
+
+ - name: Setup Developer Command Prompt (on Windows)
+ uses: ilammy/msvc-dev-cmd@v1
+ if: runner.os == 'Windows'
+ with:
+ arch: x64
+
+ # it's weird that it needs qpid-python for tests; one would guess this
is built in this repo, but it is not
+ - name: Install python dependencies
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install setuptools qpid-python
+
+ - name: Install Linux dependencies
+ if: runner.os == 'Linux'
+ run: |
+ # ubuntu packages
(https://packages.ubuntu.com/source/focal/qpid-proton) don't carry
ProtonConfig.cmake
+ # the `testing` ppa is less likely to be out-of-date
+ sudo add-apt-repository ppa:qpid/testing && sudo apt-get update
+
+ # https://github.com/swig/swig/issues/1689
+ # swig3.0 in focal does not work well with ruby2.7
+ sudo apt-add-repository ppa:brightbox/ruby-ng && sudo apt-get update
+
+ sudo apt-get -yq --no-install-suggests --no-install-recommends
install \
+ cmake ninja-build \
+ libboost-dev libboost-program-options-dev libboost-system-dev
libboost-test-dev \
+ libxqilla-dev libxerces-c-dev \
+ libibverbs-dev librdmacm-dev \
+ libdb++-dev libaio-dev \
+ libqpid-proton11-dev libqpid-proton-core10
libqpid-proton-proactor1 \
+ swig3.0 python-dev ruby2.6 ruby2.6-dev \
+ uuid-dev libnss3-dev libnss3-tools libsasl2-dev sasl2-bin \
+ valgrind
+
+ sccache_version=v0.4.1
+ wget -q
https://github.com/mozilla/sccache/releases/download/${sccache_version}/sccache-${sccache_version}-x86_64-unknown-linux-musl.tar.gz
+ tar -xf sccache-${sccache_version}-x86_64-unknown-linux-musl.tar.gz
sccache-${sccache_version}-x86_64-unknown-linux-musl/sccache
+ sudo mv sccache-${sccache_version}-x86_64-unknown-linux-musl/sccache
/usr/bin/sccache
+ sudo chmod +x /usr/bin/sccache
+ shell: bash
+
+ - name: Cache scoop (on Windows)
+ uses: actions/cache@v3
+ if: runner.os == 'Windows'
+ with:
+ path: ~\scoop
+ key: ${{ runner.os }}-scoop-${{ env.OS_VER }}-${{
hashFiles('.github/workflows/build.yml') }}
+ restore-keys: |
+ ${{ runner.os }}-scoop-${{ env.OS_VER }}-
+ ${{ runner.os }}-scoop-
+
+ - name: Cache vcpkg/downloads (on Windows)
+ uses: actions/cache@v3
+ if: runner.os == 'Windows'
+ with:
+ path: C:\vcpkg\downloads
+ key: ${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}-${{
hashFiles('.github/workflows/build.yml') }}
+ restore-keys: |
+ ${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}-
+ ${{ runner.os }}-vcpkg-download-
+ - name: Cache vcpkg/installed (on Windows)
+ uses: actions/cache@v3
+ if: runner.os == 'Windows'
+ with:
+ path: C:\vcpkg\installed
+ key: ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}-${{
hashFiles('.github/workflows/build.yml') }}
+ restore-keys: |
+ ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}-
+ ${{ runner.os }}-vcpkg-installed-
+
+ - name: Cache SCCACHE_DIR
+ uses: actions/cache@v3
+ with:
+ path: "${{ env.SCCACHE_DIR }}"
+ key: ${{ runner.os }}-sccache-${{ matrix.os }}-${{ github.sha }}
+ restore-keys: |
+ ${{ runner.os }}-sccache-${{ matrix.os }}-
+ ${{ runner.os }}-sccache-
+
+ - name: Install Windows dependencies
+ if: runner.os == 'Windows'
+ run: |
+ Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Optional:
Needed to run a remote script the first time
+ iex "& {$(irm get.scoop.sh)} -RunAsAdmin"
+ scoop install sccache
+
+ vcpkg install boost-program-options boost-system boost-test
boost-date-time boost-thread boost-chrono boost-format boost-ptr-container
boost-assign boost-parameter boost-foreach boost-utility
+ vcpkg integrate install
+
+ #
https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#add-a-system-path-add-path
+ Add-Content ${env:GITHUB_PATH} "${HOME}/scoop/shims"
+
+ # work around assumptions in our build scripts about boost libs
layout
+ Copy-Item -Path C:/vcpkg/installed/x64-windows/debug/bin/* -Include
*.dll -Destination C:/vcpkg/installed/x64-windows/debug/lib
+ Get-Item C:/vcpkg/installed/x64-windows/debug/lib/*.dll |
Rename-Item -NewName { $_.Name -replace
'-vc14.-mt-gd-x64-1_81.dll','-vc140-mt-gd.dll' }
+ # display results of this hard work
+ ls C:/vcpkg/installed/x64-windows/debug/bin/
+ ls C:/vcpkg/installed/x64-windows/debug/lib/
+ # now do the same for release
+ Copy-Item -Path C:/vcpkg/installed/x64-windows/bin/* -Include *.dll
-Destination C:/vcpkg/installed/x64-windows/lib
+ Get-Item C:/vcpkg/installed/x64-windows/lib/*.dll | Rename-Item
-NewName { $_.Name -replace '-vc14.-mt-x64-1_81.dll','-vc140-mt.dll' }
+ # display results of this hard work
+ ls C:/vcpkg/installed/x64-windows/bin/
+ ls C:/vcpkg/installed/x64-windows/lib/
+ shell: pwsh
+
+ # Windows build should ideally use something like '-G "Visual Studio 16
2019" -A x64',
+ # but -DCMAKE_C_COMPILER_LAUNCHER is only supported by make and ninja
generators
+ #
https://devblogs.microsoft.com/scripting/powertip-line-continuation-in-powershell/
+ - name: cmake configure
+ run: |
+ cmake -S "${{github.workspace}}" -B "${{env.BuildDir}}" -G Ninja `
+ -DCMAKE_C_COMPILER_LAUNCHER="sccache"
-DCMAKE_CXX_COMPILER_LAUNCHER="sccache" `
+ "-DCMAKE_BUILD_TYPE=${{env.BuildType}}" `
+ "-DCMAKE_INSTALL_PREFIX=${{env.InstallPrefix}}" `
+ ${{matrix.cmake_extra}}
+ shell: pwsh
+
+ # https://stackoverflow.com/a/46187862/1047788
+ #
https://github.com/jiridanek/qpid-cpp/actions/runs/3314156604/jobs/5473066487#step:12:1472
+ - name: cmake build/install
+ run: |
+ cmake --build "${{env.BuildDir}}" --config ${{env.BuildType}} -- -v
+ cmake --install "${{env.BuildDir}}" --config ${{env.BuildType}}
+ shell: pwsh
+
+ - id: ctest
+ name: ctest
+ working-directory: ${{env.BuildDir}}
+ run: PYTHONPATH=${InstallPrefix}/lib/python2.7/site-packages ctest -C
${BuildType} -V -T Test --no-compress-output ${{matrix.ctest_extra}}
+ shell: bash
+
+ - name: Upload Test results
+ if: always() && (steps.ctest.outcome == 'failure' ||
steps.ctest.outcome == 'success')
+ uses: actions/upload-artifact@v3
+ with:
+ name: Test_Results_${{matrix.os}}_${{matrix.buildType}}
+ path: ${{env.BuildDir}}/Testing/**/*.xml
+
+ - name: Environment
+ if: always()
+ run: env -0 | sort -z | tr '\0' '\n'
+ shell: bash
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5d1d5b233..6191a5599 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,12 +69,12 @@ include (CTest)
configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake
${CMAKE_BINARY_DIR}/CTestCustom.cmake)
if (MSVC)
- # Chaxnge warning C4996 from level 1 to level 4. These are real and shouldn't
+ # Change warning C4996 from level 1 to level 4. These are real and shouldn't
# be completely ignored, but they're pretty well checked out and will throw
# a run-time error if violated.
- # "warning C4996: 'std::equal': Function call with parameters that may
- # be unsafe..."
- add_definitions(/w44996)
+ # "warning C4996: 'std::equal': Function call with parameters that may be
unsafe..."
+ #
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996?view=msvc-140
+ add_compile_options(/wd4996)
endif (MSVC)
# Overall packaging/install options.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fe6309010..4c7a8ac61 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -230,8 +230,7 @@ endif (BUILD_TESTING)
# DLLs that are needed for the Windows package, none are needed for the
# static link case; else drop them into the install. Do this all first, since
# Boost on Windows can use automatic linking to pick up the correct
-# Boost libs based on compile-time touching of the headers. Since we don't
-# really need to add them to the link lines, set the names to blanks.
+# Boost libs based on compile-time touching of the headers.
option(QPID_LINK_BOOST_DYNAMIC "Link with dynamic Boost libs (OFF to link
static)" ON)
mark_as_advanced(QPID_LINK_BOOST_DYNAMIC)
@@ -272,12 +271,6 @@ if (MSVC)
COMPONENT ${QPID_COMPONENT_COMMON})
endif (QPID_LINK_BOOST_DYNAMIC)
- set(Boost_DATE_TIME_LIBRARY "")
- set(Boost_THREAD_LIBRARY "")
- set(Boost_PROGRAM_OPTIONS_LIBRARY "")
- set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY "")
- set(Boost_SYSTEM_LIBRARY "")
- set(Boost_CHRONO_LIBRARY "")
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/windows/resources )
endif (MSVC)
@@ -577,7 +570,8 @@ if (BUILD_HA)
target_link_libraries (ha
PRIVATE
qpidtypes qpidcommon qpidbroker qpidmessaging
- ${Boost_PROGRAM_OPTIONS_LIBRARY})
+ ${Boost_PROGRAM_OPTIONS_LIBRARY}
+ ${Boost_THREAD_LIBRARY})
set_target_properties (ha PROPERTIES
PREFIX "")
install (TARGETS ha
@@ -937,7 +931,8 @@ add_msvc_version (qpidclient library dll)
add_library (qpidclient SHARED ${qpidclient_SOURCES})
target_link_libraries (qpidclient PRIVATE qpidcommon qpidtypes
- ${ssl_LIBS})
+ ${ssl_LIBS}
+ ${Boost_THREAD_LIBRARY})
set_target_properties (qpidclient PROPERTIES
VERSION ${qpidclient_version}
@@ -1004,7 +999,7 @@ set (qpidmessaging_SOURCES
add_msvc_version (qpidmessaging library dll)
add_library (qpidmessaging SHARED ${qpidmessaging_SOURCES})
-target_link_libraries (qpidmessaging PRIVATE qpidtypes qpidclient qpidcommon
${Proton_Core_LIBRARIES})
+target_link_libraries (qpidmessaging PRIVATE qpidtypes qpidclient qpidcommon
${Proton_Core_LIBRARIES} ${Boost_THREAD_LIBRARY})
set_target_properties (qpidmessaging PROPERTIES
LINK_FLAGS "${HIDE_SYMBOL_FLAGS}
${LINK_VERSION_SCRIPT_FLAG}"
COMPILE_FLAGS "${HIDE_SYMBOL_FLAGS}"
@@ -1141,7 +1136,8 @@ target_link_libraries (qpidbroker
PRIVATE
qpidcommon qpidtypes
"${sasl_LIB}"
- ${ssl_server_LIBS})
+ ${ssl_server_LIBS}
+ ${Boost_THREAD_LIBRARY})
set_target_properties (qpidbroker PROPERTIES
VERSION ${qpidbroker_version}
@@ -1256,7 +1252,7 @@ endif (NOT WIN32)
add_msvc_version (qmf2 library dll)
add_library (qmf2 SHARED ${qmf2_SOURCES})
- target_link_libraries (qmf2 PRIVATE qpidmessaging qpidtypes qpidclient
qpidcommon)
+ target_link_libraries (qmf2 PRIVATE qpidmessaging qpidtypes qpidclient
qpidcommon ${Boost_THREAD_LIBRARY})
set_target_properties (qmf2 PROPERTIES
VERSION ${qmf2_version}
SOVERSION ${qmf2_version_major})
diff --git a/src/qpid/store/CMakeLists.txt b/src/qpid/store/CMakeLists.txt
index ec1fa16e7..63b2cfdb6 100644
--- a/src/qpid/store/CMakeLists.txt
+++ b/src/qpid/store/CMakeLists.txt
@@ -21,8 +21,6 @@ project(qpidc_store)
#set (CMAKE_VERBOSE_MAKEFILE ON) # for debugging
-include_directories( ${Boost_INCLUDE_DIR} )
-
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
include_directories( ${CMAKE_HOME_DIRECTORY}/include )
@@ -80,7 +78,7 @@ if (BUILD_MSSQL)
ms-sql/State.cpp
ms-sql/TplRecordset.cpp
ms-sql/VariantHelper.cpp)
- target_link_libraries (mssql_store qpidbroker qpidcommon)
+ target_link_libraries (mssql_store qpidbroker qpidcommon
${Boost_THREAD_LIBRARY})
install (TARGETS mssql_store # RUNTIME
DESTINATION ${QPIDD_MODULE_DIR}
COMPONENT ${QPID_COMPONENT_BROKER})
@@ -109,7 +107,7 @@ if (BUILD_MSCLFS)
ms-sql/State.cpp
ms-sql/VariantHelper.cpp)
include_directories(ms-sql)
- target_link_libraries (msclfs_store qpidbroker qpidcommon clfsw32.lib)
+ target_link_libraries (msclfs_store qpidbroker qpidcommon clfsw32.lib
${Boost_THREAD_LIBRARY})
install (TARGETS msclfs_store # RUNTIME
DESTINATION ${QPIDD_MODULE_DIR}
COMPONENT ${QPID_COMPONENT_BROKER})
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index 693e8dea8..7362a0c96 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -161,7 +161,7 @@ if (BUILD_TESTING_UNITTESTS)
# Like this to work with cmake 2.4 on Unix
set(qpid_test_boost_libs
- ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY})
+ ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY})
set(all_unit_tests
AccumulatedAckTest
diff --git a/src/tests/legacystore/CMakeLists.txt
b/src/tests/legacystore/CMakeLists.txt
index 3427caf7a..5319c6d85 100644
--- a/src/tests/legacystore/CMakeLists.txt
+++ b/src/tests/legacystore/CMakeLists.txt
@@ -32,7 +32,7 @@ if (BUILD_TESTING_UNITTESTS)
# Like this to work with cmake 2.4 on Unix
set (qpid_test_boost_libs
- ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY})
+ ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY})
# Journal tests
MACRO (define_journal_test mainSourceFile)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]