diff --git a/.github/workflows/create-ubuntu-distribution-package.yml b/.github/workflows/create-ubuntu-distribution-package.yml new file mode 100644 index 0000000..f6a74d7 --- /dev/null +++ b/.github/workflows/create-ubuntu-distribution-package.yml @@ -0,0 +1,81 @@ +name: Build & Package (Ubuntu) + +on: + push: + tags: + - 'v*' + workflow_dispatch: + pull_request: + branches: [ main, master ] + +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: Install ICU 77.1 + run: | + cd /tmp + wget https://github.com/unicode-org/icu/releases/download/release-77-1/icu4c-77_1-src.tgz + tar xzf icu4c-77_1-src.tgz + cd icu/source + ./configure --prefix=/usr/local + make -j$(nproc) + sudo make install + sudo ldconfig + + - name: Configure & Build + run: | + mkdir -p build + cd 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 build + make check + + - name: Package with CPack + run: | + cd build + cpack + ls -la *.deb *.tar.gz + + - name: Upload release artifacts + uses: actions/upload-artifact@v4 + with: + name: ubuntu-release-artifacts + path: | + build/*.deb + 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: | + build/*.deb + build/*.tar.gz + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/inflection/CMakeLists.txt b/inflection/CMakeLists.txt index bc82e65..577a4a3 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 "grhoten@gmail.com") +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 "libicu-dev (>= 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)