| 1 | name: CMake |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [master] |
| 6 | pull_request: |
| 7 | branches: [master] |
| 8 | |
| 9 | concurrency: |
| 10 | group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | cancel-in-progress: true |
| 12 | |
| 13 | jobs: |
| 14 | build-and-test: |
| 15 | permissions: |
| 16 | contents: read |
| 17 | runs-on: ${{ matrix.os }} |
| 18 | strategy: |
| 19 | matrix: |
| 20 | os: [ubuntu-latest, macos-latest, macos-14] |
| 21 | steps: |
| 22 | - uses: actions/checkout@v5 |
| 23 | with: |
| 24 | fetch-depth: 0 |
| 25 | - name: Compute version |
| 26 | id: version |
| 27 | shell: bash |
| 28 | run: | |
| 29 | VERSION=$(bash scripts/compute-version.sh) |
| 30 | echo "VERSION=$VERSION" >> "$GITHUB_ENV" |
| 31 | echo "version=$VERSION" >> "$GITHUB_OUTPUT" |
| 32 | echo "Computed version: $VERSION" |
| 33 | - name: make build |
| 34 | run: make build VERBOSE=1 REL_BUILD_DOCUMENTATION=OFF |
| 35 | - name: make test |
| 36 | run: make test VERBOSE=1 |
| 37 | - name: make benchmark |
| 38 | run: make benchmark VERBOSE=1 |
| 39 | - name: Test standalone plugin build |
| 40 | run: | |
| 41 | make PREFIX=$PWD/install install VERBOSE=1 |
| 42 | cmake -S plugins/jieba -B build-standalone \ |
| 43 | -DCMAKE_BUILD_TYPE=Release \ |
| 44 | -DOpenCC_DIR=$PWD/install/lib/cmake/opencc |
| 45 | cmake --build build-standalone |
| 46 | - name: upload artifacts |
| 47 | if: ${{ always() }} |
| 48 | uses: actions/upload-artifact@v7 |
| 49 | with: |
| 50 | name: opencc-${{ env.VERSION }}-cmake-${{ matrix.os }} |
| 51 | path: | |
| 52 | build/rel/** |
| 53 | build/dbg/** |
| 54 | build/perf/** |