-
Notifications
You must be signed in to change notification settings - Fork 97
149 lines (121 loc) · 3.94 KB
/
ci.yml
File metadata and controls
149 lines (121 loc) · 3.94 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# SPDX-FileCopyrightText: 2019–2026 Pynguin Contributors
#
# SPDX-License-Identifier: MIT
name: CI
on: [push, pull_request]
# -----------------------------
# LINT JOBS: pre-commit & mypy
# -----------------------------
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Setup Poetry
uses: abatilo/actions-poetry@v4
with:
poetry-version: "2.1.4"
# Required for act.
# On mac-os: act -j tests --container-architecture linux/amd64 -P macos-latest=catthehacker/ubuntu:act-latest
- name: Ensure poetry is in PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: poetry install --extras "openai numpy fandango-faker"
- name: Run pre-commit hooks
run: poetry run pre-commit run --all-files
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Setup Poetry
uses: abatilo/actions-poetry@v4
with:
poetry-version: "2.1.4"
- name: Ensure poetry is in PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: poetry install --extras "openai numpy fandango-faker"
- name: Run mypy
run: poetry run mypy
# -----------------------------
# TESTS JOB
# -----------------------------
tests:
strategy:
fail-fast: false
matrix:
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
poetry-version: [ "2.1.4" ]
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}
needs: [ pre-commit, mypy ]
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup Poetry
uses: abatilo/actions-poetry@v4
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Ensure poetry is in PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: poetry install --extras "openai numpy fandango-faker"
- name: Run tests with coverage
run: poetry run pytest --cov=src --cov=tests --cov-branch --cov-report=term-missing --cov-report=xml tests/
- name: Generate XML report
run: poetry run coverage xml -o coverage.xml
# The upload for hidden files does not work
- name: Rename coverage file
run: mv .coverage raw-coverage
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.os }}-${{ matrix.python-version }}
path: |
raw-coverage
coverage.xml
# -----------------------------
# COMBINE COVERAGE JOB
# -----------------------------
combine-coverage:
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Download coverage artifacts
uses: actions/download-artifact@v4
with:
path: coverages
- name: Combine coverage reports
run: |
pip install coverage[toml]
coverage combine coverages/coverage-*/raw-coverage
coverage report
coverage xml -o coverage.xml
coverage html -d cov_html
- name: Upload merged coverage report
uses: actions/upload-artifact@v4
with:
name: merged-coverage
path: |
coverage.xml
cov_html
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}