Skip to content

Commit b8b4a7b

Browse files
raylimCopilot
andcommitted
ci: add CI and Docker build workflows
ci.yml: - Triggers on push to main/trident-features and PRs to main - Matrix: Python 3.10 and 3.11 - Installs torch-cpu extra (no GPU needed) - Runs fast tests only (excludes slow, integration, requires_tensorflow, requires_fastattn markers) docker.yml: - Triggers on push to main and version tags (v*) - Matrix: torch-gpu, torch-cpu, tensorflow-gpu, tensorflow-cpu - Builds and pushes to mskmind/mussel on Docker Hub - Tags: branch name, semver, latest (on main) - Uses GHA layer cache for fast rebuilds - Updates Docker Hub README on torch-gpu build Adapted from ray-dev branch; CI excludes GPU/slow tests that are covered by SLURM jobs (make slurm-test-integration). Co-authored-by: Copilot <[email protected]>
1 parent 13f1dac commit b8b4a7b

2 files changed

Lines changed: 113 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, trident-features ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: ["3.10", "3.11"]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v5
29+
with:
30+
enable-cache: true
31+
32+
- name: Install dependencies (CPU torch)
33+
run: uv sync --extra torch-cpu
34+
35+
- name: Run fast tests (CPU, no GPU/slow/TF/fastattn)
36+
run: |
37+
uv run pytest tests/ \
38+
-m "not slow and not integration and not requires_tensorflow and not requires_fastattn" \
39+
--tb=short \
40+
-v

.github/workflows/docker.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Build and Push Docker Images
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags:
7+
- 'v*'
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
packages: write
13+
14+
env:
15+
REGISTRY: docker.io
16+
IMAGE_NAME: mskmind/mussel
17+
18+
jobs:
19+
build-and-push:
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
backend:
24+
- torch-gpu
25+
- torch-cpu
26+
- tensorflow-gpu
27+
- tensorflow-cpu
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
33+
- name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v3
35+
36+
- name: Log in to Docker Hub
37+
uses: docker/login-action@v3
38+
with:
39+
username: ${{ secrets.DOCKERHUB_USERNAME }}
40+
password: ${{ secrets.DOCKERHUB_TOKEN }}
41+
42+
- name: Extract metadata (tags, labels)
43+
id: meta
44+
uses: docker/metadata-action@v5
45+
with:
46+
images: ${{ env.IMAGE_NAME }}
47+
tags: |
48+
type=ref,event=branch,suffix=-${{ matrix.backend }}
49+
type=semver,pattern={{version}},suffix=-${{ matrix.backend }}
50+
type=semver,pattern={{major}}.{{minor}},suffix=-${{ matrix.backend }}
51+
type=raw,value=latest,suffix=-${{ matrix.backend }},enable={{is_default_branch}}
52+
53+
- name: Build and push Docker image
54+
uses: docker/build-push-action@v6
55+
with:
56+
context: .
57+
push: true
58+
tags: ${{ steps.meta.outputs.tags }}
59+
labels: ${{ steps.meta.outputs.labels }}
60+
build-args: |
61+
BACKEND=${{ matrix.backend }}
62+
cache-from: type=gha
63+
cache-to: type=gha,mode=max
64+
65+
- name: Update Docker Hub description
66+
if: matrix.backend == 'torch-gpu'
67+
uses: peter-evans/dockerhub-description@v4
68+
with:
69+
username: ${{ secrets.DOCKERHUB_USERNAME }}
70+
password: ${{ secrets.DOCKERHUB_TOKEN }}
71+
repository: ${{ env.IMAGE_NAME }}
72+
short-description: "Mussel - Computational pathology toolkit for whole-slide images"
73+
readme-filepath: ./README.md

0 commit comments

Comments
 (0)