Debian Codegraph @

.github/workflows/ci.yaml

raw
1 name: Continuous integration
2 on:
3 pull_request:
4 push:
5 branches: [main]
6 workflow_dispatch:
7
8 env:
9 REQUIRED_PACKAGES: make
10 POETRY_SPEC: poetry >=2, <2.3
11
12 jobs:
13 format-code:
14 name: Check code format
15 runs-on: ubuntu-latest
16 container: python:3.10-slim
17 steps:
18 - name: Checkout repository
19 uses: actions/checkout@v6
20 - name: Install required packages
21 run: apt update && apt install -y ${REQUIRED_PACKAGES}
22 - name: Install Poetry
23 run: pip install "${POETRY_SPEC}"
24 - name: Create virtual environment
25 run: make install
26 - name: Check code format
27 run: make check-format
28 lint-style:
29 name: Check code style
30 runs-on: ubuntu-latest
31 container: python:3.10-slim
32 steps:
33 - name: Checkout repository
34 uses: actions/checkout@v6
35 - name: Install required packages
36 run: apt update && apt install -y ${REQUIRED_PACKAGES}
37 - name: Install Poetry
38 run: pip install "${POETRY_SPEC}"
39 - name: Create virtual environment
40 run: make install
41 - name: Check code style
42 run: make check-style
43 lint-typing:
44 name: Check static typing
45 runs-on: ubuntu-latest
46 container: python:3.10-slim
47 steps:
48 - name: Checkout repository
49 uses: actions/checkout@v6
50 - name: Install required packages
51 run: apt update && apt install -y ${REQUIRED_PACKAGES}
52 - name: Install Poetry
53 run: pip install "${POETRY_SPEC}"
54 - name: Create virtual environment
55 run: make install
56 - name: Check code static typing
57 run: make check-typing
58 lint-poetry:
59 name: Check poetry configuration
60 runs-on: ubuntu-latest
61 container: python:3.10-slim
62 steps:
63 - name: Checkout repository
64 uses: actions/checkout@v6
65 - name: Install required packages
66 run: apt update && apt install -y ${REQUIRED_PACKAGES}
67 - name: Install Poetry
68 run: pip install "${POETRY_SPEC}"
69 - name: Create virtual environment
70 run: make install
71 - name: Check poetry configuration
72 run: make check-poetry
73 lint-docs:
74 name: Check documentation
75 runs-on: ubuntu-latest
76 container: python:3.10-slim
77 steps:
78 - name: Checkout repository
79 uses: actions/checkout@v6
80 - name: Install required packages
81 run: apt update && apt install -y ${REQUIRED_PACKAGES}
82 - name: Install Poetry
83 run: pip install "${POETRY_SPEC}"
84 - name: Create virtual environment
85 run: make install
86 - name: Check docs
87 run: make check-docs
88 build-docs:
89 name: Build documentation
90 runs-on: ubuntu-latest
91 container: python:3.10-slim
92 steps:
93 - name: Checkout repository
94 uses: actions/checkout@v6
95 - name: Install required packages
96 run: apt update && apt install -y ${REQUIRED_PACKAGES}
97 - name: Install Poetry
98 run: pip install "${POETRY_SPEC}"
99 - name: Create virtual environment
100 run: make install
101 - name: Build docs
102 run: make build-docs
103 test:
104 name: Run test suite
105 runs-on: ubuntu-latest
106 container: python:3.10-slim
107 steps:
108 - name: Checkout repository
109 uses: actions/checkout@v6
110 - name: Install required packages
111 run: apt update && apt install -y ${REQUIRED_PACKAGES}
112 - name: Install Poetry
113 run: pip install "${POETRY_SPEC}"
114 - name: Create virtual environment
115 run: make install
116 - name: Run test suite
117 run: make test
118 test-update:
119 name: Run test suite with updated dependencies
120 runs-on: ubuntu-latest
121 container: python:3.10-slim
122 steps:
123 - name: Checkout repository
124 uses: actions/checkout@v6
125 - name: Install required packages
126 run: apt update && apt install -y ${REQUIRED_PACKAGES}
127 - name: Install Poetry
128 run: pip install "poetry==2"
129 - name: Create virtual environment
130 run: make install
131 - name: Update locked dependencies
132 run: make update
133 - name: Run test suite
134 run: make test
135 test-pip:
136 name: Run test suite with pip installation
137 strategy:
138 matrix:
139 os: [ubuntu-latest, macos-latest, windows-latest]
140 runs-on: ${{ matrix.os }}
141 steps:
142 - name: Checkout repository
143 uses: actions/checkout@v6
144 - name: Install Python
145 uses: actions/setup-python@v6
146 with:
147 python-version: "3.10"
148 - name: Install SDK
149 run: pip install .
150 - name: Run test suite
151 run: python -m unittest -v
152 test-readme:
153 name: Run example code from readme
154 runs-on: ubuntu-latest
155 container: python:3.10-slim
156 steps:
157 - name: Checkout repository
158 uses: actions/checkout@v6
159 - name: Install required packages
160 run: apt update && apt install -y ${REQUIRED_PACKAGES} cargo
161 - name: Install tangler
162 run: cargo install [email protected]
163 - name: Install Poetry
164 run: pip install "${POETRY_SPEC}"
165 - name: Create virtual environment
166 run: make install
167 - name: Extract code from readme
168 run: /github/home/.cargo/bin/tangler python < README.md > readme.py
169 - name: Run code from readme
170 run: poetry run python readme.py
171 test-uv-resolution:
172 name: Test different resolution strategies with uv
173 runs-on: ubuntu-latest
174 container: python:3.10-slim
175 strategy:
176 matrix:
177 resolution:
178 - lowest
179 - lowest-direct
180 - highest
181 env:
182 UV_RESOLUTION: ${{ matrix.resolution }}
183 steps:
184 - name: Checkout repository
185 uses: actions/checkout@v6
186 - name: Install required packages
187 run: apt update && apt install -y ${REQUIRED_PACKAGES} gcc libffi-dev
188 - name: Install uv
189 run: pip install uv
190 - name: Lock dependencies
191 run: uv lock && uv tree --locked
192 - name: Check code static typing
193 run: make check-typing MYPY="uv run --locked mypy" TY="uv run --locked ty"
194 - name: Run test suite
195 run: make test PYTHON="uv run --locked python"