Repository navigation
113 lines (110 loc) · 4.46 KB
/
Copy pathtest.yml
File metadata and controls
113 lines (110 loc) · 4.46 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
# Backend test suite.
#
# The suite runs THREE times on purpose. A silent data-loss defect shipped for
# months because the development environment had pandas 2 while every fresh
# `pip install bibexpy` resolved pandas 3, where a text-returning
# `Series.apply()` turns the None that means "empty" into a truthy NaN and
# identity guards start accepting it. The `pandas3-semantics` leg reproduces
# exactly that behaviour on pandas 2 via `future.infer_string` (fast, no
# separate install), and the `pandas3` leg runs the real thing.
name: Tests
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: pandas2
pandas: "pandas>=2.2,<3"
pandas3_semantics: "0"
- name: pandas3-semantics
pandas: "pandas>=2.2,<3"
pandas3_semantics: "1"
- name: pandas3
pandas: "pandas>=3,<4"
pandas3_semantics: "0"
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
# Run from apps/api: requirements.txt contains `-e ../../packages/bibex_core`,
# and pip resolves that relative path against the working directory.
working-directory: apps/api
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install "${{ matrix.pandas }}"
python -c "import pandas; print('pandas', pandas.__version__)"
- name: Run tests
# test_convert.py is excluded: it crashes a vendored native extension on
# some platforms and is unrelated to what this matrix guards.
env:
BIBEXPY_PANDAS3_SEMANTICS: ${{ matrix.pandas3_semantics }}
BIBEXPY_SAMPLE_DATA: ${{ github.workspace }}/python_pkg/src/bibexpy/_samples/simple_project
working-directory: apps/api
run: python -m pytest tests -q --ignore=tests/test_convert.py
# Install matrix: does a fresh `pip install bibexpy` dependency set resolve from
# wheels on every supported OS / Python? A runtime dependency without a wheel for a
# new Python (PyYAML via uvicorn[standard] on 3.15 was the case that prompted this)
# silently turns into a source build that fails on Windows. No test suite here: it
# only installs the declared runtime dependencies and imports every top-level module.
install:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
name: install (${{ matrix.os }}, py${{ matrix.python }})
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
allow-prereleases: true
- name: Generate requirements from python_pkg/pyproject.toml
run: |
python -m pip install --upgrade pip
# tomllib is in the standard library from 3.11; 3.10 needs tomli.
python -m pip install tomli
python - <<'PY'
try:
import tomllib
except ModuleNotFoundError:
import tomli as tomllib
with open("python_pkg/pyproject.toml", "rb") as fh:
deps = tomllib.load(fh)["project"]["dependencies"]
with open("runtime-requirements.txt", "w") as out:
out.write("\n".join(deps) + "\n")
print("\n".join(deps))
PY
- name: Install runtime dependencies (wheels only)
# --only-binary=:all: makes a missing wheel a hard failure instead of a
# slow source build, which is exactly what this job exists to catch.
run: |
python -m pip install --only-binary=:all: -r runtime-requirements.txt
- name: Import every top-level module
run: |
python - <<'PY'
import importlib
mods = ["pandas", "numpy", "pyarrow", "sklearn", "reportlab", "fastapi",
"uvicorn", "pydantic", "openpyxl", "nltk", "requests", "unidecode",
"sse_starlette", "multipart", "dotenv", "tqdm", "colorama"]
for name in mods:
importlib.import_module(name)
print("imported", name)
import pandas
print("pandas", pandas.__version__)
PY