-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (53 loc) · 1.78 KB
/
lint.yml
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
name: Lint
on:
pull_request:
workflow_call:
inputs:
ref:
required: true
type: string
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out repository
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
- name: Check out repository
if: github.event_name != 'pull_request'
uses: actions/checkout@v3
with:
ref: "${{ inputs.ref }}"
- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version-file: '.python-version'
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Get poetry cache dir
id: poetry-cache
run: |
echo "dir=$(poetry config cache-dir)" >> $GITHUB_OUTPUT
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: |
${{ steps.poetry-cache.outputs.dir }}
.venv
poetry.lock
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('pyproject.toml', 'poetry.lock') }}-lint
- name: Install development dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root --only=dev
- name: Lint with flake8
run: |
poetry run flake8 annotation_tool main.py --count --statistics
- name: Check format with black
run: poetry run black --check annotation_tool main.py
- name: Check format with isort
run: poetry run isort --check --settings-path pyproject.toml annotation_tool main.py