Repository navigation
92 lines (87 loc) · 3.73 KB
/
Copy pathtest.yml
File metadata and controls
92 lines (87 loc) · 3.73 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
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history + tags, so setuptools-scm sees the real version
- name: Install uv
uses: astral-sh/setup-uv@v10.4.0
- name: Install dependencies
run: uv sync --group dev
- name: Run pre-commit
run: uv run pre-commit run --all-files
test:
runs-on: ubuntu-latest
strategy:
matrix:
# Kept in sync with `[tool.uv] environments` in pyproject.toml: the dev
# dependency group (pytest, pre-commit, ...) only resolves on these
# versions. Compatibility with CellProfiler's own (older) Python, down to
# the package's real `requires-python` floor, is covered by the
# `compat` job below instead, via a plain `pip install` with no dev deps.
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history + tags, so setuptools-scm sees the real version
- name: Install uv
uses: astral-sh/setup-uv@v10.4.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --group dev
- name: Run tests
run: uv run pytest --cov=cp_parallel --cov-report=term-missing
compat:
# Smoke-tests that the published package itself -- no dev tooling -- still
# installs and imports on the older Python versions that real CellProfiler
# conda environments commonly run (e.g. CellProfiler 4.x on Python 3.8).
# Runs inside the official `python` Docker image rather than using
# actions/setup-python: GitHub's hosted Python builds for EOL versions like
# 3.8/3.9 aren't published for new runner OS images (there's no 3.8 or 3.9
# build for ubuntu-26.04, for example), so setup-python breaks every time
# the ubuntu-latest image moves forward. Docker Hub keeps every
# `python:X.Y` image published indefinitely, independent of the runner OS.
runs-on: ubuntu-latest
container: python:${{ matrix.python-version }}
strategy:
matrix:
python-version: ["3.8", "3.9"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history + tags, so setuptools-scm sees the real version
- name: Install the package (no dev dependencies)
run: pip install .
- name: Import sanity check
run: python -c "import cp_parallel; print(cp_parallel.run_parallel)"
install-from-github:
# Installs the package the way the README tells users to -- straight from a
# GitHub URL with `pip install git+https://...` -- with no local checkout, so
# it catches anything missing from the built package (e.g. files only present
# in the repo tree). Pinned to the commit under test: for a PR, that's the
# PR's head commit, which GitHub exposes on the base repo even for forks.
# Runs inside the official `python` Docker image for the same reason as
# `compat` above -- actions/setup-python can't provide Python 3.8 on
# current runner images.
runs-on: ubuntu-latest
container: python:${{ matrix.python-version }}
strategy:
matrix:
python-version: ["3.8", "3.12"]
env:
INSTALL_URL: git+https://github.com/${{ github.repository }}.git@${{ github.event.pull_request.head.sha || github.sha }}
steps:
- name: Install from GitHub URL
run: pip install "$INSTALL_URL"
- name: Import sanity check (outside any source tree)
working-directory: ${{ runner.temp }}
run: |
python -c "import cp_parallel; print(cp_parallel.__file__); print(cp_parallel.run_parallel)"