|
| 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 |
0 commit comments