-
Notifications
You must be signed in to change notification settings - Fork 310
70 lines (64 loc) · 2.27 KB
/
reusable_test.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
name: Reusable Test Workflow
on:
workflow_dispatch:
inputs:
pinned_botorch:
required: true
type: boolean
minimal_dependencies:
required: false
type: boolean
default: false
workflow_call:
inputs:
pinned_botorch:
required: true
type: boolean
minimal_dependencies:
required: false
type: boolean
default: false
jobs:
tests-and-coverage:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.12"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- if: ${{ inputs.pinned_botorch }}
name: Install dependencies with pinned BoTorch (minimal dependencies ${{ inputs.minimal_dependencies }})
run: |
# The brackets returns '.[unittest_minimal]' if using minimal dependencies and '.[unittest]'
# otherwise. This saves us from needing 4 install dependencies blocks by supporting two
# different installation options in one line.
pip install -e ${{ ((inputs.minimal_dependencies) && '.[unittest_minimal]') || '.[unittest]' }}
- if: ${{ !inputs.pinned_botorch }}
name: Install dependencies with latest BoTorch (minimal dependencies ${{ inputs.minimal_dependencies }})
env:
ALLOW_BOTORCH_LATEST: true
ALLOW_LATEST_GPYTORCH_LINOP: true
run: |
pip install git+https://github.com/cornellius-gp/gpytorch.git
pip install git+https://github.com/pytorch/botorch.git
pip install -e ${{ ((inputs.minimal_dependencies) && '.[unittest_minimal]') || '.[unittest]' }}
- name: Import Ax
run: |
python scripts/import_ax.py
- if: ${{ !inputs.minimal_dependencies }}
# Only run with full dependencies. Minimal does not include pytest.
name: Tests and coverage
run: |
pytest -ra --cov=ax
- if: ${{ !inputs.minimal_dependencies && matrix.python-version == 3.10 }}
# Only upload codecov once per workflow.
name: Upload coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}