-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (81 loc) · 2.91 KB
/
Copy pathpython-package.yml
File metadata and controls
86 lines (81 loc) · 2.91 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
name: Test package
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
# The same three tools Codacy runs, so their findings surface here
# instead of on the dashboard after a push.
- name: Install package and linters
run: |
python -m pip install --upgrade pip
pip install -e '.[test]' ruff prospector pylint
- name: Ruff
run: ruff check .
- name: Prospector
run: prospector --messages-only
- name: Pylint
run: pylint --rcfile=.pylintrc src/tmplot tests
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install '.[test,models]'
python -m build
python -m twine check dist/*
- name: Smoke test built wheel
run: |
python -m venv /tmp/tmplot-wheel
/tmp/tmplot-wheel/bin/pip install dist/*.whl
/tmp/tmplot-wheel/bin/python -c "import tmplot; print(tmplot.__version__)"
- name: Testing with pytest and measuring coverage
run: |
coverage run --source src -m pytest .
coverage xml
# Every matrix job runs the same suite, so one upload is enough. The
# action ends with a `final` call that closes the commit on Codacy, so
# uploading from all five would race: the first `final` wins and the
# rest are dropped.
- name: Reporting coverage to Codacy
if: matrix.python-version == '3.12'
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.xml
oldest-scikit-learn:
name: Declared minimum scikit-learn
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install the oldest supported dependency set
run: |
python -m pip install --upgrade pip
python -m pip install "scikit-learn==1.4.2" "numpy<2" "pandas<2.2" "scipy<1.14" altair ipywidgets IPython tqdm pytest
- name: Test the version-conditional code paths
# MDS took `dissimilarity` before scikit-learn 1.9 and `metric` after.
# These test files need no optional model packages.
run: python -m pytest tests/test_core_regressions.py tests/test_jaccard.py -q