forked from Lightning-AI/pytorch-lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (51 loc) · 1.49 KB
/
code-checks.yml
File metadata and controls
60 lines (51 loc) · 1.49 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
name: Code check
on:
push:
branches: [master, "release/*"]
pull_request:
branches: [master, "release/*"]
paths:
- ".actions/*"
- ".github/workflows/code-checks.yml"
- "requirements/**"
- "src/**"
- "pyproject.toml" # includes mypy config
- "!requirements/docs.txt"
- "!requirements/*/docs.txt"
- "!*.md"
- "!**/*.md"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
defaults:
run:
shell: bash
jobs:
mypy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- name: Install uv and set Python version
uses: astral-sh/setup-uv@v7
with:
python-version: "3.11"
# TODO: Avoid activating environment like this
# see: https://github.com/astral-sh/setup-uv/tree/v6/?tab=readme-ov-file#activate-environment
activate-environment: true
enable-cache: true
- name: Install dependencies
env:
FREEZE_REQUIREMENTS: 1
timeout-minutes: 20
run: |
uv pip install '.[pytorch-all,fabric-all]' -r requirements/typing.txt
uv pip list
- name: mypy cache
uses: actions/cache@v5
with:
path: .mypy_cache
key: mypy-${{ hashFiles('requirements/typing.txt') }}
- name: Check typing
run: mypy
- name: Minimize uv cache
run: uv cache prune --ci