feat(android): build native libs via CMake presets into jniLibs #11
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: Runtime Build | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| paths: | |
| - "runtime/**" | |
| # Android has its own workflow; don't rebuild the desktop runtime for | |
| # Android-only changes (shared processor/utils/cmake still match above). | |
| - "!runtime/android/**" | |
| - "!runtime/bindings/android/**" | |
| - ".github/workflows/runtime.yml" | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build runtime | |
| run: | | |
| cmake -B build -G Ninja -S runtime -DBUILD_TESTING=ON | |
| cmake --build build --parallel | |
| - uses: actions/setup-python@v5 | |
| if: matrix.os == 'ubuntu-latest' | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies & Generate TN models | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| pip install pynini importlib_resources | |
| python -m tn --language zh --overwrite_cache | |
| - name: Run tests | |
| if: matrix.os == 'ubuntu-latest' | |
| run: ctest --test-dir build/test --output-on-failure | |
| build-windows: | |
| name: build (windows-latest) | |
| runs-on: windows-latest | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| update: false | |
| cache: true | |
| install: >- | |
| mingw-w64-x86_64-cmake | |
| mingw-w64-x86_64-gcc | |
| mingw-w64-x86_64-ninja | |
| - name: Build runtime | |
| run: | | |
| cmake --version | |
| gcc --version | |
| # Tests are skipped on Windows: processor_test needs zh_tn_*.fst, which | |
| # are generated via pynini, and pynini has no Windows build. | |
| cmake -S runtime -B build -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DBUILD_TESTING=OFF | |
| cmake --build build --parallel |