tesseract/.github/workflows/cmake.yml

116 lines
4.9 KiB
YAML
Raw Normal View History

2021-01-27 01:02:54 +08:00
name: cmake
# cmake build of tesseract and training tools with gcc on ubuntu.
2021-01-29 13:07:43 +08:00
# cmake build of tesseract and training tools macos homebrew using Ninja.
2021-02-02 12:44:45 +08:00
# test command line version of tesseract.
2021-01-24 19:56:15 +08:00
on:
#push:
schedule:
2021-01-27 01:02:54 +08:00
- cron: 0 21 * * *
2021-01-24 19:56:15 +08:00
jobs:
2021-01-29 13:07:43 +08:00
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
2021-01-24 19:56:15 +08:00
strategy:
fail-fast: false
matrix:
2021-01-29 13:07:43 +08:00
config:
- { name: macos-10.15-clang-cmake-build, os: macos-10.15, cc: clang, cxx: clang++ }
2021-02-02 12:44:45 +08:00
- { name: macos-10.15-gcc-cmake-build, os: macos-10.15, cc: gcc, cxx: g++ }
- { name: ubuntu-18.04-clang-7-cmake-build, os: ubuntu-18.04, cc: clang-7, cxx: clang++-7 }
- { name: ubuntu-18.04-clang-8-cmake-build, os: ubuntu-18.04, cc: clang-8, cxx: clang++-8 }
- { name: ubuntu-18.04-clang-9-cmake-build, os: ubuntu-18.04, cc: clang-9, cxx: clang++-9 }
- { name: ubuntu-18.04-clang-10-cmake-build, os: ubuntu-18.04, cc: clang-10, cxx: clang++-10 }
- { name: ubuntu-18.04-gcc-7-cmake-build, os: ubuntu-18.04, cc: gcc-7, cxx: g++-7 }
- { name: ubuntu-18.04-gcc-8-cmake-build, os: ubuntu-18.04, cc: gcc-8, cxx: g++-8 }
- { name: ubuntu-18.04-gcc-9-cmake-build, os: ubuntu-18.04, cc: gcc-9, cxx: g++-9 }
- { name: ubuntu-18.04-gcc-10-cmake-build, os: ubuntu-18.04, cc: gcc-10, cxx: g++-10 }
- { name: ubuntu-20.04-clang-7-cmake-build, os: ubuntu-20.04, cc: clang-7, cxx: clang++-7 }
- { name: ubuntu-20.04-clang-8-cmake-build, os: ubuntu-20.04, cc: clang-8, cxx: clang++-8 }
- { name: ubuntu-20.04-clang-9-cmake-build, os: ubuntu-20.04, cc: clang-9, cxx: clang++-9 }
- { name: ubuntu-20.04-clang-10-cmake-build, os: ubuntu-20.04, cc: clang-10, cxx: clang++-10 }
- { name: ubuntu-20.04-gcc-7-cmake-build, os: ubuntu-20.04, cc: gcc-7, cxx: g++-7 }
- { name: ubuntu-20.04-gcc-8-cmake-build, os: ubuntu-20.04, cc: gcc-8, cxx: g++-8 }
- { name: ubuntu-20.04-gcc-9-cmake-build, os: ubuntu-20.04, cc: gcc-9, cxx: g++-9 }
- { name: ubuntu-20.04-gcc-10-cmake-build, os: ubuntu-20.04, cc: gcc-10, cxx: g++-10 }
2021-01-24 19:56:15 +08:00
steps:
2021-02-02 12:44:45 +08:00
- name: Install compilers on Linux
run: |
sudo apt-get install ${{ matrix.config.cc }} ${{ matrix.config.cxx }} -y
if: runner.os == 'Linux'
2021-01-29 13:07:43 +08:00
- name: Install dependencies on Linux
2021-01-24 19:56:15 +08:00
run: |
2021-01-29 13:07:43 +08:00
sudo apt-get install libleptonica-dev libpango1.0-dev -y
if: runner.os == 'Linux'
2021-01-24 19:56:15 +08:00
2021-02-02 12:44:45 +08:00
- name: Install dependencies on macOS
2021-01-29 13:07:43 +08:00
run: |
brew install cmake ninja leptonica pango libarchive icu4c
ninja --version
cmake --version
if: runner.os == 'macOS'
- name: Checkout Source
2021-01-24 19:56:15 +08:00
uses: actions/checkout@v2
2021-01-29 13:07:43 +08:00
with:
submodules: recursive
2021-01-24 19:56:15 +08:00
2021-01-29 13:07:43 +08:00
- name: Configure (Linux)
2021-01-24 19:56:15 +08:00
run: |
mkdir build && cd build
2021-01-29 13:07:43 +08:00
cmake -DCMAKE_CC_COMPILER=${{ matrix.config.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
-DCMAKE_INSTALL_PREFIX=inst \
2021-01-24 19:56:15 +08:00
-DCMAKE_BUILD_TYPE=Release ..
2021-01-29 13:07:43 +08:00
if: runner.os == 'Linux'
2021-01-24 19:56:15 +08:00
2021-01-29 13:07:43 +08:00
- name: Configure (macOS)
shell: bash
run: |
2021-02-02 12:44:45 +08:00
set -e
export PKG_CONFIG_PATH=/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/libarchive/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig:$PKG_CONFIG_PATH
2021-01-29 13:07:43 +08:00
mkdir build
mkdir inst
cmake \
-S . \
-B build \
-DCMAKE_BUILD_TYPE=Release \
-G Ninja \
-DCMAKE_C_COMPILER=${{ matrix.config.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
-DCMAKE_INSTALL_PREFIX:PATH=inst
if: runner.os == 'macOS'
2021-01-24 19:56:15 +08:00
- name: Build
run: |
2021-01-29 13:07:43 +08:00
cmake --build build --config Release --target install
2021-01-24 19:56:15 +08:00
2021-01-29 13:07:43 +08:00
- name: Display Tesseract Version
run: |
build/inst/bin/tesseract -v
- name: Download fonts, tessdata and langdata required for tests
run: |
git clone https://github.com/egorpugin/tessdata tessdata_unittest
cp tessdata_unittest/fonts/* test/testing/
mv tessdata_unittest/* ../
- name: Run Tesseract on phototest.tif and raaj.tif
run: |
build/inst/bin/tesseract test/testing/phototest.tif - --tessdata-dir ../tessdata
build/inst/bin/tesseract test/testing/raaj.tif - -l hin --tessdata-dir ../tessdata
2021-01-24 19:56:15 +08:00
2021-02-02 12:44:45 +08:00
- name: Display Training Tools Version
2021-01-24 19:56:15 +08:00
run: |
2021-01-29 13:07:43 +08:00
build/inst/bin/lstmtraining -v
build/inst/bin/text2image -v
- name: Display Compiler Version
2021-01-24 19:56:15 +08:00
run: |
2021-01-29 13:07:43 +08:00
${{ matrix.config.cc }} --version
${{ matrix.config.cxx }} --version
git log -3 --pretty=format:'%h %ad %s | %an'
if: always()