-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (48 loc) · 1.71 KB
/
Copy pathci-python.yml
File metadata and controls
56 lines (48 loc) · 1.71 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
name: Reusable Python CI
on:
workflow_call:
inputs:
python-versions:
description: 'JSON array of Python versions to test'
type: string
default: '["3.10", "3.12"]'
mypy-target:
description: 'Target directory for mypy type checking'
type: string
required: true
run-lint:
description: 'Whether to run ruff lint'
type: boolean
default: true
# Reusable workflows can only request permissions the *caller* has granted.
# `read-all` here breaks any caller that scopes permissions narrower than
# read-all (e.g. cycles-server's ci.yml grants only `contents: read`), causing
# `startup_failure` with: "workflow is requesting ... but is only allowed ...".
# Match the caller-friendly pattern: declare only what we actually need.
permissions:
contents: read
jobs:
lint-and-test:
name: Lint & Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ${{ fromJson(inputs.python-versions) }}
steps:
- name: Check out source
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Lint with ruff
if: ${{ inputs.run-lint }}
run: ruff check .
- name: Type check with mypy
run: mypy ${{ inputs.mypy-target }}
- name: Run tests with coverage
run: pytest --cov