From 231cdcd878e24b78abb76243361208b745c500f9 Mon Sep 17 00:00:00 2001 From: s4016080-ps1nov Date: Mon, 12 Aug 2024 17:28:14 +1000 Subject: [PATCH 1/5] fix language --- include/mcpp/connection.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/mcpp/connection.h b/include/mcpp/connection.h index d332b4f2..27bbd9d2 100644 --- a/include/mcpp/connection.h +++ b/include/mcpp/connection.h @@ -24,8 +24,8 @@ class SocketConnection { /** * Takes in parameters supporting std::stringstream conversion and a string - * prefix and transforms them into format "prefix(arg1,arg2,arg3)\n" (e.g. - * "chat.post(test)\n") and sends command to the server. + * prefix and transforms them into format "prefix(arg1,arg2,arg3)" e.g. + * "chat.post(test)" and sends command to the server. * * @tparam Types * @param prefix From a72d6f9c5d6c8b044a36dead4d56231ef2a30d34 Mon Sep 17 00:00:00 2001 From: s4016080-ps1nov Date: Wed, 28 Aug 2024 11:58:54 +1000 Subject: [PATCH 2/5] Automated debian package & releases --- .github/workflows/package-release.yml | 110 ++++++++++++++++++++++++++ CMakeLists.txt | 24 ++++-- 2 files changed, 127 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/package-release.yml diff --git a/.github/workflows/package-release.yml b/.github/workflows/package-release.yml new file mode 100644 index 00000000..1ddb25a8 --- /dev/null +++ b/.github/workflows/package-release.yml @@ -0,0 +1,110 @@ +name: package-release + +on: + push: + paths-ignore: + - "README.md" + - "LICENSE" + - "Doxyfile" + - "doxygen-awesome" + + pull_request: + paths-ignore: + - "README.md" + - "LICENSE" + - "Doxyfile" + - "doxygen-awesome" + + release: + types: [published] + +jobs: + check_commit_message: + outputs: + commit_message: ${{ steps.capture_message.outputs.message }} + name: Check if workflow disabled + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Capturing commit message + id: capture_message + run: | + echo "message=$(git log --format=%B -n 1 ${{ github.event.after }})" >> $GITHUB_OUTPUT + + linux: + strategy: + fail-fast: false + matrix: + build-type: [Release] + distro: [stable] + needs: check_commit_message + if: ${{ contains(needs.check_commit_message.outputs.commit_message, 'RELEASE') }} + name: Debian-release ${{ matrix.distro }} + runs-on: ubuntu-latest + container: debian:${{ matrix.distro }} + steps: + - name: Setting up git + run: | + apt-get update + apt-get install -y git + - name: Add Safe Directory for Git + run: | + git config --global --add safe.directory /__w/mcpp/mcpp + + - name: Getting version + id: get_version + shell: bash + run: | + VERSION=$(echo $GITHUB_REF_NAME | cut -d / -f 2) + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + + - name: Checking out sources + uses: actions/checkout@v4 + + - name: Install build dependencies + run: | + apt-get install -y build-essential ninja-build qtbase5-dev qttools5-dev cmake pkgconf bash libspdlog-dev + + - name: Configure build + run: | + mkdir build + cd build + cmake .. -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DPROJECT_VERSION=${{ steps.get_version.outputs.VERSION }} + echo "VERSION=${{ steps.get_version.outputs.VERSION }}" + + - name: Build + run: | + cd build + cmake --build . --target package --parallel $(nproc) + + - name: Get package name + shell: bash + id: get_package + run: | + NAME=$(basename build/mcpp-*.deb) + echo "NAME=$NAME" >> $GITHUB_OUTPUT + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: mcpp-${{ steps.get_version.outputs.VERSION }}-debian-${{ matrix.distro }}-${{ matrix.build-type }}.deb + path: build/${{ steps.get_package.outputs.NAME }} + + - name: Create tag + run: | + git tag release-${{ steps.get_version.outputs.VERSION }} + git push origin release-${{ steps.get_version.outputs.VERSION }} --force + + - name: Upload package to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: build/${{ steps.get_package.outputs.NAME }} + asset_name: mcpp-${{ steps.get_version.outputs.VERSION }}-debian-${{ matrix.distro }}-${{ matrix.build-type }}.deb + tag: release-${{ steps.get_version.outputs.VERSION }} + overwrite: true + + - name: Debug GitHub Ref + run: | + echo "GitHub Ref: ${{ github.ref }}" + echo "GitHub Ref Name: ${{ github.ref_name }}" \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index d0fcf200..b9c30052 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,11 @@ cmake_minimum_required(VERSION 3.16) -project(mcpp) +# Check if PROJECT_VERSION is already defined, otherwise set a default +if(NOT DEFINED PROJECT_VERSION) + set(PROJECT_VERSION 1.0.0) +endif() + +project(mcpp VERSION ${PROJECT_VERSION}) set(CMAKE_CXX_STANDARD 17) @@ -29,14 +34,19 @@ file(GLOB_RECURSE MCPP_SOURCE_FILES ${MCPP_SRC_DIR}/*.cpp) add_library(${PROJECT_NAME} SHARED ${MCPP_INCLUDE_FILES} ${MCPP_SOURCE_FILES}) set_target_properties(${PROJECT_NAME} - PROPERTIES - PUBLIC_HEADER "${MCPP_INCLUDE_FILES}" + PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION 1 + PUBLIC_HEADER "${MCPP_INCLUDE_FILES}" ) install(TARGETS ${PROJECT_NAME} - LIBRARY DESTINATION lib - PUBLIC_HEADER DESTINATION include/${PROJECT_NAME} + LIBRARY DESTINATION lib + PUBLIC_HEADER DESTINATION include/${PROJECT_NAME} ) - - +# CPack setup +SET(CPACK_GENERATOR "DEB") +SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) +SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "ROZUKKE") +INCLUDE(CPack) \ No newline at end of file From 0b917f9de6596e3ae437e356cea83305ede58553 Mon Sep 17 00:00:00 2001 From: s4016080-ps1nov Date: Wed, 28 Aug 2024 16:40:12 +1000 Subject: [PATCH 3/5] Fix styling issues RELEASE --- CMakeLists.txt | 4 ++-- include/mcpp/connection.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9c30052..ceefaaee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,7 @@ install(TARGETS ${PROJECT_NAME} ) # CPack setup -SET(CPACK_GENERATOR "DEB") +SET(CPACK_GENERATOR "deb") SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) -SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "ROZUKKE") +SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Rozukke") INCLUDE(CPack) \ No newline at end of file diff --git a/include/mcpp/connection.h b/include/mcpp/connection.h index 27bbd9d2..ebcea963 100644 --- a/include/mcpp/connection.h +++ b/include/mcpp/connection.h @@ -24,8 +24,8 @@ class SocketConnection { /** * Takes in parameters supporting std::stringstream conversion and a string - * prefix and transforms them into format "prefix(arg1,arg2,arg3)" e.g. - * "chat.post(test)" and sends command to the server. + * prefix and transforms them into format "prefix(arg1,arg2,arg3)\n" e.g. + * "chat.post(test)\n)" and sends command to the server. * * @tparam Types * @param prefix From 58860d342a3832b7f743cb94bbbc6b565d167aae Mon Sep 17 00:00:00 2001 From: s4016080-ps1nov Date: Wed, 28 Aug 2024 16:42:09 +1000 Subject: [PATCH 4/5] rename deb to DEB RELEASE --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ceefaaee..548c2f6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,7 @@ install(TARGETS ${PROJECT_NAME} ) # CPack setup -SET(CPACK_GENERATOR "deb") +SET(CPACK_GENERATOR "DEB") SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Rozukke") INCLUDE(CPack) \ No newline at end of file From 8397440b58f120abdc23b021f2e48e801b4a4674 Mon Sep 17 00:00:00 2001 From: s4016080-ps1nov Date: Thu, 29 Aug 2024 17:49:18 +1000 Subject: [PATCH 5/5] fixing styling issues RELEASE --- .github/workflows/package-release.yml | 2 +- CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/package-release.yml b/.github/workflows/package-release.yml index 1ddb25a8..eb4c4f22 100644 --- a/.github/workflows/package-release.yml +++ b/.github/workflows/package-release.yml @@ -55,7 +55,7 @@ jobs: id: get_version shell: bash run: | - VERSION=$(echo $GITHUB_REF_NAME | cut -d / -f 2) + VERSION=$(echo $GITHUB_REF_NAME | cut -d - -f 2) echo "VERSION=$VERSION" >> $GITHUB_OUTPUT - name: Checking out sources diff --git a/CMakeLists.txt b/CMakeLists.txt index 548c2f6d..5bc6115c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,5 +48,5 @@ install(TARGETS ${PROJECT_NAME} # CPack setup SET(CPACK_GENERATOR "DEB") SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) -SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Rozukke") +SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "rozukke") INCLUDE(CPack) \ No newline at end of file