109 lines (88 loc) · 2.39 KB
/
run-unit-tests.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
name: Unit tests
on:
push:
branches:
- main
paths:
- 'radiant_mlhub/**'
- setup.py
- pyproject.toml
- 'test/**'
- '.github/workflows/run-unit-tests.yml'
pull_request:
branches:
- main
- new-api
paths:
- 'radiant_mlhub/**'
- setup.py
- pyproject.toml
- 'test/**'
- '.github/workflows/run-unit-tests.yml'
jobs:
test:
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: requirements_testing.txt
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_testing.txt
- name: Run tests
env:
# some unit tests require an API_KEY env var, however it will not be used
# because VCR.py responses were already recorded.
MLHUB_API_KEY: 'required_but_not_used'
MLHUB_CI: 'true'
run: |
pip install .
pytest --record-mode once --block-network
flake8
mypy radiant_mlhub
# verify importing all top-level modules, without polluting the package namespace
# with requirements_testing.txt dependencies. (this simulates an end-user
# install of the radiant-mlhub package).
verify_import_package:
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Import radiant_mlhub
run: |
python -m pip install --upgrade pip
pip install .
python -c "from radiant_mlhub import *"
python -c "from radiant_mlhub.client import *"
python -c "from radiant_mlhub.models import *"