-
Notifications
You must be signed in to change notification settings - Fork 5
119 lines (104 loc) · 3.22 KB
/
testing.yml
File metadata and controls
119 lines (104 loc) · 3.22 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
114
115
116
117
118
119
name: Tests and Examples
permissions:
contents: read
on:
push:
branches:
- '**'
paths:
- 'src/**'
- 'tests/**'
- 'examples/**'
- '.github/workflows/testing.yml'
- 'environment.yml'
- 'pyproject.toml'
- 'uv.lock'
pull_request:
branches:
- '**'
paths:
- 'src/**'
- 'tests/**'
- 'examples/**'
- '.github/workflows/testing.yml'
- 'environment.yml'
- 'pyproject.toml'
- 'uv.lock'
schedule:
- cron: '0 0 * * *' # Every day at 00:00 UTC
jobs:
test:
name: Run Tests and Examples (${{ matrix.os }} / py${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11", "3.12", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v5
# --------------------
# Linux path (uv)
# --------------------
- name: Set up Python (Linux)
if: runner.os == 'Linux'
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv (Linux)
if: runner.os == 'Linux'
uses: astral-sh/setup-uv@v4
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
uv sync --dev --extra viewer
- name: Run tests (Linux)
if: runner.os == 'Linux'
run: |
uv run pytest tests --cov=src --cov-report=xml --cov-report=term
- name: Run examples (Linux)
if: runner.os == 'Linux'
run: |
cd examples
uv run bash run_examples.sh
- name: Upload coverage to Codecov (Linux + py3.11 only)
if: runner.os == 'Linux' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v5
with:
files: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
slug: PLAID-lib/plaid
name: python-${{ matrix.python-version }}
verbose: true
# --------------------
# macOS / Windows path (conda)
# --------------------
- name: Set up Conda (macOS/Windows)
if: runner.os != 'Linux'
uses: conda-incubator/setup-miniconda@v2
with:
use-mamba: true
auto-activate-base: false
miniforge-variant: Miniforge3
- name: Create environment (macOS/Windows)
if: runner.os != 'Linux'
run: |
mamba env create -n plaid-dev python=${{ matrix.python-version }} -f environment.yml
conda run -n plaid-dev pip install -e . --no-deps
- name: Run tests (macOS/Windows)
if: runner.os != 'Linux'
run: |
conda run -n plaid-dev pytest tests
- name: Run examples (macOS)
if: runner.os == 'macOS'
run: |
cd examples
conda run -n plaid-dev bash run_examples.sh
- name: Run examples (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
cd examples
conda run -n plaid-dev run_examples.bat