-
Notifications
You must be signed in to change notification settings - Fork 3
63 lines (52 loc) · 1.5 KB
/
pre-commit-checks.yml
File metadata and controls
63 lines (52 loc) · 1.5 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
name: Pre-commit checks
on:
push:
branches:
- main
paths:
- '.github/workflows/**'
- 'traincheck/**'
- 'tests/**'
pull_request:
paths:
- '.github/workflows/**'
- 'traincheck/**'
- 'tests/**'
jobs:
pre-commit:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # Specify your Python version here
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black==24.3.0
pip install mypy==1.9.0
pip install isort
pip install ruff==0.3.3
pip install torch
pip install tqdm
pip install bytecode
- name: Run black
id: black
run: black --check traincheck --exclude tests
- name: Run mypy on main source code folder
id: mypy
run: mypy traincheck --install-types --non-interactive --ignore-missing-imports
- name: Run isort
id: isort
run: isort --check --profile=black traincheck --skip tests
- name: Run ruff
id: ruff
run: ruff check traincheck
- name: Check if any checks failed
if: failure()
run: echo "Some pre-commit checks have failed. Please run 'pre-commit run --all-files' locally and fix the issues."
- name: Set job status
if: failure()
run: exit 1