Skip to content

Commit 62ccee9

Browse files
authored
Merge pull request #114 from bgilbert/retile
Retiling simplifications
2 parents 9880ed9 + efb110a commit 62ccee9

File tree

3 files changed

+107
-183
lines changed

3 files changed

+107
-183
lines changed

.github/workflows/retile.yml

Lines changed: 44 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -7,189 +7,124 @@ permissions:
77
contents: read
88

99
env:
10-
LD_LIBRARY_PATH: "${{ github.workspace }}/install/lib64"
11-
PYTHONPATH: "${{ github.workspace }}/install/python"
10+
PIP_CACHE_KEY: retile-pip-${{ github.run_id }}
1211
PYTHONUNBUFFERED: 1
13-
RUNTIME_DEPS: "python3 python3-boto3 python3-pillow python3-requests \
14-
zlib libpng libjpeg-turbo libtiff openjpeg2 gdk-pixbuf2 \
15-
gdk-pixbuf2-modules-extra libxml2 sqlite cairo glib2"
12+
PYTHON_VER: "3.14t"
13+
PYTHON_DEPS: "boto3 openslide-bin openslide-python requests"
1614

1715
jobs:
18-
build:
19-
name: Build releases
20-
runs-on: ubuntu-latest
21-
container: registry.fedoraproject.org/fedora:latest
22-
steps:
23-
- name: Install dependencies
24-
run: |
25-
dnf install -y \
26-
jq xz \
27-
python3 python3-devel python3-pip python3-pillow python3-wheel \
28-
gcc meson pkg-config \
29-
zlib-devel \
30-
libpng-devel \
31-
libjpeg-turbo-devel \
32-
libtiff-devel \
33-
openjpeg2-devel \
34-
gdk-pixbuf2-devel \
35-
gdk-pixbuf2-modules-extra \
36-
libxml2-devel \
37-
sqlite-devel \
38-
cairo-devel \
39-
glib2-devel
40-
- name: Download releases
41-
run: |
42-
set -euxo pipefail
43-
get_release() {
44-
# Query GitHub for latest release
45-
curl -s -H "Accept: application/vnd.github.v3+json" \
46-
"https://api.github.com/repos/openslide/$1/releases/latest" \
47-
> "$1-release.json"
48-
local env_var=$(echo "$1" | tr a-z- A-Z_)_VERSION
49-
local version=$(jq -r .tag_name < "$1-release.json" | sed s/^v//)
50-
echo "${env_var}=${version}" >> ${GITHUB_ENV}
51-
52-
# Download release
53-
local url=$(jq -r '.assets | map(select(.content_type == "application/x-xz")) | .[0].browser_download_url' < "$1-release.json")
54-
curl -LO "${url}"
55-
56-
# Unpack
57-
tar xf "$(echo "$1" | tr - _)-${version}.tar.xz"
58-
}
59-
get_release openslide
60-
get_release openslide-python
61-
- name: Build OpenSlide
62-
working-directory: openslide-${{ env.OPENSLIDE_VERSION }}
63-
run: |
64-
meson setup builddir --prefix=${GITHUB_WORKSPACE}/install
65-
meson compile -C builddir
66-
67-
trap "cat builddir/meson-logs/testlog.txt" ERR
68-
meson test -C builddir
69-
trap - ERR
70-
71-
meson install -C builddir
72-
- name: Build OpenSlide Python
73-
working-directory: openslide_python-${{ env.OPENSLIDE_PYTHON_VERSION }}
74-
run: |
75-
pip install -t ${GITHUB_WORKSPACE}/install/python .
76-
- name: Upload build
77-
uses: actions/upload-artifact@v5
78-
with:
79-
name: build
80-
path: install
8116
setup:
8217
name: Set up tiling
8318
environment: demo-site
84-
needs: build
8519
runs-on: ubuntu-latest
86-
container: registry.fedoraproject.org/fedora:latest
8720
steps:
8821
- name: Check out repo
8922
uses: actions/checkout@v5
23+
- name: Set up Python
24+
uses: actions/setup-python@v6
9025
with:
91-
path: website
26+
python-version: ${{ env.PYTHON_VER }}
9227
- name: Install dependencies
93-
run: dnf install -y ${RUNTIME_DEPS}
94-
- name: Download build
95-
uses: actions/download-artifact@v6
28+
run: pip install --break-system-packages ${PYTHON_DEPS}
29+
- name: Cache dependencies
30+
uses: actions/cache/save@v4
9631
with:
97-
name: build
98-
path: install
32+
key: ${{ env.PIP_CACHE_KEY }}
33+
path: /home/runner/.cache/pip
9934
- name: Set up tiling
10035
id: start-tiling
101-
working-directory: website/demo
36+
working-directory: demo
10237
env:
10338
AWS_ACCESS_KEY_ID: ${{ secrets.DEMO_TILER_AWS_KEY_ID }}
10439
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEMO_TILER_AWS_SECRET_KEY }}
10540
run: |
106-
./_synctiles.py start \
107-
"${{ vars.DEMO_TILER_BUCKET }}" \
108-
${GITHUB_WORKSPACE}/context \
109-
matrix
41+
./_synctiles.py start "${{ vars.DEMO_TILER_BUCKET }}" context matrix
11042
echo "slide-matrix=$(cat matrix)" >> $GITHUB_OUTPUT
11143
- name: Upload context
11244
uses: actions/upload-artifact@v5
11345
with:
11446
name: context
115-
path: context
47+
path: demo/context
11648
outputs:
11749
slide-matrix: ${{ steps.start-tiling.outputs.slide-matrix }}
50+
11851
tile:
11952
name: Tile
12053
environment: demo-site
12154
needs: setup
12255
runs-on: ubuntu-latest
123-
container: registry.fedoraproject.org/fedora:latest
12456
strategy:
12557
fail-fast: false
12658
matrix: ${{ fromJson(needs.setup.outputs.slide-matrix) }}
12759
steps:
12860
- name: Check out repo
12961
uses: actions/checkout@v5
62+
- name: Set up Python
63+
uses: actions/setup-python@v6
13064
with:
131-
path: website
132-
- name: Install dependencies
133-
run: dnf install -y ${RUNTIME_DEPS}
134-
- name: Download build
135-
uses: actions/download-artifact@v6
65+
python-version: ${{ env.PYTHON_VER }}
66+
- name: Cache dependencies
67+
uses: actions/cache/restore@v4
13668
with:
137-
name: build
138-
path: install
69+
key: ${{ env.PIP_CACHE_KEY }}
70+
path: /home/runner/.cache/pip
71+
fail-on-cache-miss: true
72+
- name: Install dependencies
73+
run: pip install --break-system-packages ${PYTHON_DEPS}
13974
- name: Download context
14075
uses: actions/download-artifact@v6
14176
with:
14277
name: context
78+
path: demo
14379
- name: Tile slide
144-
working-directory: website/demo
80+
working-directory: demo
14581
env:
14682
AWS_ACCESS_KEY_ID: ${{ secrets.DEMO_TILER_AWS_KEY_ID }}
14783
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEMO_TILER_AWS_SECRET_KEY }}
14884
run: |
149-
./_synctiles.py tile \
150-
${GITHUB_WORKSPACE}/context \
151-
"${{ matrix.slide }}" \
152-
${GITHUB_WORKSPACE}/summary
85+
./_synctiles.py tile context "${{ matrix.slide }}" summary
15386
echo "ARTIFACT_NAME=summary-$(echo "${{ matrix.slide }}" | tr -c "a-zA-Z0-9\n" _)" >> $GITHUB_ENV
15487
- name: Upload summary
15588
uses: actions/upload-artifact@v5
15689
with:
15790
name: ${{ env.ARTIFACT_NAME }}
158-
path: summary
91+
path: demo/summary
92+
15993
finish:
16094
name: Finish tiling
16195
environment: demo-site
16296
needs: tile
16397
runs-on: ubuntu-latest
164-
container: registry.fedoraproject.org/fedora:latest
16598
steps:
16699
- name: Check out repo
167100
uses: actions/checkout@v5
101+
- name: Set up Python
102+
uses: actions/setup-python@v6
168103
with:
169-
path: website
170-
- name: Install dependencies
171-
run: dnf install -y ${RUNTIME_DEPS}
172-
- name: Download build
173-
uses: actions/download-artifact@v6
104+
python-version: ${{ env.PYTHON_VER }}
105+
- name: Cache dependencies
106+
uses: actions/cache/restore@v4
174107
with:
175-
name: build
176-
path: install
108+
key: ${{ env.PIP_CACHE_KEY }}
109+
path: /home/runner/.cache/pip
110+
fail-on-cache-miss: true
111+
- name: Install dependencies
112+
run: pip install --break-system-packages ${PYTHON_DEPS}
177113
- name: Download context
178114
uses: actions/download-artifact@v6
179115
with:
180116
name: context
117+
path: demo
181118
- name: Download summaries
182119
uses: actions/download-artifact@v6
183120
with:
184121
pattern: "summary-*"
185-
path: summary
122+
path: demo/summary
186123
merge-multiple: true
187124
- name: Finish tiling
188-
working-directory: website/demo
125+
working-directory: demo
189126
env:
190127
AWS_ACCESS_KEY_ID: ${{ secrets.DEMO_TILER_AWS_KEY_ID }}
191128
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEMO_TILER_AWS_SECRET_KEY }}
192129
run: |
193-
./_synctiles.py finish \
194-
${GITHUB_WORKSPACE}/context \
195-
${GITHUB_WORKSPACE}/summary
130+
./_synctiles.py finish context summary

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repos:
1515
- id: trailing-whitespace
1616

1717
- repo: https://github.com/asottile/pyupgrade
18-
rev: v3.21.0
18+
rev: v3.21.2
1919
hooks:
2020
- id: pyupgrade
2121
name: Modernize Python code
@@ -28,7 +28,7 @@ repos:
2828
name: Reorder Python imports with isort
2929

3030
- repo: https://github.com/psf/black
31-
rev: 25.9.0
31+
rev: 25.11.0
3232
hooks:
3333
- id: black
3434
name: Format Python code with black
@@ -47,7 +47,7 @@ repos:
4747
additional_dependencies: [flake8-bugbear, Flake8-pyproject]
4848

4949
- repo: https://github.com/pre-commit/mirrors-mypy
50-
rev: v1.18.2
50+
rev: v1.19.0
5151
hooks:
5252
- id: mypy
5353
name: Check Python types

0 commit comments

Comments
 (0)