Skip to content

Commit ff50b19

Browse files
committed
Add basic CI configuration
1 parent 0b048f3 commit ff50b19

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

.github/workflows/ci.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
env:
15+
# Many color libraries just need this to be set to any value, but at least
16+
# one distinguishes color depth, where "3" -> "256-bit color".
17+
FORCE_COLOR: 3
18+
19+
jobs:
20+
pre-commit:
21+
name: pre-commit
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
- uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.x"
30+
- uses: pre-commit/action@v3.0.1
31+
with:
32+
extra_args: --hook-stage manual --all-files
33+
34+
checks:
35+
name: Test with Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
36+
runs-on: ${{ matrix.runs-on }}
37+
needs: [pre-commit]
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
python-version: ["3.9", "3.13"]
42+
runs-on: [ubuntu-latest, windows-latest, macos-14]
43+
include:
44+
- python-version: "pypy-3.10"
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- uses: actions/checkout@v4
49+
with:
50+
fetch-depth: 0
51+
52+
- uses: actions/setup-python@v5
53+
with:
54+
python-version: ${{ matrix.python-version }}
55+
allow-prereleases: true
56+
57+
- name: Install package
58+
run: python -m pip install .[test,optional]
59+
60+
- name: Run pytest
61+
run: >-
62+
python -m pytest -ra --cov --cov-report=xml --cov-report=term
63+
--durations=20
64+
65+
- name: Upload coverage report
66+
uses: codecov/codecov-action@v4.5.0
67+
with:
68+
token: ${{ secrets.CODECOV_TOKEN }}
69+
70+
- name: Compare example stubs
71+
run: |
72+
python -m docstub -v example/example_pkg
73+
git diff --exit-code example/
74+
75+
- name: Generate docstub stubs
76+
run: |
77+
python -m docstub -v src/docstub
78+
79+
- name: Upload docstub stubs
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: docstub-stubs
83+
path: ./src/docstub-stubs

0 commit comments

Comments
 (0)