Skip to content

Create distribution packages for ubuntu (.deb release v0.0.1) #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/create-ubuntu-distribution-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Build & Package (Ubuntu)

on:
push:
tags:
- 'v*'
workflow_dispatch:
pull_request:
branches: [ main, master ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need the master part. It's obsolete and our repo doesn't have it.


jobs:
build-and-package:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true

- name: Setup Git LFS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can land it as is for now, but fix it after Frank lands 128 (LFS caching).

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ICU caching already landed - we can use it here to save bandwidth.

run: |
cd /tmp
wget https://github.com/unicode-org/icu/releases/download/release-77-1/icu4c-77_1-src.tgz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we download and compile sources? Why not just download and install binary release for Ubuntu? It takes time to compile ICU.

One needs to only copy the $download_location/usr tree to /usr/local/ folder

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 }}
20 changes: 20 additions & 0 deletions inflection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "[email protected]")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to find another contact. I'm not sure that I'm ready to have my email address here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that a mandatory field? If we have to have it, we can use the [email protected] one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d prefer just listing the official GitHub project. The discussion page can be used for communication.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree.

set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Unicode Inflection Library")
set(CPACK_GENERATOR "DEB;TGZ")

# DEB-specific options
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Unicode Consortium <[email protected]>")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libicu-dev (>= 77.1)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dev part is only needed for building. The non-dev dependency is needed for runtime.

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)
Loading