Skip to content

Commit 910e4e3

Browse files
committed
ci: bring up GitHub Actions workflows mirroring artifex layout
Add a reusable setup-diffbio composite action and six workflows: ci (quality + matrix unit tests + integration + e2e + perf + coverage), build-verification (matrix package build + import smoke contract), quality-checks (pyright + ruff statistics summary, manual trigger), security (pip-audit + bandit weekly + per-PR), docs (mkdocs build and gh-pages deploy under docs.avitai.bio/diffbio/), and publish (PyPI trusted-publishing on release plus testpypi via workflow_dispatch). Adapted from artifex for the diffbio package: matrix targets .[dev,test] on Linux and macOS without the gpu extra, JAX_PLATFORMS=cpu is exported so opifex's import-time backend init picks the CPU backend, and the pytest marker filter excludes gpu/gpu_required/cuda/slow/network/scbench/ spatialbench so CI runs only the CPU-friendly subset.
1 parent 525caf8 commit 910e4e3

7 files changed

Lines changed: 750 additions & 0 deletions

File tree

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Setup DiffBio
2+
description: Set up Python and uv, install the requested editable target, and export PYTHONPATH.
3+
4+
inputs:
5+
python-version:
6+
description: Python version to install.
7+
required: true
8+
cache-suffix:
9+
description: Cache suffix for uv.
10+
required: true
11+
linux-editable-target:
12+
description: Editable target to install on Linux runners.
13+
required: true
14+
macos-editable-target:
15+
description: Editable target override for macOS runners.
16+
required: false
17+
default: ""
18+
extra-packages:
19+
description: Extra packages to install after the editable target.
20+
required: false
21+
default: ""
22+
23+
runs:
24+
using: composite
25+
steps:
26+
- name: Set up Python ${{ inputs.python-version }}
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ inputs.python-version }}
30+
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@v1
33+
with:
34+
enable-cache: true
35+
cache-suffix: ${{ inputs.cache-suffix }}
36+
37+
- name: Create virtual environment
38+
shell: bash
39+
run: uv venv --python "${{ inputs.python-version }}" --python-preference only-system --no-python-downloads
40+
41+
- name: Install DiffBio environment
42+
shell: bash
43+
env:
44+
UV_CONCURRENT_DOWNLOADS: "4"
45+
run: |
46+
set -euo pipefail
47+
48+
editable_target="${{ inputs.linux-editable-target }}"
49+
if [[ "${{ runner.os }}" == "macOS" && -n "${{ inputs.macos-editable-target }}" ]]; then
50+
editable_target="${{ inputs.macos-editable-target }}"
51+
fi
52+
53+
for attempt in 1 2 3 4 5; do
54+
if uv pip install -e "$editable_target"; then
55+
break
56+
fi
57+
58+
if [[ "$attempt" -eq 5 ]]; then
59+
echo "Failed to install $editable_target after 5 attempts" >&2
60+
exit 1
61+
fi
62+
63+
delay=$((attempt * 10))
64+
echo "Install attempt $attempt failed, retrying in ${delay} seconds..." >&2
65+
sleep "$delay"
66+
done
67+
68+
if [[ -n "${{ inputs.extra-packages }}" ]]; then
69+
uv pip install ${{ inputs.extra-packages }}
70+
fi
71+
72+
- name: Export repo-local environment
73+
shell: bash
74+
run: |
75+
{
76+
echo "PYTHONPATH=$PYTHONPATH:$(pwd)"
77+
echo "UV_PYTHON=${{ inputs.python-version }}"
78+
echo "UV_PYTHON_DOWNLOADS=never"
79+
echo "UV_PYTHON_PREFERENCE=only-system"
80+
echo "UV_CONCURRENT_DOWNLOADS=4"
81+
echo "JAX_PLATFORMS=cpu"
82+
} >> "$GITHUB_ENV"
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: DiffBio Build Verification
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
name: Package Build Verification (${{ matrix.os }}, py${{ matrix.python-version }})
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os: [ubuntu-latest, macos-14]
18+
python-version: ["3.11", "3.12"]
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Set up DiffBio
24+
uses: ./.github/actions/setup-diffbio
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
cache-suffix: build-${{ matrix.os }}-${{ matrix.python-version }}
28+
linux-editable-target: ".[dev]"
29+
macos-editable-target: ".[dev]"
30+
extra-packages: types-requests types-setuptools
31+
32+
- name: Build package
33+
run: uv run python -m build
34+
35+
- name: Verify package metadata
36+
run: uv run twine check dist/*
37+
38+
- name: Run install smoke contract
39+
shell: bash
40+
run: |
41+
set -euo pipefail
42+
export JAX_PLATFORMS="cpu"
43+
uv venv test_venv
44+
. test_venv/bin/activate
45+
uv pip install dist/*.whl
46+
python - <<'PY'
47+
import diffbio
48+
49+
expected = {
50+
"configs",
51+
"constants",
52+
"evaluation",
53+
"losses",
54+
"operators",
55+
"pipelines",
56+
"sequences",
57+
"utils",
58+
}
59+
missing = sorted(expected - set(dir(diffbio)))
60+
assert not missing, f"missing public submodules: {missing}"
61+
assert hasattr(diffbio, "__version__"), "diffbio.__version__ is missing"
62+
print("public surface OK:", sorted(expected))
63+
print("version:", diffbio.__version__)
64+
PY
65+
deactivate
66+
67+
- name: Upload build artifacts
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: package-artifacts-${{ matrix.os }}-py${{ matrix.python-version }}
71+
path: dist/

0 commit comments

Comments
 (0)