Skip to content

CI: github actions ensure compiler support #592

CI: github actions ensure compiler support

CI: github actions ensure compiler support #592

Workflow file for this run

on: [push, pull_request]
name: Multi-platform Compatibility Test
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-2019]
python-version: ['3.8' ,'3.9', '3.10', '3.11']
include:
- os: macos-latest
compiler_version: 14.0
compiler_libcxx: libc++
- os: ubuntu-latest
compiler_version: 11.4
compiler_libcxx: libstdc++11
- os: windows-2019
compiler_version: 16
fail-fast: false
name: Python ${{ matrix.python-version }} ${{ matrix.os }} build
steps:
- uses: actions/github-script@v6
id: conan-path-script
with:
result-encoding: string
script: |
if ('${{matrix.os}}' === 'windows-2019'){
return 'C:/Users/runneradmin'
}
if ('${{matrix.os}}' === 'ubuntu-latest'){
return '/home/runner'
}
if ('${{matrix.os}}' === 'macos-latest'){
return '/Users/runner'
}
return ''
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
cache-dependency-path: |
requirements-ci.txt
requirements/requirements-*.txt
- run: |
pip install wheel
pip install -r requirements-ci.txt
- uses: actions/cache@v3
id: cache
with:
path: "${{ matrix.conan_user_home }}/.conan"
key: ${{ runner.os }}-${{ hashFiles('**/conanfile.py') }}
- name: Ensure conan settings has current compiler as valid
if: "!contains(matrix.os, 'windows')"
env:
CONAN_USER_HOME: "${{steps.conan-path-script.outputs.result}}"
run: |
conan config init
python ci/docker/shared/conan/ensure_compiler_support_by_conan.py $(conan config home)/settings.yml ${{matrix.compiler_version}}
conan profile update settings.compiler.version=${{matrix.compiler_version}} default
- name: Prebuild Conan packages (Windows)
if: |
contains(matrix.os, 'windows') && steps.cache-conan.outputs.cache-hit != 'true'
shell: cmd
env:
CONAN_USER_HOME: "${{steps.conan-path-script.outputs.result}}"
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
conan profile new default --detect
conan config set general.revisions_enabled=1
conan install . --build missing --build=openjpeg --no-import -pr:b=default
- name: Prebuild Conan packages
env:
CONAN_USER_HOME: "${{steps.conan-path-script.outputs.result}}"
if: "!contains(matrix.os, 'windows') && steps.cache-conan.outputs.cache-hit != 'true'"
run: |
conan config set general.revisions_enabled=1
conan install . --build missing --build=openjpeg -pr:b=default
$(conan info $(pwd)/conanfile.py --paths --package-filter="tesseract/*" | grep package_folder: | sed -e 's/[ \t]*package_folder: //' -e "s/$/\/bin\/tesseract/") --version > $(pwd)/results.txt && \
cat $(pwd)/results.txt && \
if grep -q libopenjp2 $(pwd)/results.txt; then echo "libopenjp2 check successful"; else >&2 echo "Tesseract was not built with openjpeg " ; exit 1; fi
- name: Run tox on Windows
if: contains(matrix.os, 'windows')
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
tox -e py
env:
CONAN_USER_HOME: "${{steps.conan-path-script.outputs.result}}"
- name: Run tox on Non-Windows Operating Systems
if: "!contains(matrix.os, 'windows')"
run: tox -e py -vvv
env:
CONAN_COMPILER_VERSION: ${{ matrix.compiler_version }}
CONAN_COMPILER_LIBCXX: ${{ matrix.compiler_libcxx }}
CONAN_USER_HOME: "${{steps.conan-path-script.outputs.result}}"