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