-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (104 loc) · 2.85 KB
/
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
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
120
121
122
name: Test
on:
push:
branches:
- main
paths:
- ".github/workflows/test.yml"
- "capsula/**"
- "examples/**"
- "tests/**"
- "pyproject.toml"
- "capsula.toml"
pull_request:
branches:
- main
paths:
- ".github/workflows/test.yml"
- "capsula/**"
- "examples/**"
- "tests/**"
- "pyproject.toml"
- "capsula.toml"
env:
PYTHON_VERSION: "3.11"
POETRY_VERSION: "1.7.0"
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
version: 0.1.5
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Install dependencies
run: poetry install --no-interaction --with examples
- name: Run mypy
run: poetry run --no-interaction mypy .
tox:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.11", "3.10", "3.9", "3.8"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox
env:
PLATFORM: ${{ matrix.os }}
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
name: covdata
path: .coverage.*
combine-coverage-reports:
runs-on: ubuntu-latest
permissions:
contents: write
needs: tox
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Download coverage reports from all jobs
uses: actions/download-artifact@v3
with:
name: covdata
- name: Combine coverage reports
run: |
python -m pip install --upgrade pip
python -m pip install coverage genbadge[coverage]
coverage combine
coverage report -m
coverage xml -o reports/coverage/coverage.xml
coverage html -d reports/coverage/html
genbadge coverage -i reports/coverage/coverage.xml -o reports/coverage/badge.svg
- name: Commit and push
if: github.event_name == 'pull_request'
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "Update tox report"
push: "origin HEAD:${{ github.head_ref }} --force"