From a22316b38447966ae15f01533a8bf0473febe985 Mon Sep 17 00:00:00 2001 From: "Hussain A." Date: Sun, 6 Jul 2025 00:15:51 +0500 Subject: [PATCH 1/9] Github workflow for Ubuntu Packaging --- .../create-ubuntu-distribution-packaging.yml | 104 ++++++++++++++++++ inflection/CMakeLists.txt | 20 ++++ 2 files changed, 124 insertions(+) create mode 100644 .github/workflows/create-ubuntu-distribution-packaging.yml diff --git a/.github/workflows/create-ubuntu-distribution-packaging.yml b/.github/workflows/create-ubuntu-distribution-packaging.yml new file mode 100644 index 00000000..859c56aa --- /dev/null +++ b/.github/workflows/create-ubuntu-distribution-packaging.yml @@ -0,0 +1,104 @@ +cat .github/workflows/ +cmake-multi-platform.yml +create-ubuntu-distribution-package.yml +ubuntu-memory-check.yml +unicode25@Hassan:/mnt/e/Hussain/unicodeInflectionforking/inflection$ cat .github/workflows/create-ubuntu-distribution-package.yml +cat .github/workflows/create-ubuntu-distribution-package.yml +name: Build & Package (Ubuntu) + +on: + push: + tags: + - 'v*' + workflow_dispatch: + pull_request: + branches: [ main ] + +jobs: + build-and-package: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + lfs: true + + - name: Setup Git LFS + run: | + git lfs install + git lfs pull + + - name: Install system dependencies + run: | + sudo apt update + sudo apt install -y cmake build-essential clang pkg-config + + - name: Cache ICU + uses: actions/cache@v4 + id: cache-icu + with: + path: /usr/local + key: icu-77.1-ubuntu-${{ runner.os }} + + - name: Install ICU 77.1 (Binary) + if: steps.cache-icu.outputs.cache-hit != 'true' + run: | + cd /tmp + wget https://github.com/unicode-org/icu/releases/download/release-77-1/icu4c-77_1-Ubuntu22.04-x64.tgz + mkdir icu-install + tar -xzf icu4c-77_1-Ubuntu22.04-x64.tgz -C icu-install + sudo cp -r icu-install/usr/ /usr/local/ + sudo ldconfig + + - name: Setup ICU (from cache) + if: steps.cache-icu.outputs.cache-hit == 'true' + run: | + sudo ldconfig + + - name: Debug ICU version + run: | + ls -l /usr/local/lib | grep icu || true + strings /usr/local/lib/libicuuc.so | grep "ICU" | head -n 5 || true + + - name: Configure & Build + run: | + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH + export CPLUS_INCLUDE_PATH=/usr/local/include:$CPLUS_INCLUDE_PATH + mkdir -p inflection/build + cd inflection/build + CC=clang CXX=clang++ cmake .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DICU_ROOT=/usr/local \ + -DCMAKE_PREFIX_PATH=/usr/local + make -j$(nproc) + + - name: Run tests + run: | + cd inflection/build + make check + + - name: Package with CPack + run: | + cd inflection/build + cpack + ls -la *.deb *.tar.gz + + - name: Upload release artifacts + uses: actions/upload-artifact@v4 + with: + name: ubuntu-release-artifacts + path: | + inflection/build/*.deb + inflection/build/*.tar.gz + retention-days: 30 + + - name: Upload to GitHub Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + name: "Release ${{ github.ref_name }}" + files: | + inflection/build/*.deb + inflection/build/*.tar.gz + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/inflection/CMakeLists.txt b/inflection/CMakeLists.txt index bc82e65c..b5df1e0a 100644 --- a/inflection/CMakeLists.txt +++ b/inflection/CMakeLists.txt @@ -130,3 +130,23 @@ make generate-coverage-csv : Generates code coverage as a csv\\n\ install(TARGETS inflection LIBRARY COMPONENT inflection_library) install(DIRECTORY ${INFLECTION_INCLUDE_ROOT}/ TYPE INCLUDE COMPONENT inflection_headers) install(DIRECTORY ${INFLECTION_DATA_ROOT}/ TYPE DATA COMPONENT inflection_data) + +# CPack Configuration for Ubuntu Packaging + +set(CPACK_PACKAGE_NAME "unicode-inflection") +set(CPACK_PACKAGE_VENDOR "Unicode Consortium") +set(CPACK_PACKAGE_CONTACT "https://github.com/unicode-org/inflection") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Unicode Inflection Library") +set(CPACK_GENERATOR "DEB;TGZ") + +# DEB-specific options +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Unicode Consortium ") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "libicu77 (>= 77.1)") +set(CPACK_DEBIAN_PACKAGE_SECTION "libs") +set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") + +# Source package +set(CPACK_SOURCE_GENERATOR "TGZ") +set(CPACK_SOURCE_IGNORE_FILES "/build/;/.git/;/.vscode/;/.idea/") + +include(CPack) From fde11eae5ca0bce5639095b92dfaf9aa8a436386 Mon Sep 17 00:00:00 2001 From: "Hussain A." Date: Sun, 6 Jul 2025 01:08:59 +0500 Subject: [PATCH 2/9] Github workflow for Ubuntu Packaging. --- .github/workflows/create-ubuntu-distribution-packaging.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/create-ubuntu-distribution-packaging.yml b/.github/workflows/create-ubuntu-distribution-packaging.yml index 859c56aa..7dd73470 100644 --- a/.github/workflows/create-ubuntu-distribution-packaging.yml +++ b/.github/workflows/create-ubuntu-distribution-packaging.yml @@ -1,9 +1,3 @@ -cat .github/workflows/ -cmake-multi-platform.yml -create-ubuntu-distribution-package.yml -ubuntu-memory-check.yml -unicode25@Hassan:/mnt/e/Hussain/unicodeInflectionforking/inflection$ cat .github/workflows/create-ubuntu-distribution-package.yml -cat .github/workflows/create-ubuntu-distribution-package.yml name: Build & Package (Ubuntu) on: From c3864d6d7e5c32b040b84bf94f52c1f75e486e43 Mon Sep 17 00:00:00 2001 From: "Hussain A." Date: Sun, 6 Jul 2025 01:19:00 +0500 Subject: [PATCH 3/9] Github workflow for Ubuntu Packaging! --- .github/workflows/create-ubuntu-distribution-packaging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-ubuntu-distribution-packaging.yml b/.github/workflows/create-ubuntu-distribution-packaging.yml index 7dd73470..51de5702 100644 --- a/.github/workflows/create-ubuntu-distribution-packaging.yml +++ b/.github/workflows/create-ubuntu-distribution-packaging.yml @@ -41,7 +41,7 @@ jobs: wget https://github.com/unicode-org/icu/releases/download/release-77-1/icu4c-77_1-Ubuntu22.04-x64.tgz mkdir icu-install tar -xzf icu4c-77_1-Ubuntu22.04-x64.tgz -C icu-install - sudo cp -r icu-install/usr/ /usr/local/ + sudo cp -r icu-install/icu/usr/local/* /usr/local/ sudo ldconfig - name: Setup ICU (from cache) From 6421ce91fdfb4a8ed50e065f7b537325da9cb875 Mon Sep 17 00:00:00 2001 From: "Hussain A." Date: Tue, 8 Jul 2025 00:43:47 +0500 Subject: [PATCH 4/9] Refactor packaging workflow based on the feedback --- .../create-ubuntu-distribution-packaging.yml | 20 ++++++++----------- inflection/CMakeLists.txt | 3 +++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/create-ubuntu-distribution-packaging.yml b/.github/workflows/create-ubuntu-distribution-packaging.yml index 51de5702..0399af82 100644 --- a/.github/workflows/create-ubuntu-distribution-packaging.yml +++ b/.github/workflows/create-ubuntu-distribution-packaging.yml @@ -5,12 +5,12 @@ on: tags: - 'v*' workflow_dispatch: - pull_request: - branches: [ main ] jobs: build-and-package: runs-on: ubuntu-latest + env: + ICU_VERSION: 77_1 steps: - name: Checkout uses: actions/checkout@v4 @@ -32,15 +32,15 @@ jobs: id: cache-icu with: path: /usr/local - key: icu-77.1-ubuntu-${{ runner.os }} + key: icu-${{ env.ICU_VERSION }}-ubuntu-${{ runner.os }} - - name: Install ICU 77.1 (Binary) + - name: Install ICU (Binary) if: steps.cache-icu.outputs.cache-hit != 'true' run: | cd /tmp - wget https://github.com/unicode-org/icu/releases/download/release-77-1/icu4c-77_1-Ubuntu22.04-x64.tgz + wget https://github.com/unicode-org/icu/releases/download/release-${ICU_VERSION//_/-}/icu4c-${ICU_VERSION}-Ubuntu22.04-x64.tgz mkdir icu-install - tar -xzf icu4c-77_1-Ubuntu22.04-x64.tgz -C icu-install + tar -xzf icu4c-${ICU_VERSION}-Ubuntu22.04-x64.tgz -C icu-install sudo cp -r icu-install/icu/usr/local/* /usr/local/ sudo ldconfig @@ -49,11 +49,6 @@ jobs: run: | sudo ldconfig - - name: Debug ICU version - run: | - ls -l /usr/local/lib | grep icu || true - strings /usr/local/lib/libicuuc.so | grep "ICU" | head -n 5 || true - - name: Configure & Build run: | export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH @@ -69,7 +64,7 @@ jobs: - name: Run tests run: | cd inflection/build - make check + make -j$(nproc) check - name: Package with CPack run: | @@ -96,3 +91,4 @@ jobs: inflection/build/*.tar.gz env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/inflection/CMakeLists.txt b/inflection/CMakeLists.txt index b5df1e0a..caf1a53e 100644 --- a/inflection/CMakeLists.txt +++ b/inflection/CMakeLists.txt @@ -134,6 +134,7 @@ install(DIRECTORY ${INFLECTION_DATA_ROOT}/ TYPE DATA COMPONENT inflection_ # CPack Configuration for Ubuntu Packaging set(CPACK_PACKAGE_NAME "unicode-inflection") +set(CPACK_PACKAGE_VERSION "${INFLECTION_VERSION}") set(CPACK_PACKAGE_VENDOR "Unicode Consortium") set(CPACK_PACKAGE_CONTACT "https://github.com/unicode-org/inflection") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Unicode Inflection Library") @@ -144,9 +145,11 @@ set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Unicode Consortium = 77.1)") set(CPACK_DEBIAN_PACKAGE_SECTION "libs") set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") +set(CPACK_DEBIAN_PACKAGE_VERSION "${INFLECTION_VERSION}") # Source package set(CPACK_SOURCE_GENERATOR "TGZ") set(CPACK_SOURCE_IGNORE_FILES "/build/;/.git/;/.vscode/;/.idea/") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${INFLECTION_VERSION}") include(CPack) From 8a8fa4134dd2edf74c2355df62bc68e48ffcfd6b Mon Sep 17 00:00:00 2001 From: "Hussain A." Date: Thu, 10 Jul 2025 00:57:58 +0500 Subject: [PATCH 5/9] Fix CPack versioning: derive major/minor/patch from INFLECTION_VERSION --- inflection/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/inflection/CMakeLists.txt b/inflection/CMakeLists.txt index caf1a53e..b48d67b0 100644 --- a/inflection/CMakeLists.txt +++ b/inflection/CMakeLists.txt @@ -135,6 +135,14 @@ install(DIRECTORY ${INFLECTION_DATA_ROOT}/ TYPE DATA COMPONENT inflection_ set(CPACK_PACKAGE_NAME "unicode-inflection") set(CPACK_PACKAGE_VERSION "${INFLECTION_VERSION}") + + +string(REPLACE "." ";" INFLECTION_VERSION_LIST ${INFLECTION_VERSION}) +list(GET INFLECTION_VERSION_LIST 0 CPACK_PACKAGE_VERSION_MAJOR) +list(GET INFLECTION_VERSION_LIST 1 CPACK_PACKAGE_VERSION_MINOR) +list(GET INFLECTION_VERSION_LIST 2 CPACK_PACKAGE_VERSION_PATCH) +# --- End block --- + set(CPACK_PACKAGE_VENDOR "Unicode Consortium") set(CPACK_PACKAGE_CONTACT "https://github.com/unicode-org/inflection") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Unicode Inflection Library") From a5800f8502711423bacdea29729aabeb04aea171 Mon Sep 17 00:00:00 2001 From: "Hussain A." Date: Thu, 10 Jul 2025 22:43:04 +0500 Subject: [PATCH 6/9] Fixing Version Issue --- inflection/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/inflection/CMakeLists.txt b/inflection/CMakeLists.txt index b48d67b0..a75a453c 100644 --- a/inflection/CMakeLists.txt +++ b/inflection/CMakeLists.txt @@ -141,7 +141,6 @@ string(REPLACE "." ";" INFLECTION_VERSION_LIST ${INFLECTION_VERSION}) list(GET INFLECTION_VERSION_LIST 0 CPACK_PACKAGE_VERSION_MAJOR) list(GET INFLECTION_VERSION_LIST 1 CPACK_PACKAGE_VERSION_MINOR) list(GET INFLECTION_VERSION_LIST 2 CPACK_PACKAGE_VERSION_PATCH) -# --- End block --- set(CPACK_PACKAGE_VENDOR "Unicode Consortium") set(CPACK_PACKAGE_CONTACT "https://github.com/unicode-org/inflection") From c9ae1f4ee18a87a8483fa57a6a77436d228a3967 Mon Sep 17 00:00:00 2001 From: "Hussain A." Date: Thu, 10 Jul 2025 22:55:24 +0500 Subject: [PATCH 7/9] Fixing the Cmake Version --- inflection/CMakeLists.txt | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/inflection/CMakeLists.txt b/inflection/CMakeLists.txt index a75a453c..aba3bc14 100644 --- a/inflection/CMakeLists.txt +++ b/inflection/CMakeLists.txt @@ -131,16 +131,32 @@ install(TARGETS inflection LIBRARY COMPONENT inflection_ install(DIRECTORY ${INFLECTION_INCLUDE_ROOT}/ TYPE INCLUDE COMPONENT inflection_headers) install(DIRECTORY ${INFLECTION_DATA_ROOT}/ TYPE DATA COMPONENT inflection_data) + + # CPack Configuration for Ubuntu Packaging set(CPACK_PACKAGE_NAME "unicode-inflection") set(CPACK_PACKAGE_VERSION "${INFLECTION_VERSION}") +# --- Robust version parsing block --- +string(REPLACE "." ";" INFLECTION_VERSION_LIST "${INFLECTION_VERSION}") -string(REPLACE "." ";" INFLECTION_VERSION_LIST ${INFLECTION_VERSION}) -list(GET INFLECTION_VERSION_LIST 0 CPACK_PACKAGE_VERSION_MAJOR) -list(GET INFLECTION_VERSION_LIST 1 CPACK_PACKAGE_VERSION_MINOR) -list(GET INFLECTION_VERSION_LIST 2 CPACK_PACKAGE_VERSION_PATCH) +# Set defaults to avoid list index errors +set(CPACK_PACKAGE_VERSION_MAJOR "0") +set(CPACK_PACKAGE_VERSION_MINOR "0") +set(CPACK_PACKAGE_VERSION_PATCH "0") + +list(LENGTH INFLECTION_VERSION_LIST _len) +if(_len GREATER 0) + list(GET INFLECTION_VERSION_LIST 0 CPACK_PACKAGE_VERSION_MAJOR) +endif() +if(_len GREATER 1) + list(GET INFLECTION_VERSION_LIST 1 CPACK_PACKAGE_VERSION_MINOR) +endif() +if(_len GREATER 2) + list(GET INFLECTION_VERSION_LIST 2 CPACK_PACKAGE_VERSION_PATCH) +endif() +# --- End version parsing block --- set(CPACK_PACKAGE_VENDOR "Unicode Consortium") set(CPACK_PACKAGE_CONTACT "https://github.com/unicode-org/inflection") @@ -160,3 +176,4 @@ set(CPACK_SOURCE_IGNORE_FILES "/build/;/.git/;/.vscode/;/.idea/") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${INFLECTION_VERSION}") include(CPack) + From 67ba8aa67ae774452392a0cec3e5f13504e973df Mon Sep 17 00:00:00 2001 From: "Hussain A." Date: Thu, 10 Jul 2025 23:18:22 +0500 Subject: [PATCH 8/9] Fix: Cpack Version Handling --- inflection/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inflection/CMakeLists.txt b/inflection/CMakeLists.txt index aba3bc14..9ce1b46b 100644 --- a/inflection/CMakeLists.txt +++ b/inflection/CMakeLists.txt @@ -138,7 +138,7 @@ install(DIRECTORY ${INFLECTION_DATA_ROOT}/ TYPE DATA COMPONENT inflection_ set(CPACK_PACKAGE_NAME "unicode-inflection") set(CPACK_PACKAGE_VERSION "${INFLECTION_VERSION}") -# --- Robust version parsing block --- + string(REPLACE "." ";" INFLECTION_VERSION_LIST "${INFLECTION_VERSION}") # Set defaults to avoid list index errors @@ -156,7 +156,8 @@ endif() if(_len GREATER 2) list(GET INFLECTION_VERSION_LIST 2 CPACK_PACKAGE_VERSION_PATCH) endif() -# --- End version parsing block --- + + set(CPACK_PACKAGE_VENDOR "Unicode Consortium") set(CPACK_PACKAGE_CONTACT "https://github.com/unicode-org/inflection") From a45eb4d60617812a2e113bdb690ba07c605d36ac Mon Sep 17 00:00:00 2001 From: "Hussain A." Date: Sun, 13 Jul 2025 00:37:59 +0500 Subject: [PATCH 9/9] Add CPack-based Ubuntu packaging and GitHub Actions release workflow --- .../workflows/create-ubuntu-distribution-packaging.yml | 9 +++++++++ inflection/CMakeLists.txt | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-ubuntu-distribution-packaging.yml b/.github/workflows/create-ubuntu-distribution-packaging.yml index 0399af82..837bbfcb 100644 --- a/.github/workflows/create-ubuntu-distribution-packaging.yml +++ b/.github/workflows/create-ubuntu-distribution-packaging.yml @@ -1,3 +1,12 @@ +# ---------------------------------------------------------------------------------------- +# To update ICU version: +# 1. Update the ICU_VERSION environment variable below. +# 2. Check the ICU binary URL — is the filename still Ubuntu22.04-x64.tgz? +# (e.g., icu4c-78_1-Ubuntu22.04-x64.tgz) +# 3. Update inflection/CMakeLists.txt: +# - Modify `CPACK_DEBIAN_PACKAGE_DEPENDS` to match the new ICU version. +# ---------------------------------------------------------------------------------------- + name: Build & Package (Ubuntu) on: diff --git a/inflection/CMakeLists.txt b/inflection/CMakeLists.txt index 9ce1b46b..0b8ac4ae 100644 --- a/inflection/CMakeLists.txt +++ b/inflection/CMakeLists.txt @@ -136,8 +136,10 @@ install(DIRECTORY ${INFLECTION_DATA_ROOT}/ TYPE DATA COMPONENT inflection_ # CPack Configuration for Ubuntu Packaging set(CPACK_PACKAGE_NAME "unicode-inflection") -set(CPACK_PACKAGE_VERSION "${INFLECTION_VERSION}") +# Apply the current tagged Inflection version to the CPack version. +# CPack may inherit a default or cached version, so we explicitly set it here. +set(CPACK_PACKAGE_VERSION "${INFLECTION_VERSION}") string(REPLACE "." ";" INFLECTION_VERSION_LIST "${INFLECTION_VERSION}") @@ -157,8 +159,6 @@ if(_len GREATER 2) list(GET INFLECTION_VERSION_LIST 2 CPACK_PACKAGE_VERSION_PATCH) endif() - - set(CPACK_PACKAGE_VENDOR "Unicode Consortium") set(CPACK_PACKAGE_CONTACT "https://github.com/unicode-org/inflection") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Unicode Inflection Library")