-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (79 loc) · 2.44 KB
/
python-lint.yaml
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
---
name: python-linting
'on':
workflow_call:
inputs:
additional_packages:
default: ''
description: String of additional packages that should be installed.
required: false
type: string
jobs_run_on:
default: ubuntu-latest
description: The runner group on which jobs will run.
required: false
type: string
python_version:
description: The version of Python to use for the run.
default: '3.11'
required: false
type: string
ruff_version:
default: '0.1.0'
description: The version of ruff to run.
required: false
type: string
timeout_minutes:
description: The maximum time (in minutes) for a job to run.
default: 5
required: false
type: number
use_pylama:
description: If true, use pylama to lint the repository.
default: true
required: false
type: boolean
use_ruff:
description: If true, use ruff to lint the repository.
default: false
required: false
type: boolean
working_directory:
description: The working directory where all jobs should be executed.
default: '.'
required: false
type: string
jobs:
linting:
defaults:
run:
working-directory: ${{ inputs.working_directory }}
runs-on: ${{ inputs.jobs_run_on }}
steps:
- name: Install additional packages
if: ${{ inputs.additional_packages != '' }}
run: sudo apt-get install -y ${{ inputs.additional_packages }}
- name: Checkout repo
uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: "Set up Python ${{ inputs.python_version }}"
uses: actions/setup-python@v5
with:
cache: poetry
python-version: "${{ inputs.python_version }}"
- name: Configure Poetry
run: poetry config virtualenvs.in-project true
- name: Install dependencies
run: poetry install
- name: Lint with yamllint
run: poetry run yamllint . -s
- name: Lint with pylama
if: ${{ inputs.use_pylama }}
run: "poetry run pylama -v --skip '.venv/*'"
- name: Lint with ruff
if: ${{ inputs.use_ruff }}
uses: chartboost/ruff-action@v1
with:
version: "${{ inputs.ruff_version }}"
timeout-minutes: ${{ inputs.timeout_minutes }}