2222 - " MANIFEST*in"
2323 - " .github/workflows/pip-install.yml"
2424
25+ permissions :
26+ contents : read
27+
2528jobs :
2629 build :
2730 runs-on : ${{ matrix.os }}
@@ -31,142 +34,160 @@ jobs:
3134 python-version : ["3.10", "3.11", "3.12", "3.13"]
3235 os : [ubuntu-24.04, windows-latest, macos-latest]
3336
37+ # Force UTF-8 everywhere (Windows is the one that really needs it)
38+ env :
39+ PYTHONUTF8 : " 1"
40+ PYTHONIOENCODING : " utf-8"
41+
3442 steps :
35- - name : Checkout
36- uses : actions/checkout@v4
37-
38- - name : Install Miniconda
39- uses : conda-incubator/setup-miniconda@v3
40- with :
41- channels : conda-forge
42- channel-priority : strict
43- auto-update-conda : true
44-
45- # -------------------------------
46- # Create environment (Linux/macOS)
47- # -------------------------------
48- - name : Create conda environment (Linux/macOS)
49- if : runner.os != 'Windows'
50- shell : bash
51- run : |
52- source $CONDA/etc/profile.d/conda.sh
53- conda create -y -n test-env python=${{ matrix.python-version }}
54- conda activate test-env
55- conda install -y openjpeg sqlite
56-
57- # -------------------------------
58- # Create environment (Windows)
59- # -------------------------------
60- - name : Create conda environment (Windows)
61- if : runner.os == 'Windows'
62- shell : pwsh
63- run : |
64- conda create -y -n test-env python=${{ matrix.python-version }}
65- conda activate test-env
66- conda install -y openjpeg sqlite
67-
68- # -------------------------------
69- # Verify SQLite
70- # -------------------------------
71- - name : Verify SQLite (Linux/macOS)
72- if : runner.os != 'Windows'
73- shell : bash
74- run : |
75- source $CONDA/etc/profile.d/conda.sh
76- conda activate test-env
77- sqlite3 --version
78- sqlite3 ":memory:" -list ".output stdout" "pragma compile_options" ".exit"
79-
80- - name : Verify SQLite (Windows)
81- if : runner.os == 'Windows'
82- shell : pwsh
83- run : |
84- conda activate test-env
85- sqlite3 --version
86- sqlite3 ":memory:" -list ".output stdout" "pragma compile_options" ".exit"
87-
88- # -------------------------------
89- # Verify OpenJPEG
90- # -------------------------------
91- - name : Verify OpenJPEG (Linux/macOS)
92- if : runner.os != 'Windows'
93- shell : bash
94- run : |
95- source $CONDA/etc/profile.d/conda.sh
96- conda activate test-env
97- opj_dump -h || true # This -h option exits with code 1 for some reason
98-
99- - name : Verify OpenJPEG (Windows)
100- if : runner.os == 'Windows'
101- shell : pwsh
102- run : |
103- conda activate test-env
104- opj_dump -h || true # This -h option exits with code 1 for some reason
105-
106- # -------------------------------
107- # Install PyTorch
108- # -------------------------------
109- - name : Install CPU-only PyTorch (Linux/macOS)
110- if : runner.os != 'Windows'
111- shell : bash
112- run : |
113- source $CONDA/etc/profile.d/conda.sh
114- conda activate test-env
115- pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
116-
117- - name : Install CPU-only PyTorch (Windows)
118- if : runner.os == 'Windows'
119- shell : pwsh
120- run : |
121- conda activate test-env
122- pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
123-
124- # -------------------------------
125- # Install tiatoolbox
126- # -------------------------------
127- - name : Install tiatoolbox (Linux/macOS)
128- if : runner.os != 'Windows'
129- shell : bash
130- run : |
131- source $CONDA/etc/profile.d/conda.sh
132- conda activate test-env
133- pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@${GITHUB_SHA}
134-
135- - name : Install tiatoolbox (Windows)
136- if : runner.os == 'Windows'
137- shell : pwsh
138- run : |
139- conda activate test-env
140- pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@$env:GITHUB_SHA
141-
142- # -------------------------------
143- # Test Imports
144- # -------------------------------
145- - name : Test Imports (Linux/macOS)
146- if : runner.os != 'Windows'
147- shell : bash
148- run : |
149- source $CONDA/etc/profile.d/conda.sh
150- conda activate test-env
151- python - << 'EOF'
152- import tiatoolbox
153- print("tiatoolbox:", tiatoolbox.__version__)
154- import openslide
155- print("openslide:", openslide.__version__)
156- import torch
157- print("torch:", torch.__version__)
158- EOF
159-
160- - name : Test Imports (Windows)
161- if : runner.os == 'Windows'
162- shell : pwsh
163- run : |
164- conda activate test-env
165- @"
166- import tiatoolbox
167- print("tiatoolbox:", tiatoolbox.__version__)
168- import openslide
169- print("openslide:", openslide.__version__)
170- import torch
171- print("torch:", torch.__version__)
172- "@ | python -
43+ - name : Checkout
44+ uses : actions/checkout@v4
45+
46+ - name : Install Miniconda
47+ uses : conda-incubator/setup-miniconda@v3
48+ with :
49+ channels : conda-forge
50+ channel-priority : strict
51+ auto-update-conda : true
52+
53+ # -------------------------------
54+ # Create environment (Linux/macOS)
55+ # -------------------------------
56+ - name : Create conda environment (Linux/macOS)
57+ if : runner.os != 'Windows'
58+ shell : bash
59+ run : |
60+ source $CONDA/etc/profile.d/conda.sh
61+ conda create -y -n test-env python=${{ matrix.python-version }}
62+ conda activate test-env
63+ conda install -y openjpeg sqlite
64+ python -m pip install --upgrade pip setuptools wheel
65+
66+ # -------------------------------
67+ # Create environment (Windows)
68+ # -------------------------------
69+ - name : Create conda environment (Windows)
70+ if : runner.os == 'Windows'
71+ shell : pwsh
72+ run : |
73+ conda create -y -n test-env python=${{ matrix.python-version }}
74+ conda activate test-env
75+ conda install -y openjpeg sqlite
76+ python -m pip install --upgrade pip setuptools wheel
77+
78+ # -------------------------------
79+ # Verify SQLite
80+ # -------------------------------
81+ - name : Verify SQLite (Linux/macOS)
82+ if : runner.os != 'Windows'
83+ shell : bash
84+ run : |
85+ source $CONDA/etc/profile.d/conda.sh
86+ conda activate test-env
87+ sqlite3 --version
88+ sqlite3 ":memory:" -list ".output stdout" "pragma compile_options" ".exit"
89+
90+ - name : Verify SQLite (Windows)
91+ if : runner.os == 'Windows'
92+ shell : pwsh
93+ run : |
94+ conda activate test-env
95+ sqlite3 --version
96+ sqlite3 ":memory:" -list ".output stdout" "pragma compile_options" ".exit"
97+
98+ # -------------------------------
99+ # Verify OpenJPEG
100+ # -------------------------------
101+ - name : Verify OpenJPEG (Linux/macOS)
102+ if : runner.os != 'Windows'
103+ shell : bash
104+ run : |
105+ source $CONDA/etc/profile.d/conda.sh
106+ conda activate test-env
107+ opj_dump -h || true # -h exits with code 1 in some builds
108+
109+ - name : Verify OpenJPEG (Windows)
110+ if : runner.os == 'Windows'
111+ shell : pwsh
112+ run : |
113+ conda activate test-env
114+ opj_dump -h || true # -h exits with code 1 in some builds
115+
116+ # -------------------------------
117+ # Install PyTorch (CPU-only)
118+ # -------------------------------
119+ - name : Install CPU-only PyTorch (Linux/macOS)
120+ if : runner.os != 'Windows'
121+ shell : bash
122+ run : |
123+ source $CONDA/etc/profile.d/conda.sh
124+ conda activate test-env
125+ pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
126+
127+ - name : Install CPU-only PyTorch (Windows)
128+ if : runner.os == 'Windows'
129+ shell : pwsh
130+ run : |
131+ conda activate test-env
132+ pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
133+
134+ # -------------------------------
135+ # (Windows only) make console UTF-8 (extra safety)
136+ # -------------------------------
137+ - name : Ensure UTF-8 console (Windows)
138+ if : runner.os == 'Windows'
139+ shell : pwsh
140+ run : |
141+ chcp 65001 > $null
142+ [Console]::InputEncoding = [System.Text.Encoding]::UTF8
143+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
144+
145+ # -------------------------------
146+ # Install tiatoolbox from this commit
147+ # -------------------------------
148+ - name : Install tiatoolbox (Linux/macOS)
149+ if : runner.os != 'Windows'
150+ shell : bash
151+ run : |
152+ source $CONDA/etc/profile.d/conda.sh
153+ conda activate test-env
154+ pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@${GITHUB_SHA}
155+
156+ - name : Install tiatoolbox (Windows)
157+ if : runner.os == 'Windows'
158+ shell : pwsh
159+ run : |
160+ conda activate test-env
161+ pip install git+https://github.com/TissueImageAnalytics/tiatoolbox@$env:GITHUB_SHA
162+
163+ # -------------------------------
164+ # Test Imports
165+ # -------------------------------
166+ - name : Test Imports (Linux/macOS)
167+ if : runner.os != 'Windows'
168+ shell : bash
169+ run : |
170+ source $CONDA/etc/profile.d/conda.sh
171+ conda activate test-env
172+ python - << 'EOF'
173+ import tiatoolbox
174+ print("tiatoolbox:", tiatoolbox.__version__)
175+ import openslide
176+ print("openslide:", openslide.__version__)
177+ import torch
178+ print("torch:", torch.__version__)
179+ EOF
180+
181+ - name : Test Imports (Windows)
182+ if : runner.os == 'Windows'
183+ shell : pwsh
184+ run : |
185+ conda activate test-env
186+ @"
187+ import tiatoolbox
188+ print("tiatoolbox:", tiatoolbox.__version__)
189+ import openslide
190+ print("openslide:", openslide.__version__)
191+ import torch
192+ print("torch:", torch.__version__)
193+ "@ | python -
0 commit comments