2021-01-27 01:02:54 +08:00
|
|
|
name: cmake
|
2021-02-15 22:04:29 +08:00
|
|
|
# cmake build of tesseract and training tools on ubuntu and macOS homebrew using Ninja.
|
2021-02-14 01:20:36 +08:00
|
|
|
# test command line version of tesseract. run basicapitest.
|
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-02-15 22:04:29 +08:00
|
|
|
basictests:
|
2021-01-29 13:07:43 +08:00
|
|
|
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:
|
2021-02-26 17:56:42 +08:00
|
|
|
|
2021-02-15 22:04:29 +08:00
|
|
|
- { name: macos-10.15-clang-12-cmake, os: macos-10.15, cxx: clang++ } # defualt
|
|
|
|
- { name: macos-10.15-clang-11-cmake, os: macos-10.15, cxx: '$(brew --prefix llvm)/bin/clang++' } #installed
|
|
|
|
- { name: macos-10.15-gcc-8-cmake, os: macos-10.15, cxx: g++-8 } #installed
|
|
|
|
- { name: macos-10.15-gcc-9-cmake, os: macos-10.15, cxx: g++-9 } #installed
|
|
|
|
- { name: macos-10.15-gcc-10-cmake, os: macos-10.15, cxx: g++-10 } #installed
|
2021-02-26 17:56:42 +08:00
|
|
|
|
2021-02-15 22:04:29 +08:00
|
|
|
- { name: ubuntu-18.04-clang-7-cmake, os: ubuntu-18.04, cxx: clang++-7 }
|
|
|
|
- { name: ubuntu-18.04-clang-8-cmake, os: ubuntu-18.04, cxx: clang++-8 } #installed
|
|
|
|
- { name: ubuntu-18.04-clang-9-cmake, os: ubuntu-18.04, cxx: clang++-9 } #installed
|
|
|
|
- { name: ubuntu-18.04-clang-10-cmake, os: ubuntu-18.04, cxx: clang++-10 }
|
2021-02-26 17:56:42 +08:00
|
|
|
|
2021-02-15 22:04:29 +08:00
|
|
|
- { name: ubuntu-18.04-gcc-7-cmake, os: ubuntu-18.04, cxx: g++-7 } #installed
|
|
|
|
- { name: ubuntu-18.04-gcc-8-cmake, os: ubuntu-18.04, cxx: g++-8 } #installed
|
|
|
|
- { name: ubuntu-18.04-gcc-9-cmake, os: ubuntu-18.04, cxx: g++-9 } #installed
|
|
|
|
- { name: ubuntu-18.04-gcc-10-cmake, os: ubuntu-18.04, cxx: g++-10 } #installed
|
2021-02-26 17:56:42 +08:00
|
|
|
|
2021-02-15 22:04:29 +08:00
|
|
|
- { name: ubuntu-20.04-clang-7-cmake, os: ubuntu-20.04, cxx: clang++-7 }
|
|
|
|
- { name: ubuntu-20.04-clang-8-cmake, os: ubuntu-20.04, cxx: clang++-8 } #installed
|
|
|
|
- { name: ubuntu-20.04-clang-9-cmake, os: ubuntu-20.04, cxx: clang++-9 } #installed
|
|
|
|
- { name: ubuntu-20.04-clang-10-cmake, os: ubuntu-20.04, cxx: clang++-10 } #installed
|
2021-02-26 17:56:42 +08:00
|
|
|
|
2021-02-15 22:04:29 +08:00
|
|
|
- { name: ubuntu-20.04-gcc-7-cmake, os: ubuntu-20.04, cxx: g++-7 } #installed
|
|
|
|
- { name: ubuntu-20.04-gcc-8-cmake, os: ubuntu-20.04, cxx: g++-8 } #installed
|
|
|
|
- { name: ubuntu-20.04-gcc-9-cmake, os: ubuntu-20.04, cxx: g++-9 } #installed
|
|
|
|
- { name: ubuntu-20.04-gcc-10-cmake, os: ubuntu-20.04, cxx: g++-10 } #installed
|
2021-02-26 17:56:42 +08:00
|
|
|
|
2021-01-24 19:56:15 +08:00
|
|
|
steps:
|
2021-02-02 12:44:45 +08:00
|
|
|
- name: Install compilers on Linux
|
|
|
|
run: |
|
2021-02-15 22:04:29 +08:00
|
|
|
sudo apt-get install ${{ matrix.config.cxx }} -y
|
2021-02-02 12:44:45 +08:00
|
|
|
if: runner.os == 'Linux'
|
2021-02-26 17:56:42 +08:00
|
|
|
|
|
|
|
# sudo apt-get install libarchive-dev libcurl4-openssl-dev libcurl4 curl -y
|
2021-01-29 13:07:43 +08:00
|
|
|
- name: Install dependencies on Linux
|
2021-01-24 19:56:15 +08:00
|
|
|
run: |
|
2021-05-16 13:45:12 +08:00
|
|
|
sudo apt-get install autoconf libleptonica-dev -y
|
2021-05-16 17:14:27 +08:00
|
|
|
sudo apt-get install libpango1.0-dev -y
|
2021-02-14 01:20:36 +08:00
|
|
|
sudo apt-get install cabextract -y
|
|
|
|
sudo apt-get install ninja-build -y
|
2021-01-29 13:07:43 +08:00
|
|
|
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: |
|
2021-05-16 13:45:12 +08:00
|
|
|
brew install autoconf automake
|
2021-02-14 01:20:36 +08:00
|
|
|
brew install leptonica
|
|
|
|
brew install cairo pango icu4c
|
|
|
|
brew install cabextract
|
|
|
|
brew install ninja
|
|
|
|
ninja --version
|
|
|
|
cmake --version
|
2021-01-29 13:07:43 +08:00
|
|
|
if: runner.os == 'macOS'
|
2021-02-26 17:56:42 +08:00
|
|
|
|
2021-01-29 13:07:43 +08:00
|
|
|
- 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-02-26 17:56:42 +08:00
|
|
|
|
2021-02-14 01:20:36 +08:00
|
|
|
- name: Configure Tesseract (Linux)
|
2021-01-24 19:56:15 +08:00
|
|
|
run: |
|
2021-02-14 01:20:36 +08:00
|
|
|
mkdir build
|
|
|
|
mkdir inst
|
|
|
|
cmake \
|
|
|
|
-S . \
|
|
|
|
-B build \
|
|
|
|
-G Ninja \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DOPENMP_BUILD=OFF \
|
|
|
|
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
|
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH=inst
|
2021-01-29 13:07:43 +08:00
|
|
|
if: runner.os == 'Linux'
|
2021-01-24 19:56:15 +08:00
|
|
|
|
2021-02-14 01:20:36 +08:00
|
|
|
- name: Configure Tesseract (macOS)
|
2021-01-29 13:07:43 +08:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2021-02-02 12:44:45 +08:00
|
|
|
set -e
|
2021-02-03 18:32:52 +08:00
|
|
|
export PKG_CONFIG_PATH=$(brew --prefix)/opt/icu4c/lib/pkgconfig:$(brew --prefix)/opt/libarchive/lib/pkgconfig:/$(brew --prefix)/opt/libffi/lib/pkgconfig:$PKG_CONFIG_PATH
|
2021-01-29 13:07:43 +08:00
|
|
|
mkdir build
|
|
|
|
mkdir inst
|
|
|
|
cmake \
|
|
|
|
-S . \
|
|
|
|
-B build \
|
|
|
|
-G Ninja \
|
2021-02-14 01:20:36 +08:00
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DOPENMP_BUILD=OFF \
|
2021-01-29 13:07:43 +08:00
|
|
|
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
|
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH=inst
|
|
|
|
if: runner.os == 'macOS'
|
2021-02-26 17:56:42 +08:00
|
|
|
|
2021-02-14 01:20:36 +08:00
|
|
|
- name: Build Tesseract
|
2021-01-24 19:56:15 +08:00
|
|
|
run: |
|
2021-01-29 13:07:43 +08:00
|
|
|
cmake --build build --config Release --target install
|
2021-02-26 17:56:42 +08:00
|
|
|
|
2021-01-29 13:07:43 +08:00
|
|
|
- name: Display Tesseract Version
|
|
|
|
run: |
|
|
|
|
build/inst/bin/tesseract -v
|
2021-02-26 17:56:42 +08:00
|
|
|
|
2021-02-14 01:20:36 +08:00
|
|
|
- name: Display Training Tools Version
|
|
|
|
run: |
|
|
|
|
build/inst/bin/lstmtraining -v
|
|
|
|
build/inst/bin/text2image -v
|
2021-02-26 17:56:42 +08:00
|
|
|
|
2021-01-29 13:07:43 +08:00
|
|
|
- name: Download fonts, tessdata and langdata required for tests
|
|
|
|
run: |
|
|
|
|
git clone https://github.com/egorpugin/tessdata tessdata_unittest
|
2021-02-26 17:56:42 +08:00
|
|
|
cp tessdata_unittest/fonts/* test/testing/
|
2021-01-29 13:07:43 +08:00
|
|
|
mv tessdata_unittest/* ../
|
2021-02-26 17:56:42 +08:00
|
|
|
|
2021-02-14 01:20:36 +08:00
|
|
|
- name: List languages in different tessdata-dir
|
2021-01-29 13:07:43 +08:00
|
|
|
run: |
|
2021-02-14 01:20:36 +08:00
|
|
|
build/inst/bin/tesseract --list-langs --tessdata-dir ../tessdata
|
|
|
|
build/inst/bin/tesseract --list-langs --tessdata-dir ../tessdata_best
|
|
|
|
build/inst/bin/tesseract --list-langs --tessdata-dir ../tessdata_fast
|
2021-02-26 17:56:42 +08:00
|
|
|
|
2021-02-14 01:20:36 +08:00
|
|
|
- name: Run Tesseract on test images in different languages
|
2021-01-24 19:56:15 +08:00
|
|
|
run: |
|
2021-02-14 01:20:36 +08:00
|
|
|
build/inst/bin/tesseract test/testing/phototest.tif - --oem 1 --tessdata-dir ../tessdata
|
|
|
|
build/inst/bin/tesseract test/testing/raaj.tif - -l hin --oem 1 --tessdata-dir ../tessdata
|
|
|
|
build/inst/bin/tesseract test/testing/viet.tif - -l vie --oem 1 --tessdata-dir ../tessdata
|
|
|
|
build/inst/bin/tesseract test/testing/hebrew.png - -l heb --oem 1 --tessdata-dir ../tessdata
|
|
|
|
build/inst/bin/tesseract test/testing/eurotext.tif - -l fra --oem 1 --tessdata-dir ../tessdata_best
|
|
|
|
build/inst/bin/tesseract test/testing/arabic.tif - -l ara --oem 1 --psm 6 --tessdata-dir ../tessdata
|
2021-02-26 17:56:42 +08:00
|
|
|
|
2021-02-14 01:20:36 +08:00
|
|
|
- name: Build and run basicapitest
|
|
|
|
run: |
|
|
|
|
export "PKG_CONFIG_PATH=$GITHUB_WORKSPACE/build/inst/lib/pkgconfig/:$PKG_CONFIG_PATH"
|
|
|
|
cd test
|
2021-02-26 17:56:42 +08:00
|
|
|
${{ matrix.config.cxx }} -o basicapitest testing/basicapitest.cpp "-I$GITHUB_WORKSPACE/build/inst/include" "-L$GITHUB_WORKSPACE/build/inst/lib" `pkg-config --cflags --libs tesseract lept ` -pthread -std=c++11
|
2021-02-14 01:20:36 +08:00
|
|
|
./basicapitest
|
2021-02-26 17:56:42 +08:00
|
|
|
|
2021-01-29 13:07:43 +08:00
|
|
|
- name: Display Compiler Version
|
2021-01-24 19:56:15 +08:00
|
|
|
run: |
|
2021-01-29 13:07:43 +08:00
|
|
|
${{ matrix.config.cxx }} --version
|
2021-02-26 17:56:42 +08:00
|
|
|
git log -3 --pretty=format:'%h %ad %s | %an'
|
2021-01-29 13:07:43 +08:00
|
|
|
if: always()
|
2021-02-14 01:20:36 +08:00
|
|
|
|