Skip to content

Commit c546d76

Browse files
committed
ci setup
1 parent 745f954 commit c546d76

File tree

2 files changed

+193
-0
lines changed

2 files changed

+193
-0
lines changed

.github/workflows/ci.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Check out repository
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Python 3.13
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: "3.13"
21+
22+
- name: Install PDM
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install pdm
26+
27+
- name: Install dependencies
28+
run: |
29+
pdm install -G:all
30+
31+
- name: Run tests with coverage
32+
run: |
33+
pdm run pytest --cov-report=xml
34+
35+
- name: Upload coverage to Codecov
36+
uses: codecov/codecov-action@v3
37+
with:
38+
token: ${{ secrets.CODECOV_TOKEN }}
39+
file: ./coverage.xml
40+
fail_ci_if_error: true
41+
42+
format:
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- name: Check out repository
47+
uses: actions/checkout@v3
48+
49+
- name: Set up Python 3.13
50+
uses: actions/setup-python@v4
51+
with:
52+
python-version: "3.13"
53+
54+
- name: Install PDM
55+
run: |
56+
python -m pip install --upgrade pip
57+
pip install pdm
58+
59+
- name: Install dependencies
60+
run: |
61+
pdm install -G:all
62+
63+
- name: Check Black formatting
64+
run: |
65+
pdm run black --check .
66+
67+
- name: Check isort
68+
run: |
69+
pdm run isort --check .
70+
71+
- name: Check unused imports with autoflake
72+
run: |
73+
pdm run autoflake . -r --remove-unused-variables --remove-all-unused-imports --ignore-pass-after-docstring --exclude ./.venv/*,./_scripts/* --check
74+
75+
type-check:
76+
runs-on: ubuntu-latest
77+
78+
steps:
79+
- name: Check out repository
80+
uses: actions/checkout@v3
81+
82+
- name: Set up Python 3.13
83+
uses: actions/setup-python@v4
84+
with:
85+
python-version: "3.13"
86+
87+
- name: Install PDM
88+
run: |
89+
python -m pip install --upgrade pip
90+
pip install pdm
91+
92+
- name: Install dependencies
93+
run: |
94+
pdm install -G:all
95+
96+
- name: Run mypy
97+
run: |
98+
pdm run mypy
99+
100+
docs:
101+
runs-on: ubuntu-latest
102+
103+
steps:
104+
- name: Check out repository
105+
uses: actions/checkout@v3
106+
107+
- name: Set up Python 3.13
108+
uses: actions/setup-python@v4
109+
with:
110+
python-version: "3.13"
111+
112+
- name: Install PDM
113+
run: |
114+
python -m pip install --upgrade pip
115+
pip install pdm
116+
117+
- name: Install dependencies
118+
run: |
119+
pdm install -G:all
120+
121+
- name: Check markdown formatting
122+
run: |
123+
pdm run mdformat --check .
124+
125+
build:
126+
runs-on: ubuntu-latest
127+
needs: [test, format, type-check, docs]
128+
129+
steps:
130+
- name: Check out repository
131+
uses: actions/checkout@v3
132+
133+
- name: Set up Python 3.13
134+
uses: actions/setup-python@v4
135+
with:
136+
python-version: "3.13"
137+
138+
- name: Install PDM
139+
run: |
140+
python -m pip install --upgrade pip
141+
pip install pdm
142+
143+
- name: Install dependencies
144+
run: |
145+
pdm install -G:all
146+
147+
- name: Build package
148+
run: |
149+
pdm build

codecov.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
codecov:
2+
require_ci_to_pass: yes
3+
strict_yaml_branch: main
4+
5+
coverage:
6+
precision: 2
7+
round: down
8+
range: "95...100"
9+
status:
10+
project:
11+
default:
12+
target: 100%
13+
threshold: 0%
14+
base: auto
15+
branches:
16+
- main
17+
if_not_found: failure
18+
if_ci_failed: error
19+
informational: false
20+
only_pulls: false
21+
patch:
22+
default:
23+
target: 100%
24+
threshold: 0%
25+
base: auto
26+
branches:
27+
- main
28+
if_not_found: failure
29+
if_ci_failed: error
30+
informational: false
31+
only_pulls: false
32+
33+
parsers:
34+
gcov:
35+
branch_detection:
36+
conditional: yes
37+
loop: yes
38+
method: no
39+
macro: no
40+
41+
comment:
42+
layout: "reach,diff,flags,files,footer"
43+
behavior: default
44+
require_changes: no

0 commit comments

Comments
 (0)