Inflection 77: Adding C and C++ API for stating source grammemes and tests for the same. #101
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Doxygen | |
| on: | |
| # Keep it for manual runs. | |
| workflow_dispatch: | |
| # Run the build when we merge into main | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'inflection/**' | |
| - '.github/workflows/**' | |
| pull_request: | |
| paths: | |
| - 'inflection/**' | |
| - '.github/workflows/**' | |
| - '!data/**' | |
| - '!documents/**' | |
| - '!fst/**' | |
| env: | |
| ICU_MAJOR: '77' | |
| ICU_MINOR: '1' | |
| jobs: | |
| cache-icu: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/cache/restore@v4 | |
| id: cache | |
| with: | |
| path: ~/icu | |
| key: ${{ runner.os }}-icu-${{ env.ICU_MAJOR }}-${{ env.ICU_MINOR }} | |
| - name: Download and install icu | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: | | |
| wget https://github.com/unicode-org/icu/releases/download/release-${ICU_MAJOR}-${ICU_MINOR}/icu4c-${ICU_MAJOR}_${ICU_MINOR}-Ubuntu22.04-x64.tgz | |
| export ICU=~/icu/ | |
| mkdir -p $ICU | |
| echo "ICU directory is $ICU" | |
| # Get the release and unpack. | |
| cp icu4c-${ICU_MAJOR}_${ICU_MINOR}-Ubuntu22.04-x64.tgz $ICU | |
| pushd $ICU | |
| pwd | |
| tar xvfz *.tgz | |
| rm *.tgz | |
| - uses: actions/cache/save@v4 | |
| with: | |
| path: ~/icu | |
| key: ${{ runner.os }}-icu-${{ env.ICU_MAJOR }}-${{ env.ICU_MINOR }} | |
| doxygen: | |
| needs: cache-icu | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: write | |
| strategy: | |
| # 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. | |
| fail-fast: false | |
| # Set up a matrix to run the following configurations: | |
| # 1. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator> | |
| # | |
| # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. | |
| matrix: | |
| os: [ubuntu-latest] | |
| build_type: [Release] | |
| c_compiler: [clang] | |
| # All [OS x compiler] items should be covered in include/exclude sections. | |
| include: | |
| - os: ubuntu-latest | |
| c_compiler: clang | |
| cpp_compiler: clang++ | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create Git LFS file list | |
| run: git lfs ls-files -l |cut -d' ' -f1 |sort >.git/lfs-hashes.txt | |
| - name: Restore Git LFS object cache | |
| uses: actions/cache@v4 | |
| id: lfscache | |
| with: | |
| path: inflection/resources/org/unicode/inflection/dictionary | |
| key: ${{ runner.os }}-lfsdata-v1-${{ hashFiles('.git/lfs-hashes.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-lfsdata-v1- | |
| ${{ runner.os }}-lfsdata | |
| - name: Fetch any needed Git LFS objects and prune extraneous ones | |
| if: steps.lfscache.outputs.cache-hit != 'true' | |
| run: git lfs fetch --prune | |
| - name: Check out Git LFS content | |
| if: steps.lfscache.outputs.cache-hit != 'true' | |
| run: git lfs checkout | |
| - name: Check LFS restore the files or not after checkout | |
| run: ls -l inflection/resources/org/unicode/inflection/dictionary/* | |
| - name: Set reusable strings | |
| # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. | |
| id: strings | |
| shell: bash | |
| run: | | |
| echo "project-root-dir=${{ github.workspace }}/inflection" >> "$GITHUB_OUTPUT" | |
| echo "build-output-dir=${{ github.workspace }}/inflection/build" >> "$GITHUB_OUTPUT" | |
| - uses: actions/cache/restore@v4 | |
| id: cache | |
| with: | |
| path: ~/icu | |
| key: ${{ runner.os }}-icu-${{ env.ICU_MAJOR }}-${{ env.ICU_MINOR }} | |
| # Install all the required dependencies | |
| - name: Install ICU (Ubuntu) | |
| run: | | |
| echo "ICU_ROOT=~/icu/icu/usr/local" >> $GITHUB_ENV | |
| - name: Configure CMake | |
| # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
| # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
| run: > | |
| cmake -B ${{ steps.strings.outputs.build-output-dir }} | |
| -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} | |
| -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
| -S ${{ steps.strings.outputs.project-root-dir }} | |
| - name: Get number of CPU cores | |
| uses: SimenB/github-actions-cpu-cores@v2 | |
| id: cpu-cores | |
| # copy from https://github.com/DenverCoder1/doxygen-github-pages-action/blob/main/action.yml | |
| - name: Install dependencies | |
| run: sudo apt-get update && sudo apt-get install -y wget graphviz doxygen | |
| shell: bash | |
| - name: Build and install header | |
| # 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). | |
| run: | | |
| cmake --build ${{ steps.strings.outputs.build-output-dir }} -t docs --config ${{ matrix.build_type }} -j ${{ steps.cpu-cores.outputs.count }} | |
| - name: Create .nojekyll (ensures pages with underscores work on gh pages) | |
| run: touch ${{ steps.strings.outputs.build-output-dir }}/docs/html/.nojekyll | |
| shell: bash | |
| - name: Deploy to GitHub Pages | |
| # only deploy when we merge into main branch | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| folder: ${{ steps.strings.outputs.build-output-dir }}/docs/html |