Skip to content

Commit

Permalink
Merge pull request #136 from UIUCLibrary/dev
Browse files Browse the repository at this point in the history
update test files url
  • Loading branch information
henryborchers authored Aug 16, 2023
2 parents 043d930 + e54b952 commit ecb6460
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 34 deletions.
79 changes: 47 additions & 32 deletions .github/workflows/tox_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,73 +11,88 @@ jobs:
- os: macos-latest
compiler_version: 14.0
compiler_libcxx: libc++
conan_user_home: "/Users/runner"
- os: ubuntu-latest
compiler_version: 11.3
compiler_version: 11.4
compiler_libcxx: libstdc++11
conan_user_home: "/home/runner"
- os: windows-2019
compiler_version: 16
conan_user_home: 'C:/Users/runneradmin'
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-dev.txt'
cache-dependency-path: |
requirements-ci.txt
requirements/requirements-*.txt
- run: |
pip install wheel
pip install -r requirements-dev.txt
pip install -r requirements-ci.txt
- uses: actions/cache@v3
id: cache
id: cache-conan
with:
path: "${{ matrix.conan_user_home }}/.conan"
key: ${{ runner.os }}-${{ hashFiles('**/conanfile.py') }}
path: "${{steps.conan-path-script.outputs.result}}/.conan"
key: ${{ runner.os }}-compiler-${{ matrix.compiler_version}} ${{ 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: Build conan packages on Windows
if: ${{ contains(matrix.os, 'windows') && steps.cache.outputs.cache-hit != 'true' }}
- 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"
pip install -r requirements/requirements-conan.txt
conan config init
conan config set general.revisions_enabled=1
conan profile new default --detect
conan install . --build missing --no-import -pr:b=default
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: ${{ matrix.conan_user_home }}
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 --no-import -pr:b=default
- 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: ${{ matrix.conan_user_home }}
CONAN_USER_HOME: "${{steps.conan-path-script.outputs.result}}"

- name: Build conan packages on Non-Windows Operating Systems
if: ${{ !contains(matrix.os, 'windows') && steps.cache.outputs.cache-hit != 'true' }}
run: |
cc --version && cc -dumpfullversion -dumpversion
pip install -r requirements/requirements-conan.txt
if conan profile show default; then echo 'profile exists'; else conan profile new default --detect; fi
conan config init
conan config set general.revisions_enabled=1
if [[ -z "$CONAN_COMPILER_LIBCXX" ]]; then echo 'CONAN_COMPILER_LIBCXX is not defined'; else conan profile update settings.compiler.libcxx=$CONAN_COMPILER_LIBCXX default; fi
conan install . --build missing --build openjpeg --no-import -pr:b=default
env:
CONAN_COMPILER_VERSION: ${{ matrix.compiler_version }}
CONAN_COMPILER_LIBCXX: ${{ matrix.compiler_libcxx }}
CONAN_USER_HOME: ${{ matrix.conan_user_home }}
- 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: ${{ matrix.conan_user_home }}
CONAN_USER_HOME: "${{steps.conan-path-script.outputs.result}}"


23 changes: 23 additions & 0 deletions ci/docker/shared/conan/ensure_compiler_support_by_conan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import yaml
import argparse

def get_arg_parser():
parser = argparse.ArgumentParser()
parser.add_argument("settings")
parser.add_argument("compiler_version")
return parser


def main():
parser = get_arg_parser()
args = parser.parse_args()
with open(args.settings) as fp:
data = yaml.safe_load(fp)
if args.compiler_version not in data['compiler']['gcc']['version']:
data['compiler']['gcc']['version'].append(args.compiler_version)
with open(args.settings, "w") as fp:
yaml.dump(data, fp)
print(f"Updated {args.settings}")

if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(TEST_FILES_BASE_URL "https://jenkins.library.illinois.edu/nexus/repository/sample-data/ocr_test_images")
set(TEST_FILES_BASE_URL "https://nexus.library.illinois.edu/repository/sample-data/ocr_test_images")

list(APPEND test_image_files blankpage.tif)
list(APPEND test_image_files engwithheadings.tif)
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pytest

USER_CONTENT_URL = "https://jenkins.library.illinois.edu/nexus/repository/sample-data/ocr_test_images"
USER_CONTENT_URL = "https://nexus.library.illinois.edu/repository/sample-data/ocr_test_images"
TESSDATA_SOURCE_URL = "https://github.com/tesseract-ocr/tessdata/raw/main/"


Expand Down

0 comments on commit ecb6460

Please sign in to comment.