-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
91 lines (79 loc) · 2.81 KB
/
action.yml
File metadata and controls
91 lines (79 loc) · 2.81 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
79
80
81
82
83
84
85
86
87
88
89
90
91
name: CVector Python Test
description: Setup Poetry and run ruff, mypy, and pytest for Python projects
inputs:
python-version:
description: Python version to use
required: false
default: "3.14"
poetry-version:
description: Poetry version to install
required: false
default: "2.2.1"
src-dirs:
description: Source directories for linting (space-separated)
required: false
default: "."
working-directory:
description: Directory containing pyproject.toml (defaults to repo root)
required: false
default: "."
run-pytest:
description: Whether to run pytest
required: false
default: "true"
runs:
using: composite
steps:
- name: Setup Python ${{ inputs.python-version }}
id: setup
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ inputs.python-version }}
- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.local
key: poetry-${{ inputs.poetry-version }}-python-${{ steps.setup.outputs.python-version }}
- name: Install Poetry
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
with:
version: ${{ inputs.poetry-version }}
virtualenvs-path: ~/.venv
- name: Load cached venv
id: venv
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.venv
key: venv-${{ runner.os }}-${{ steps.setup.outputs.python-version }}-${{ inputs.working-directory }}-${{ hashFiles(format('{0}/poetry.lock', inputs.working-directory)) }}
restore-keys: |
venv-${{ runner.os }}-${{ steps.setup.outputs.python-version }}-
- name: Sync dependencies
if: steps.venv.outputs.cache-hit != 'true'
shell: bash
working-directory: ${{ inputs.working-directory }}
run: poetry sync --no-interaction --no-root
- name: Install project
shell: bash
working-directory: ${{ inputs.working-directory }}
run: poetry install --no-interaction --only-root
- name: Run ruff check
shell: bash
working-directory: ${{ inputs.working-directory }}
run: poetry run ruff check ${{ inputs.src-dirs }}
- name: Run ruff format check
shell: bash
working-directory: ${{ inputs.working-directory }}
run: poetry run ruff format --check ${{ inputs.src-dirs }}
- name: Run mypy
shell: bash
working-directory: ${{ inputs.working-directory }}
run: poetry run mypy ${{ inputs.src-dirs }}
- name: Run pytest
if: inputs.run-pytest == 'true'
shell: bash
working-directory: ${{ inputs.working-directory }}
run: poetry run pytest
branding:
icon: check-circle
color: orange