tesseract/.github/workflows/cmake.yml

155 lines
6.2 KiB
YAML
Raw Normal View History

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.
# 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:
- { name: macos-14-clang-15-cmake, os: macos-14, cxx: clang++ } # default
- { name: macos-14-gcc-14-cmake, os: macos-14, cxx: g++-14 } #installed
- { name: macos-15-clang-cmake, os: macos-15, cxx: clang++ } # default
2023-09-06 00:27:26 +08:00
- { name: ubuntu-22.04-clang-15-cmake, os: ubuntu-22.04, cxx: clang++-15 } #installed
2023-03-08 21:16:15 +08:00
- { name: ubuntu-22.04-gcc-12-cmake, os: ubuntu-22.04, cxx: g++-12 } #installed
- { name: ubuntu-22.04-gcc-11-cmake, os: ubuntu-22.04, cxx: g++-11 } #installed
2021-02-15 22:04:29 +08:00
- { name: ubuntu-20.04-gcc-10-cmake, os: ubuntu-20.04, cxx: g++-10 } #installed
2023-03-08 21:16:15 +08:00
- { name: ubuntu-20.04-gcc-9-cmake, os: ubuntu-20.04, cxx: g++-9 } #installed
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 update
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-01-29 13:07:43 +08:00
- name: Install dependencies on Linux
2021-01-24 19:56:15 +08:00
run: |
sudo apt-get install autoconf libleptonica-dev -y
sudo apt-get install libarchive-dev libcurl4-openssl-dev -y
sudo apt-get install libpango1.0-dev -y
sudo apt-get install cabextract -y
sudo apt-get install ninja-build -y
cmake --version
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: |
brew install autoconf automake
brew install leptonica
# brew install libarchive
brew install pango
brew install icu4c && brew link icu4c
brew install cabextract
brew install ninja
ninja --version
cmake --version
clang++ --version
g++ --version
2021-01-29 13:07:43 +08:00
if: runner.os == 'macOS'
2021-01-29 13:07:43 +08:00
- name: Checkout Source
uses: actions/checkout@v4
2021-01-29 13:07:43 +08:00
with:
submodules: recursive
- name: Configure Tesseract (Linux)
2021-01-24 19:56:15 +08:00
run: |
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
- 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
export LDFLAGS="-L/usr/local/opt/icu4c/lib"
export CPPFLAGS="-I/usr/local/opt/icu4c/include"
2021-01-29 13:07:43 +08:00
mkdir build
mkdir inst
cmake \
-S . \
-B build \
-G Ninja \
-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'
- 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-01-29 13:07:43 +08:00
- name: Display Tesseract Version
run: |
build/inst/bin/tesseract -v
- name: Display Training Tools Version
run: |
build/inst/bin/lstmtraining -v
build/inst/bin/text2image -v
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
cp tessdata_unittest/fonts/* test/testing/
2021-01-29 13:07:43 +08:00
mv tessdata_unittest/* ../
- name: List languages in different tessdata-dir
2021-01-29 13:07:43 +08:00
run: |
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
- name: Run Tesseract on test images in different languages
2021-01-24 19:56:15 +08:00
run: |
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
- name: Build and run basicapitest (Linux)
run: |
export "PKG_CONFIG_PATH=$GITHUB_WORKSPACE/build/inst/lib/pkgconfig/:$PKG_CONFIG_PATH"
cd test
2024-06-12 01:25:15 +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 libarchive libcurl) -pthread -std=c++17
./basicapitest
if: runner.os == 'Linux'
- name: Build and run basicapitest (macOS)
run: |
export "PKG_CONFIG_PATH=$GITHUB_WORKSPACE/build/inst/lib/pkgconfig/:$(brew --prefix)/opt/libarchive/lib/pkgconfig:$(brew --prefix)/Library/Homebrew/os/mac/pkgconfig/11:$PKG_CONFIG_PATH"
cd test
2024-06-12 01:25:15 +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 libcurl) -pthread -std=c++17
./basicapitest
if: runner.os == 'macOS'
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
2023-03-01 19:44:17 +08:00
pwd
ls -la
# git log -3 --pretty=format:'%h %ad %s | %an'
2021-01-29 13:07:43 +08:00
if: always()