diff --git a/.github/workflows/daggy-github-actions.yaml b/.github/workflows/daggy-github-actions.yaml index 5c4acef1..310a0249 100644 --- a/.github/workflows/daggy-github-actions.yaml +++ b/.github/workflows/daggy-github-actions.yaml @@ -3,11 +3,19 @@ on: push: tags: - v* + branches: + - release/* pull_request: jobs: linux-gcc12_x64: runs-on: ubuntu-22.04 + permissions: + id-token: write + contents: read + checks: write + attestations: write + steps: - uses: actions/checkout@v4 with: @@ -68,14 +76,14 @@ jobs: shell: bash - name: Cache conan packages - uses: actions/cache@v3 + uses: actions/cache@v4 id: conan-data-gcc12 with: path: ~/.conan2/p key: conan-data-gcc12 - name: Set up Python 3.11 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.11' cache: pip @@ -102,6 +110,12 @@ jobs: - name: Tests working-directory: build/Release run: ctest -C Release --output-on-failure --output-junit tests/local_tests.xml + + - name: Attest + uses: actions/attest-build-provenance@v1 + if: github.ref_type == 'tag' || startsWith(github.ref, 'refs/heads/release/') + with: + subject-path: 'build/Release/bin/**, build/Release/lib/**' - name: linux-gcc12_x64 Tests Report uses: mikepenz/action-junit-report@v4 @@ -114,7 +128,7 @@ jobs: run: cpack - name: Archive production artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: daggy_linux_x64 path: | @@ -123,14 +137,19 @@ jobs: build/Release/*.zip win: - runs-on: windows-latest + runs-on: windows-2022 + permissions: + id-token: write + contents: read + checks: write + attestations: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Cache conan packages - uses: actions/cache@v3 + uses: actions/cache@v4 id: conan-data-msvc with: path: | @@ -139,7 +158,7 @@ jobs: key: conan-data-msvc - name: Set up Python 3.11 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.11' cache: pip @@ -171,6 +190,12 @@ jobs: working-directory: build run: ctest -C Release --output-on-failure --output-junit tests/local_tests.xml + - name: Attest + uses: actions/attest-build-provenance@v1 + if: github.ref_type == 'tag' || startsWith(github.ref, 'refs/heads/release/') + with: + subject-path: build/bin/* + - name: win-msvc193_x64 Tests Report uses: mikepenz/action-junit-report@v4 with: @@ -182,28 +207,105 @@ jobs: run: cpack - name: Archive production artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: daggy_win_x64 path: | build/*.zip - macos: - runs-on: macos-latest + macos-arm: + runs-on: macos-14 + permissions: + id-token: write + contents: read + checks: write + attestations: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Cache conan packages + uses: actions/cache@v4 + id: conan-data-clang-arm64 + with: + path: ~/.conan2/p + key: conan-data-clang-arm64 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: '3.11' + cache: pip + + - run: pip install -r requirements.txt + - run: conan --version + - run: conan profile detect + + - name: Conan config + run: conan config install CI/conan + + - name: Conan install + run: conan install . --build=missing -s compiler.cppstd=17 -of . + + - name: Conan remove build folders + run: conan cache clean "*" --source --build --temp --download + + - name: Conan build + run: conan build . --build=missing -s compiler.cppstd=17 -of . + + - name: daggy version + working-directory: build/Release + run: bin/daggy --version + + - name: Tests + working-directory: build/Release + run: ctest -C Release --output-on-failure --output-junit tests/local_tests.xml + + - name: Attest + uses: actions/attest-build-provenance@v1 + if: github.ref_type == 'tag' || startsWith(github.ref, 'refs/heads/release/') + with: + subject-path: 'build/Release/bin/**, build/Release/lib/**' + + - name: macos-arm64 Tests Report + uses: mikepenz/action-junit-report@v4 + with: + report_paths: build/Release/tests/local_tests.xml + summary: macos-arm64 Tests Report + + - name: Packaging + working-directory: build/Release + run: cpack + + - name: Archive production artifacts + uses: actions/upload-artifact@v4 + with: + name: daggy_macos_arm64 + path: + build/Release/*.zip + + macos-x64: + runs-on: macos-13 + permissions: + id-token: write + contents: read + checks: write + attestations: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Cache conan packages - uses: actions/cache@v3 - id: conan-data-clang + uses: actions/cache@v4 + id: conan-data-clang-x64 with: path: ~/.conan2/p - key: conan-data-clang + key: conan-data-clang-x64 - name: Set up Python 3.11 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.11' cache: pip @@ -232,18 +334,24 @@ jobs: working-directory: build/Release run: ctest -C Release --output-on-failure --output-junit tests/local_tests.xml - - name: macos-clang13_x64 Tests Report + - name: Attest + uses: actions/attest-build-provenance@v1 + if: github.ref_type == 'tag' || startsWith(github.ref, 'refs/heads/release/') + with: + subject-path: 'build/Release/bin/**, build/Release/lib/**' + + - name: macos-x64 Tests Report uses: mikepenz/action-junit-report@v4 with: report_paths: build/Release/tests/local_tests.xml - summary: macos-clang13_x64 Tests Report + summary: macos-x64 Tests Report - name: Packaging working-directory: build/Release run: cpack - name: Archive production artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: daggy_macos_x64 path: diff --git a/conanfile.py b/conanfile.py index 19180cf0..b9665de2 100644 --- a/conanfile.py +++ b/conanfile.py @@ -77,7 +77,6 @@ def requirements(self): self.requires("kainjow-mustache/4.1") self.requires("yaml-cpp/0.8.0") self.requires("libssh2/1.11.0") - self.requires("pcapplusplus/23.09") def layout(self): @@ -109,7 +108,7 @@ def generate(self): tc.cache_variables["SSH2_SUPPORT"] = True tc.cache_variables["YAML_SUPPORT"] = True tc.cache_variables["CONSOLE"] = True - tc.cache_variables["PCAPNG_SUPPORT"] = True + tc.cache_variables["PCAPNG_SUPPORT"] = False tc.cache_variables["PACKAGE_DEPS"] = True tc.cache_variables["BUILD_TESTING"] = True tc.cache_variables["CONAN_BUILD"] = True diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bc611145..81e0e837 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,7 +16,7 @@ set(CMAKE_BINARY_EXPORTS_DIR ${CMAKE_BINARY_DIR}/exports/) include_directories(${CMAKE_BINARY_EXPORTS_DIR}) set(PROJECT_VENDOR synacker) -set(PROJECT_COPYRIGTH "Copyright \\251 2023 Mikhail Milovidov. Some Rights Reserved") +set(PROJECT_COPYRIGTH "Copyright \\251 2024 Mikhail Milovidov. Some Rights Reserved") option(SSH2_SUPPORT "ssh2 data provider support" ON) option(YAML_SUPPORT "yaml data sources support" ON) diff --git a/src/Daggy/CConsoleDaggy.cpp b/src/Daggy/CConsoleDaggy.cpp index 65323974..cb56d838 100644 --- a/src/Daggy/CConsoleDaggy.cpp +++ b/src/Daggy/CConsoleDaggy.cpp @@ -41,7 +41,7 @@ CConsoleDaggy::CConsoleDaggy(QObject* parent) { qApp->setApplicationName("daggy"); qApp->setOrganizationName(DAGGY_VENDOR); - qApp->setApplicationVersion(DAGGY_VERSION_STANDARD); + qApp->setApplicationVersion(DAGGY_VERSION); qApp->setOrganizationDomain("https://github.com/synacker/daggy"); connect(this, &CConsoleDaggy::interrupt, this, &CConsoleDaggy::stop, Qt::QueuedConnection); diff --git a/src/Daggy/CMakeLists.txt b/src/Daggy/CMakeLists.txt index dff88f52..c5087487 100644 --- a/src/Daggy/CMakeLists.txt +++ b/src/Daggy/CMakeLists.txt @@ -1,6 +1,6 @@ set(TARGET daggy) -option(PCAPNG_SUPPORT "pcap to pcapng convertor" ON) +option(PCAPNG_SUPPORT "pcap to pcapng convertor" OFF) find_package(Qt6 COMPONENTS Core REQUIRED) @@ -50,3 +50,4 @@ target_link_libraries(${TARGET} PRIVATE ${LINK_LIBRARIES}) target_precompile_headers(${TARGET} PRIVATE Precompiled.hpp) install(TARGETS ${TARGET} RUNTIME) +include(package_deps) diff --git a/src/DaggyCore/CMakeLists.txt b/src/DaggyCore/CMakeLists.txt index bd02ae24..24110238 100644 --- a/src/DaggyCore/CMakeLists.txt +++ b/src/DaggyCore/CMakeLists.txt @@ -2,7 +2,6 @@ set(TARGET DaggyCore) find_package(Qt6 COMPONENTS Core Network REQUIRED) add_library(${TARGET}) - include(rpath_lib) set_target_properties(${TARGET} PROPERTIES AUTOMOC ON) @@ -115,3 +114,4 @@ else() endif() install(TARGETS ${TARGET} FILE_SET HEADERS) +include(package_deps) diff --git a/src/DaggyCore/tests/local/CMakeLists.txt b/src/DaggyCore/tests/local/CMakeLists.txt index 3863e34b..6a744aca 100644 --- a/src/DaggyCore/tests/local/CMakeLists.txt +++ b/src/DaggyCore/tests/local/CMakeLists.txt @@ -12,8 +12,6 @@ set(SOURCES main.cpp ) - - qt6_add_executable(${TARGET} ${SOURCES}) include(rpath_bin) add_test(NAME ${TARGET} COMMAND ${TARGET} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) diff --git a/src/cmake/compiler.cmake b/src/cmake/compiler.cmake index f6b4f2d5..ef6a1ab3 100644 --- a/src/cmake/compiler.cmake +++ b/src/cmake/compiler.cmake @@ -17,8 +17,12 @@ else() set(POSITION_INDEPENDENT_CODE OFF) endif() -make_directory(${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) -make_directory(${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) + + +make_directory(${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) +make_directory(${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) @@ -40,4 +44,3 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) - diff --git a/src/cmake/package_deps.cmake b/src/cmake/package_deps.cmake index a630087d..2022cd7e 100644 --- a/src/cmake/package_deps.cmake +++ b/src/cmake/package_deps.cmake @@ -1,41 +1,17 @@ -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) -if(UNIX AND NOT APPLE) - install(DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/daggy/ - DESTINATION ${CMAKE_INSTALL_LIBDIR}/daggy/ - FILES_MATCHING - PATTERN libQt6Network.so* - PATTERN libQt6Core.so* - PATTERN libssh2.so* - PATTERN libyaml-cpp.so* - PATTERN libcrypto*.so* +if (PACKAGE_DEPS) + install(TARGETS ${TARGET} + RUNTIME_DEPENDENCY_SET ${TARGET}_deps ) -elseif(APPLE) - install(DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/daggy/ - DESTINATION ${CMAKE_INSTALL_LIBDIR}/daggy/ - FILES_MATCHING - PATTERN libQt6Network*dylib - PATTERN libQt6Core*dylib - PATTERN libssh2*dylib - PATTERN libyaml-cpp*dylib - PATTERN libcrypto*dylib + + install(RUNTIME_DEPENDENCY_SET ${TARGET}_deps + PRE_EXCLUDE_REGEXES + [=[api-ms-]=] + [=[ext-ms-]=] + [[kernel32\.dll]] + [[libc\.so\..*]] [[libgcc_s\.so\..*]] [[libm\.so\..*]] [[libstdc\+\+\.so\..*]] + POST_EXCLUDE_REGEXES + [=[.*system32\/.*\.dll]=] + [=[^\/(lib|usr\/lib|usr\/local\/lib\/lib64)]=] + DIRECTORIES ${CONAN_RUNTIME_LIB_DIRS} ${CONAN_LIB_DIRS} ) -else() - set(VC_REDIST ${CMAKE_BINARY_DIR}/vc_redist-x64.exe) - if(NOT EXISTS ${VC_REDIST}) - execute_process(COMMAND powershell wget -UseBasicParsing -OutFile ${VC_REDIST} 'https://aka.ms/vs/16/release/vc_redist.x64.exe') - endif() - install(FILES ${VC_REDIST} - DESTINATION vcredist) - install(DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - DESTINATION . - FILES_MATCHING - PATTERN Qt6Network.dll - PATTERN Qt6Core.dll - PATTERN libssh2.dll - PATTERN yaml-cpp.dll - PATTERN libcrypto-1_1-x64.dll) - install(FILES - ${CMAKE_CURRENT_LIST_DIR}/daggyenv.bat - DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/src/cmake/rpath_bin.cmake b/src/cmake/rpath_bin.cmake index 598c2dde..8e5f1e55 100644 --- a/src/cmake/rpath_bin.cmake +++ b/src/cmake/rpath_bin.cmake @@ -1,7 +1,7 @@ if(CONAN_BUILD) if(APPLE) - set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH "@executable_path/../${CMAKE_INSTALL_LIBDIR};@executable_path/../${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}") + set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH "@executable_path/../${CMAKE_INSTALL_LIBDIR}") elseif(UNIX) - set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}") + set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}") endif() endif() diff --git a/src/cmake/rpath_lib.cmake b/src/cmake/rpath_lib.cmake index 0a04943e..97a1b082 100644 --- a/src/cmake/rpath_lib.cmake +++ b/src/cmake/rpath_lib.cmake @@ -1,7 +1,7 @@ if(CONAN_BUILD) if(APPLE) - set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH "@loader_path/${PROJECT_NAME}") + set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH "@loader_path") elseif(UNIX) - set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH "$ORIGIN/${PROJECT_NAME}") + set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH "$ORIGIN") endif() endif()