Skip to content

Commit 1136374

Browse files
authored
Merge branch 'main' into fix/ubuntu-release-workflow
2 parents 8b8dc9c + 5118918 commit 1136374

File tree

65 files changed

+1133
-345
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1133
-345
lines changed

.github/workflows/cmake-multi-platform.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@ on:
99
pull_request:
1010
paths:
1111
- 'inflection/**'
12+
- '.github/workflows/**'
1213
- '!data/**'
1314
- '!documents/**'
1415
- '!fst/**'
15-
16+
# Run the build when we merge into main
17+
push:
18+
branches:
19+
- main
20+
paths:
21+
- 'inflection/**'
22+
- '.github/workflows/**'
1623
env:
1724
ICU_MAJOR: '77'
1825
ICU_MINOR: '1'
@@ -43,6 +50,11 @@ jobs:
4350
tar xvfz *.tgz
4451
rm *.tgz
4552
53+
- uses: actions/cache/save@v4
54+
with:
55+
path: ~/icu
56+
key: ${{ runner.os }}-icu-${ICU_MAJOR}-${ICU_MINOR}
57+
4658
build:
4759
needs: cache-icu
4860
runs-on: ${{ matrix.os }}
@@ -71,8 +83,30 @@ jobs:
7183

7284
steps:
7385
- uses: actions/checkout@v4
86+
87+
- name: Create Git LFS file list
88+
run: git lfs ls-files -l |cut -d' ' -f1 |sort >.git/lfs-hashes.txt
89+
90+
- name: Restore Git LFS object cache
91+
uses: actions/cache@v4
92+
id: lfscache
7493
with:
75-
lfs: 'true'
94+
path: inflection/resources/org/unicode/inflection/dictionary
95+
key: ${{ runner.os }}-lfsdata-v1-${{ hashFiles('.git/lfs-hashes.txt') }}
96+
restore-keys: |
97+
${{ runner.os }}-lfsdata-v1-
98+
${{ runner.os }}-lfsdata
99+
100+
- name: Fetch any needed Git LFS objects and prune extraneous ones
101+
if: steps.lfscache.outputs.cache-hit != 'true'
102+
run: git lfs fetch --prune
103+
104+
- name: Check out Git LFS content
105+
if: steps.lfscache.outputs.cache-hit != 'true'
106+
run: git lfs checkout
107+
108+
- name: Check LFS restore the files or not after checkout
109+
run: ls -l inflection/resources/org/unicode/inflection/dictionary/*
76110

77111
- name: Set reusable strings
78112
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.

.github/workflows/create-ubuntu-distribution-packaging.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# .github/workflows/create-ubuntu-distribution-packaging.yml
2-
31
# ----------------------------------------------------------------------------------------
42
# To update ICU version:
53
# 1. Update the ICU_VERSION environment variable below.
@@ -48,13 +46,16 @@ jobs:
4846
icu-${{ env.ICU_VERSION }}-${{ runner.os }}-
4947
icu-${{ env.ICU_VERSION }}-
5048
49+
50+
5151
- name: Install ICU (Binary)
5252
if: steps.cache-icu.outputs.cache-hit != 'true'
5353
run: |
5454
cd /tmp
5555
wget https://github.com/unicode-org/icu/releases/download/release-${ICU_VERSION//_/-}/icu4c-${ICU_VERSION}-Ubuntu22.04-x64.tgz
5656
mkdir icu-install
5757
tar -xzf icu4c-${ICU_VERSION}-Ubuntu22.04-x64.tgz -C icu-install
58+
5859
sudo mkdir -p /usr/local/icu-${ICU_VERSION}
5960
sudo cp -r icu-install/icu/usr/local/* /usr/local/icu-${ICU_VERSION}/
6061
sudo ldconfig
@@ -69,12 +70,14 @@ jobs:
6970
export PKG_CONFIG_PATH=/usr/local/icu-${ICU_VERSION}/lib/pkgconfig:$PKG_CONFIG_PATH
7071
export CPLUS_INCLUDE_PATH=/usr/local/icu-${ICU_VERSION}/include:$CPLUS_INCLUDE_PATH
7172
export LD_LIBRARY_PATH=/usr/local/icu-${ICU_VERSION}/lib:$LD_LIBRARY_PATH
73+
7274
mkdir -p inflection/build
7375
cd inflection/build
7476
CC=clang CXX=clang++ cmake .. \
7577
-DCMAKE_BUILD_TYPE=Release \
7678
-DICU_ROOT=/usr/local/icu-${ICU_VERSION} \
7779
-DCMAKE_PREFIX_PATH=/usr/local/icu-${ICU_VERSION}
80+
7881
make -j$(nproc)
7982
8083
- name: Run tests
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Doxygen
2+
3+
on:
4+
# Keep it for manual runs.
5+
workflow_dispatch:
6+
# Run the build when we merge into main
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- 'inflection/**'
12+
- '.github/workflows/**'
13+
env:
14+
ICU_MAJOR: '77'
15+
ICU_MINOR: '1'
16+
17+
jobs:
18+
cache-icu:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/cache/restore@v4
22+
id: cache
23+
with:
24+
path: ~/icu
25+
key: ${{ runner.os }}-icu-${ICU_MAJOR}-${ICU_MINOR}
26+
- name: Download and install icu
27+
if: steps.cache.outputs.cache-hit != 'true'
28+
run: |
29+
wget https://github.com/unicode-org/icu/releases/download/release-${ICU_MAJOR}-${ICU_MINOR}/icu4c-${ICU_MAJOR}_${ICU_MINOR}-Ubuntu22.04-x64.tgz
30+
export ICU=~/icu/
31+
mkdir -p $ICU
32+
echo "ICU directory is $ICU"
33+
34+
# Get the release and unpack.
35+
cp icu4c-${ICU_MAJOR}_${ICU_MINOR}-Ubuntu22.04-x64.tgz $ICU
36+
pushd $ICU
37+
38+
pwd
39+
40+
tar xvfz *.tgz
41+
rm *.tgz
42+
43+
- uses: actions/cache/save@v4
44+
with:
45+
path: ~/icu
46+
key: ${{ runner.os }}-icu-${ICU_MAJOR}-${ICU_MINOR}
47+
48+
doxygen:
49+
needs: cache-icu
50+
runs-on: ${{ matrix.os }}
51+
permissions:
52+
contents: write
53+
strategy:
54+
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
55+
fail-fast: false
56+
57+
# Set up a matrix to run the following configurations:
58+
# 1. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
59+
#
60+
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
61+
matrix:
62+
os: [ubuntu-latest]
63+
build_type: [Release]
64+
c_compiler: [clang]
65+
# All [OS x compiler] items should be covered in include/exclude sections.
66+
include:
67+
- os: ubuntu-latest
68+
c_compiler: clang
69+
cpp_compiler: clang++
70+
71+
steps:
72+
- uses: actions/checkout@v4
73+
74+
- name: Create Git LFS file list
75+
run: git lfs ls-files -l |cut -d' ' -f1 |sort >.git/lfs-hashes.txt
76+
77+
- name: Restore Git LFS object cache
78+
uses: actions/cache@v4
79+
id: lfscache
80+
with:
81+
path: inflection/resources/org/unicode/inflection/dictionary
82+
key: ${{ runner.os }}-lfsdata-v1-${{ hashFiles('.git/lfs-hashes.txt') }}
83+
restore-keys: |
84+
${{ runner.os }}-lfsdata-v1-
85+
${{ runner.os }}-lfsdata
86+
87+
- name: Fetch any needed Git LFS objects and prune extraneous ones
88+
if: steps.lfscache.outputs.cache-hit != 'true'
89+
run: git lfs fetch --prune
90+
91+
- name: Check out Git LFS content
92+
if: steps.lfscache.outputs.cache-hit != 'true'
93+
run: git lfs checkout
94+
95+
- name: Check LFS restore the files or not after checkout
96+
run: ls -l inflection/resources/org/unicode/inflection/dictionary/*
97+
98+
- name: Set reusable strings
99+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
100+
id: strings
101+
shell: bash
102+
run: |
103+
echo "project-root-dir=${{ github.workspace }}/inflection" >> "$GITHUB_OUTPUT"
104+
echo "build-output-dir=${{ github.workspace }}/inflection/build" >> "$GITHUB_OUTPUT"
105+
106+
- uses: actions/cache/restore@v4
107+
id: cache
108+
with:
109+
path: ~/icu
110+
key: ${{ runner.os }}-icu-${ICU_MAJOR}-${ICU_MINOR}
111+
112+
# Install all the required dependencies
113+
- name: Install ICU (Ubuntu)
114+
run: |
115+
echo "ICU_ROOT=~/icu/icu/usr/local" >> $GITHUB_ENV
116+
117+
- name: Configure CMake
118+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
119+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
120+
run: >
121+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
122+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
123+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
124+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
125+
-S ${{ steps.strings.outputs.project-root-dir }}
126+
127+
- name: Get number of CPU cores
128+
uses: SimenB/github-actions-cpu-cores@v2
129+
id: cpu-cores
130+
131+
# copy from https://github.com/DenverCoder1/doxygen-github-pages-action/blob/main/action.yml
132+
- name: Install dependencies
133+
run: sudo apt-get update && sudo apt-get install -y wget graphviz doxygen
134+
shell: bash
135+
136+
- name: Build and install header
137+
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
138+
run: |
139+
cmake --build ${{ steps.strings.outputs.build-output-dir }} -t docs --config ${{ matrix.build_type }} -j ${{ steps.cpu-cores.outputs.count }}
140+
141+
- name: Create .nojekyll (ensures pages with underscores work on gh pages)
142+
run: touch ${{ steps.strings.outputs.build-output-dir }}/docs/html/.nojekyll
143+
shell: bash
144+
145+
- name: Deploy to GitHub Pages
146+
uses: JamesIves/github-pages-deploy-action@v4
147+
with:
148+
token: ${{ secrets.GITHUB_TOKEN }}
149+
folder: ${{ steps.strings.outputs.build-output-dir }}/docs/html

.github/workflows/ubuntu-memory-check.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ on:
77
pull_request:
88
paths:
99
- 'inflection/**'
10+
- '.github/workflows/**'
1011
- '!data/**'
1112
- '!documents/**'
1213
- '!fst/**'
13-
14+
# Run the build when we merge into main
15+
push:
16+
branches:
17+
- main
18+
paths:
19+
- '.github/workflows/**'
20+
- 'inflection/**'
1421
env:
1522
ICU_MAJOR: '77'
1623
ICU_MINOR: '1'
@@ -41,6 +48,11 @@ jobs:
4148
tar xvfz *.tgz
4249
rm *.tgz
4350
51+
- uses: actions/cache/save@v4
52+
with:
53+
path: ~/icu
54+
key: ${{ runner.os }}-icu-${ICU_MAJOR}-${ICU_MINOR}
55+
4456
checkleak:
4557
needs: cache-icu
4658
runs-on: ubuntu-latest
@@ -51,8 +63,30 @@ jobs:
5163

5264
steps:
5365
- uses: actions/checkout@v4
66+
67+
- name: Create Git LFS file list
68+
run: git lfs ls-files -l |cut -d' ' -f1 |sort >.git/lfs-hashes.txt
69+
70+
- name: Restore Git LFS object cache
71+
id: lfscache
72+
uses: actions/cache@v4
5473
with:
55-
lfs: 'true'
74+
path: inflection/resources/org/unicode/inflection/dictionary
75+
key: ${{ runner.os }}-lfsdata-v1-${{ hashFiles('.git/lfs-hashes.txt') }}
76+
restore-keys: |
77+
${{ runner.os }}-lfsdata-v1-
78+
${{ runner.os }}-lfsdata
79+
80+
- name: Fetch any needed Git LFS objects and prune extraneous ones
81+
if: steps.lfscache.outputs.cache-hit != 'true'
82+
run: git lfs fetch --prune
83+
84+
- name: Check out Git LFS content
85+
if: steps.lfscache.outputs.cache-hit != 'true'
86+
run: git lfs checkout
87+
88+
- name: Check LFS restore the files or not after checkout
89+
run: ls -l inflection/resources/org/unicode/inflection/dictionary/*
5690

5791
- name: Set reusable strings
5892
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ LLMs can craft natural-sounding sentences in many languages, including those men
2626

2727
For more details refer to the [Proposal for a Unicode Language Inflection Work Group](https://docs.google.com/document/d/1YWGnMxnJWUC9MFl4j4l8fHeh83ikbpG9_1jCiDCrvIg/edit?usp=sharing) document.
2828

29+
See more details about how to use this library in [API Document](https://unicode-org.github.io/inflection).
2930
### Copyright & Licenses
3031

3132
Copyright © 2024 Unicode, Inc. Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the United States and other countries.

inflection/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ add_custom_target(dist
106106
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
107107
VERBATIM
108108
)
109-
add_dependencies(dist inflection inflection-headers inflection-data)
109+
add_dependencies(dist inflection inflection-headers inflection-data docs)
110110

111111
add_subdirectory(docs EXCLUDE_FROM_ALL)
112112

@@ -119,6 +119,7 @@ make check-headers : Tests whether all exported headers can be compiled
119119
make inflection : Builds the shared library.\\n\
120120
make inflection-headers : Copy all inflection public headers to <build>/inflection_headers.\\n\
121121
make inflection-data : Generate all inflection data under <build>/inflection_data.\\n\
122+
make docs : Generate all inflection docs.\\n\
122123
make dist : Builds inflection, the headers, and the data.\\n\
123124
make coverage : Generates code coverage using sonar-scanner\\n\
124125
make generate-coverage-csv : Generates code coverage as a csv\\n\
@@ -149,6 +150,7 @@ set(CPACK_PACKAGE_VERSION "${INFLECTION_VERSION}")
149150

150151
# Extract version components
151152
string(REPLACE "." ";" INFLECTION_VERSION_LIST "${INFLECTION_VERSION}")
153+
152154
set(CPACK_PACKAGE_VERSION_MAJOR "0")
153155
set(CPACK_PACKAGE_VERSION_MINOR "0")
154156
set(CPACK_PACKAGE_VERSION_PATCH "0")
@@ -178,6 +180,7 @@ set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
178180
set(CPACK_DEBIAN_PACKAGE_VERSION "${INFLECTION_VERSION}")
179181

180182
# Source package config
183+
181184
set(CPACK_SOURCE_GENERATOR "TGZ")
182185
set(CPACK_SOURCE_IGNORE_FILES "/build/;/.git/;/.vscode/;/.idea/")
183186
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${INFLECTION_VERSION}")

inflection/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
22
Copyright 2016-2024 Apple Inc. All rights reserved.
33
-->
4-
# Inflection
4+
# Inflection {#mainpage}
55

66
## About Unicode Inflection
77

@@ -125,4 +125,4 @@ cmake --build . -j8 -t check
125125
Optionally, ICU_ROOT can be specified in the file options.mk with the following type of syntax.
126126
```
127127
ICU_ROOT=<PATH_TO_ICU>
128-
```
128+
```

inflection/docs/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
#
22
# Copyright 2021-2024 Apple Inc. All rights reserved.
33
#
4+
add_custom_target(docs
5+
COMMAND
6+
doxygen ../../docs/Doxyfile
7+
VERBATIM)
8+
add_dependencies(docs inflection-headers)

0 commit comments

Comments
 (0)