|
| 1 | +# ---------------------------------------------------------------------------------------- |
| 2 | +# To update ICU version: |
| 3 | +# 1. Update the ICU_VERSION environment variable below. |
| 4 | +# 2. Check the ICU binary URL — is the filename still Ubuntu22.04-x64.tgz? |
| 5 | +# (e.g., icu4c-78_1-Ubuntu22.04-x64.tgz) |
| 6 | +# 3. Update inflection/CMakeLists.txt: |
| 7 | +# - Modify `CPACK_DEBIAN_PACKAGE_DEPENDS` to match the new ICU version. |
| 8 | +# ---------------------------------------------------------------------------------------- |
| 9 | + |
| 10 | +name: Build & Package (Ubuntu) |
| 11 | + |
| 12 | +on: |
| 13 | + push: |
| 14 | + tags: |
| 15 | + - 'v*' |
| 16 | + workflow_dispatch: |
| 17 | + |
| 18 | +jobs: |
| 19 | + build-and-package: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + env: |
| 22 | + ICU_VERSION: 77_1 |
| 23 | + steps: |
| 24 | + - name: Checkout |
| 25 | + uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + lfs: true |
| 28 | + |
| 29 | + - name: Setup Git LFS |
| 30 | + run: | |
| 31 | + git lfs install |
| 32 | + git lfs pull |
| 33 | +
|
| 34 | + - name: Install system dependencies |
| 35 | + run: | |
| 36 | + sudo apt update |
| 37 | + sudo apt install -y cmake build-essential clang pkg-config |
| 38 | +
|
| 39 | + - name: Cache ICU |
| 40 | + uses: actions/cache@v4 |
| 41 | + id: cache-icu |
| 42 | + with: |
| 43 | + path: /usr/local |
| 44 | + key: icu-${{ env.ICU_VERSION }}-ubuntu-${{ runner.os }} |
| 45 | + |
| 46 | + - name: Install ICU (Binary) |
| 47 | + if: steps.cache-icu.outputs.cache-hit != 'true' |
| 48 | + run: | |
| 49 | + cd /tmp |
| 50 | + wget https://github.com/unicode-org/icu/releases/download/release-${ICU_VERSION//_/-}/icu4c-${ICU_VERSION}-Ubuntu22.04-x64.tgz |
| 51 | + mkdir icu-install |
| 52 | + tar -xzf icu4c-${ICU_VERSION}-Ubuntu22.04-x64.tgz -C icu-install |
| 53 | + sudo cp -r icu-install/icu/usr/local/* /usr/local/ |
| 54 | + sudo ldconfig |
| 55 | +
|
| 56 | + - name: Setup ICU (from cache) |
| 57 | + if: steps.cache-icu.outputs.cache-hit == 'true' |
| 58 | + run: | |
| 59 | + sudo ldconfig |
| 60 | +
|
| 61 | + - name: Configure & Build |
| 62 | + run: | |
| 63 | + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH |
| 64 | + export CPLUS_INCLUDE_PATH=/usr/local/include:$CPLUS_INCLUDE_PATH |
| 65 | + mkdir -p inflection/build |
| 66 | + cd inflection/build |
| 67 | + CC=clang CXX=clang++ cmake .. \ |
| 68 | + -DCMAKE_BUILD_TYPE=Release \ |
| 69 | + -DICU_ROOT=/usr/local \ |
| 70 | + -DCMAKE_PREFIX_PATH=/usr/local |
| 71 | + make -j$(nproc) |
| 72 | +
|
| 73 | + - name: Run tests |
| 74 | + run: | |
| 75 | + cd inflection/build |
| 76 | + make -j$(nproc) check |
| 77 | +
|
| 78 | + - name: Package with CPack |
| 79 | + run: | |
| 80 | + cd inflection/build |
| 81 | + cpack |
| 82 | + ls -la *.deb *.tar.gz |
| 83 | +
|
| 84 | + - name: Upload release artifacts |
| 85 | + uses: actions/upload-artifact@v4 |
| 86 | + with: |
| 87 | + name: ubuntu-release-artifacts |
| 88 | + path: | |
| 89 | + inflection/build/*.deb |
| 90 | + inflection/build/*.tar.gz |
| 91 | + retention-days: 30 |
| 92 | + |
| 93 | + - name: Upload to GitHub Release |
| 94 | + uses: softprops/action-gh-release@v2 |
| 95 | + if: startsWith(github.ref, 'refs/tags/') |
| 96 | + with: |
| 97 | + name: "Release ${{ github.ref_name }}" |
| 98 | + files: | |
| 99 | + inflection/build/*.deb |
| 100 | + inflection/build/*.tar.gz |
| 101 | + env: |
| 102 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 103 | + |
0 commit comments