-
Notifications
You must be signed in to change notification settings - Fork 7
115 lines (99 loc) · 3.42 KB
/
pull_request.yml
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
114
115
name: In pull request
on:
pull_request:
branches:
- main
jobs:
check_python_linting:
name: Ruff Linting & Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
src: "./"
version: 0.3.3
- uses: chartboost/ruff-action@v1
with:
src: "./"
version: 0.3.3
args: 'format --check'
test_compatibility:
name: Test Package Compatibility
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: "3.10"
dependency-set: minimum
- os: macos-13 # macos-latest doesn't work with python 3.10
# https://github.com/actions/setup-python/issues/855
python-version: "3.10"
dependency-set: minimum
- os: ubuntu-latest
python-version: "3.11"
dependency-set: maximum
- os: macos-latest
python-version: "3.11"
dependency-set: maximum
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install pip-tools
run: python -m pip install pip-tools
- name: Generate requirements file for minimum dependencies
if: matrix.dependency-set == 'minimum'
run: |
python << EOF
import re
with open('requirements.txt', 'r') as f:
reqs = f.readlines()
min_reqs = []
for req in reqs:
req = req.strip()
if not req or req.startswith('#'):
continue
# Extract package name and version range
match = re.match(r'([^>=<\s]+)\s*>=\s*([^,]+),\s*<=\s*([^,]+)', req)
if match:
package, min_ver, _ = match.groups()
min_reqs.append(f"{package}=={min_ver}")
with open('requirements.txt', 'w') as f:
f.write('\n'.join(min_reqs))
EOF
- name: Generate requirements file for maximum dependencies
if: matrix.dependency-set == 'maximum'
run: |
python << EOF
import re
with open('requirements.txt', 'r') as f:
reqs = f.readlines()
max_reqs = []
for req in reqs:
req = req.strip()
if not req or req.startswith('#'):
continue
# Extract package name and version range
match = re.match(r'([^>=<\s]+)\s*>=\s*([^,]+),\s*<=\s*([^,]+)', req)
if match:
package, _, max_ver = match.groups()
max_reqs.append(f"{package}=={max_ver}")
with open('requirements.txt', 'w') as f:
f.write('\n'.join(max_reqs))
EOF
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-test.txt
pip install -r requirements.txt
- name: Initialize submodules
run: git submodule update --init --recursive
- name: Run Tests
run: |
python -m unittest discover -s tabpfn_client/tests -t tabpfn_client/tests