Inflection 77: Adding C and C++ API for stating source grammemes and tests for the same. #238
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: Check memory leak by using valgrind | |
| on: | |
| # Keep it for manual runs. | |
| workflow_dispatch: | |
| # Run it on all branches but ignore some paths. | |
| pull_request: | |
| paths: | |
| - 'inflection/**' | |
| - '.github/workflows/**' | |
| - '!data/**' | |
| - '!documents/**' | |
| - '!fst/**' | |
| # Run the build when we merge into main | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '.github/workflows/**' | |
| - 'inflection/**' | |
| 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 }} | |
| checkleak: | |
| needs: cache-icu | |
| runs-on: ubuntu-latest | |
| 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 | |
| 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 | |
| id: lfscache | |
| uses: actions/cache@v4 | |
| 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" | |
| - name: Install valgrind | |
| run: | | |
| set -ex; | |
| sudo apt-get -y update; | |
| sudo apt-get install -y valgrind; | |
| - uses: actions/cache/restore@v4 | |
| id: cache | |
| with: | |
| path: ~/icu | |
| key: ${{ runner.os }}-icu-${{ env.ICU_MAJOR }}-${{ env.ICU_MINOR }} | |
| - name: Setup ICU_ROOT | |
| 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=clang++ | |
| -DCMAKE_C_COMPILER=clang | |
| -DCMAKE_BUILD_TYPE=Debug | |
| -S ${{ steps.strings.outputs.project-root-dir }} | |
| - name: Get number of CPU cores | |
| uses: SimenB/github-actions-cpu-cores@v2 | |
| id: cpu-cores | |
| - name: Build | |
| # 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 }} --config Debug -j ${{ steps.cpu-cores.outputs.count }} | |
| - name: Test with valgrind | |
| env: | |
| TEST_RUN_COMMAND: "valgrind --leak-check=full --show-leak-kinds=definite --errors-for-leak-kinds=definite --error-exitcode=1" | |
| working-directory: ${{ steps.strings.outputs.build-output-dir }} | |
| run: | |
| cmake --build . -t check -j ${{ steps.cpu-cores.outputs.count }} | |