Skip to content

Commit a22316b

Browse files
committed
Github workflow for Ubuntu Packaging
1 parent 9dd5bcc commit a22316b

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-0
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
cat .github/workflows/
2+
cmake-multi-platform.yml
3+
create-ubuntu-distribution-package.yml
4+
ubuntu-memory-check.yml
5+
unicode25@Hassan:/mnt/e/Hussain/unicodeInflectionforking/inflection$ cat .github/workflows/create-ubuntu-distribution-package.yml
6+
cat .github/workflows/create-ubuntu-distribution-package.yml
7+
name: Build & Package (Ubuntu)
8+
9+
on:
10+
push:
11+
tags:
12+
- 'v*'
13+
workflow_dispatch:
14+
pull_request:
15+
branches: [ main ]
16+
17+
jobs:
18+
build-and-package:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
lfs: true
25+
26+
- name: Setup Git LFS
27+
run: |
28+
git lfs install
29+
git lfs pull
30+
31+
- name: Install system dependencies
32+
run: |
33+
sudo apt update
34+
sudo apt install -y cmake build-essential clang pkg-config
35+
36+
- name: Cache ICU
37+
uses: actions/cache@v4
38+
id: cache-icu
39+
with:
40+
path: /usr/local
41+
key: icu-77.1-ubuntu-${{ runner.os }}
42+
43+
- name: Install ICU 77.1 (Binary)
44+
if: steps.cache-icu.outputs.cache-hit != 'true'
45+
run: |
46+
cd /tmp
47+
wget https://github.com/unicode-org/icu/releases/download/release-77-1/icu4c-77_1-Ubuntu22.04-x64.tgz
48+
mkdir icu-install
49+
tar -xzf icu4c-77_1-Ubuntu22.04-x64.tgz -C icu-install
50+
sudo cp -r icu-install/usr/ /usr/local/
51+
sudo ldconfig
52+
53+
- name: Setup ICU (from cache)
54+
if: steps.cache-icu.outputs.cache-hit == 'true'
55+
run: |
56+
sudo ldconfig
57+
58+
- name: Debug ICU version
59+
run: |
60+
ls -l /usr/local/lib | grep icu || true
61+
strings /usr/local/lib/libicuuc.so | grep "ICU" | head -n 5 || true
62+
63+
- name: Configure & Build
64+
run: |
65+
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
66+
export CPLUS_INCLUDE_PATH=/usr/local/include:$CPLUS_INCLUDE_PATH
67+
mkdir -p inflection/build
68+
cd inflection/build
69+
CC=clang CXX=clang++ cmake .. \
70+
-DCMAKE_BUILD_TYPE=Release \
71+
-DICU_ROOT=/usr/local \
72+
-DCMAKE_PREFIX_PATH=/usr/local
73+
make -j$(nproc)
74+
75+
- name: Run tests
76+
run: |
77+
cd inflection/build
78+
make check
79+
80+
- name: Package with CPack
81+
run: |
82+
cd inflection/build
83+
cpack
84+
ls -la *.deb *.tar.gz
85+
86+
- name: Upload release artifacts
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: ubuntu-release-artifacts
90+
path: |
91+
inflection/build/*.deb
92+
inflection/build/*.tar.gz
93+
retention-days: 30
94+
95+
- name: Upload to GitHub Release
96+
uses: softprops/action-gh-release@v2
97+
if: startsWith(github.ref, 'refs/tags/')
98+
with:
99+
name: "Release ${{ github.ref_name }}"
100+
files: |
101+
inflection/build/*.deb
102+
inflection/build/*.tar.gz
103+
env:
104+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

inflection/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,23 @@ make generate-coverage-csv : Generates code coverage as a csv\\n\
130130
install(TARGETS inflection LIBRARY COMPONENT inflection_library)
131131
install(DIRECTORY ${INFLECTION_INCLUDE_ROOT}/ TYPE INCLUDE COMPONENT inflection_headers)
132132
install(DIRECTORY ${INFLECTION_DATA_ROOT}/ TYPE DATA COMPONENT inflection_data)
133+
134+
# CPack Configuration for Ubuntu Packaging
135+
136+
set(CPACK_PACKAGE_NAME "unicode-inflection")
137+
set(CPACK_PACKAGE_VENDOR "Unicode Consortium")
138+
set(CPACK_PACKAGE_CONTACT "https://github.com/unicode-org/inflection")
139+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Unicode Inflection Library")
140+
set(CPACK_GENERATOR "DEB;TGZ")
141+
142+
# DEB-specific options
143+
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Unicode Consortium <[email protected]>")
144+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libicu77 (>= 77.1)")
145+
set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
146+
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
147+
148+
# Source package
149+
set(CPACK_SOURCE_GENERATOR "TGZ")
150+
set(CPACK_SOURCE_IGNORE_FILES "/build/;/.git/;/.vscode/;/.idea/")
151+
152+
include(CPack)

0 commit comments

Comments
 (0)