Repository navigation
78 lines (70 loc) · 2.27 KB
/
Copy pathpython-ci.yml
File metadata and controls
78 lines (70 loc) · 2.27 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
name: Python CI
on:
workflow_call:
inputs:
python-version:
description: Python version to install.
required: false
type: string
default: '3.13'
install-command:
description: Dependency install command.
required: false
type: string
default: python -m pip install -r requirements-dev.txt
lint-command:
description: Ruff check command. The command must fail on diagnostics.
required: false
type: string
default: ruff check .
typecheck-command:
description: Type check command. Use mypy or pyright, and keep it failing on errors.
required: false
type: string
default: python -m mypy .
test-command:
description: Test command.
required: false
type: string
default: python -m unittest discover
working-directory:
description: Directory that contains the Python project.
required: false
type: string
default: .
permissions:
contents: read
jobs:
python:
name: Python CI
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
- name: Install dependencies
if: ${{ inputs.install-command != '' }}
working-directory: ${{ inputs.working-directory }}
env:
INSTALL_COMMAND: ${{ inputs.install-command }}
run: bash -euo pipefail -c "$INSTALL_COMMAND"
- name: Lint
if: ${{ inputs.lint-command != '' }}
working-directory: ${{ inputs.working-directory }}
env:
LINT_COMMAND: ${{ inputs.lint-command }}
run: bash -euo pipefail -c "$LINT_COMMAND"
- name: Typecheck
if: ${{ inputs.typecheck-command != '' }}
working-directory: ${{ inputs.working-directory }}
env:
TYPECHECK_COMMAND: ${{ inputs.typecheck-command }}
run: bash -euo pipefail -c "$TYPECHECK_COMMAND"
- name: Test
if: ${{ inputs.test-command != '' }}
working-directory: ${{ inputs.working-directory }}
env:
TEST_COMMAND: ${{ inputs.test-command }}
run: bash -euo pipefail -c "$TEST_COMMAND"