-
Notifications
You must be signed in to change notification settings - Fork 1
118 lines (100 loc) · 2.94 KB
/
ci.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
116
117
118
---
name: Continuous Integration
on :
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
lint:
strategy:
matrix:
os: [ubuntu-latest]
python: ['3.11']
include:
- os: ubuntu-latest
CACHE_PIP: ~/.cache/pip
CACHE_PRE_COMMIT: ~/.cache/pre-commit
name: Lint
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Caching
uses: actions/[email protected]
with:
path: |
${{ matrix.CACHE_PIP }}
${{ matrix.CACHE_PRE_COMMIT }}
key: lint-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('**/.pre-commit-config.yaml')
}}
restore-keys: |
lint-${{ runner.os }}-${{ matrix.python }}-
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.create false
poetry install
- name: Lint
run: |
poetry run pre-commit run --all-files
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python: ['3.11', '3.12']
include:
- os: ubuntu-latest
CACHE_PIP: ~/.cache/pip
CACHE_POETRY: ~/.cache/poetry
- os: windows-latest
CACHE_PIP: ~\AppData\Local\pip\Cache
CACHE_POETRY: ~\AppData\Local\poetry\Cache
- os: macos-latest
CACHE_PIP: ~/Library/Caches/pip
CACHE_POETRY: ~/Library/Caches/poetry
name: Test
runs-on: ${{ matrix.os }}
needs: lint
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Caching
uses: actions/[email protected]
with:
path: |
${{ matrix.CACHE_PIP }}
${{ matrix.CACHE_POETRY }}
key: test-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('**/pyproject.toml')
}}
restore-keys: |
test-${{ runner.os }}-${{ matrix.python }}-
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Collect Environment
id: environment
run: |
python dev/github_env.py
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Test
run: |
poetry run pytest --verbose --numprocesses=auto --cov=. --cov-config=dev/.coveragerc --cov-report=xml
- name: Coverage
uses: codecov/[email protected]
with:
env_vars: OS, PYTHON