|
| 1 | +# This workflow will install the package as is on the github default branch using pip |
| 2 | + |
| 3 | +name: pip Install |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + paths: [ "requirements*.yml", "conda-env-create.yml", "requirement*.txt", "setup*py", "setup*cfg", "pytproject*toml", "MANIFEST*in"] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + fail-fast: true |
| 14 | + matrix: |
| 15 | + python-version: ["3.7", "3.8", "3.9", "3.10"] |
| 16 | + os: [ubuntu-22.04, windows-latest, macos-latest] |
| 17 | + steps: |
| 18 | + - name: Set up Python ${{ matrix.python-version }} |
| 19 | + uses: actions/setup-python@v3 |
| 20 | + with: |
| 21 | + python-version: ${{ matrix.python-version }} |
| 22 | + - name: 🐧 Install OpenSlide & OpenJPEG |
| 23 | + if: runner.os == 'Linux' |
| 24 | + run: | |
| 25 | + sudo apt update |
| 26 | + sudo apt-get install -y libopenslide-dev openslide-tools libopenjp2-7 libopenjp2-tools |
| 27 | + python -m pip install --upgrade pip |
| 28 | + - name: 🍎 Install OpenSlide & OpenJPEG |
| 29 | + if: runner.os == 'macOS' |
| 30 | + run: | |
| 31 | + brew install openslide openjpeg |
| 32 | + python -m pip install --upgrade pip |
| 33 | + - name: 🪟 Install OpenJPEG |
| 34 | + if: runner.os == 'Windows' |
| 35 | + run: | |
| 36 | + # Install OpenJPEG |
| 37 | + git clone https://github.com/uclouvain/openjpeg.git |
| 38 | + cd openjpeg |
| 39 | + mkdir build |
| 40 | + cd build |
| 41 | + cmake -G "MinGW Makefiles" .. -DCMAKE_BUILD_TYPE=Release |
| 42 | + ls |
| 43 | + make -j4 |
| 44 | + make install |
| 45 | + make clean |
| 46 | + - name: 🪟 Install OpenSlide |
| 47 | + if: runner.os == 'Windows' |
| 48 | + run: | |
| 49 | + choco install wget --no-progress |
| 50 | + wget https://github.com/openslide/openslide-winbuild/releases/download/v20220811/openslide-win64-20220811.zip |
| 51 | + 7z x openslide-win64-20220811.zip |
| 52 | + ls openslide-win64-20220811 |
| 53 | + # Add to PATH |
| 54 | + echo "$(realpath ./openslide-win64-20220811/bin)" >> $GITHUB_PATH |
| 55 | + echo "$(realpath ./openslide-win64-20220811/lib)" >> $GITHUB_PATH |
| 56 | + # Install |
| 57 | + mkdir "C:\Program Files\openslide" |
| 58 | + Copy-Item -Path ".\openslide-win64-20220811\*" -Destination "C:\Program Files\openslide" -Recurse |
| 59 | + ls "C:/Program Files/openslide" |
| 60 | + - name: 🪟 Install SQLite Shell |
| 61 | + if: runner.os == 'Windows' |
| 62 | + run: choco install sqlite.shell --no-progress |
| 63 | + - name: SQLite Version Information |
| 64 | + run: | |
| 65 | + sqlite3 --version |
| 66 | + sqlite3 ":memory:" -list ".output stdout" "pragma compile_options" ".exit" |
| 67 | + - name: OpenSlide Version Information |
| 68 | + if: runner.os == 'Linux' |
| 69 | + run: openslide-quickhash1sum --version |
| 70 | + - name: OpenJPEG Version Information |
| 71 | + continue-on-error: true # This -h option has exit code 1 for some reason |
| 72 | + run: opj_dump -h |
| 73 | + - name: pip Install From GitHub Repo on Linux and macOS |
| 74 | + if: runner.os != 'Windows' |
| 75 | + run: python -m pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@${GITHUB_REF_NAME} |
| 76 | + - name: pip Install From GitHub on Windows |
| 77 | + if: runner.os == 'Windows' |
| 78 | + run: python -m pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@$env:GITHUB_REF_NAME |
| 79 | + - name: Test TIAToolbox Import |
| 80 | + shell: python |
| 81 | + run: | |
| 82 | + import os |
| 83 | + if hasattr(os, "add_dll_directory"): |
| 84 | + # Required for Python>=3.8 on Windows |
| 85 | + with os.add_dll_directory(r"D:\a\tiatoolbox\tiatoolbox\openslide-win64-20220811\bin"): |
| 86 | + import tiatoolbox |
| 87 | + else: |
| 88 | + os.environ["PATH"] = r"D:\a\tiatoolbox\tiatoolbox\openslide-win64-20220811\bin;" |
| 89 | + import tiatoolbox |
0 commit comments