-
Notifications
You must be signed in to change notification settings - Fork 114
88 lines (78 loc) · 2.59 KB
/
typecheck.yml
File metadata and controls
88 lines (78 loc) · 2.59 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
name: typechecks
# Disable default permissions and grant minimal required permissions
permissions: {}
on:
push:
branches:
- main
pull_request:
branches:
- main
defaults:
run:
# Ensure activation for micromamba
shell: bash -leo pipefail {0}
concurrency:
# Concurrency group that uses the workflow name and PR number if available
# or commit SHA as a fallback. If a new build is triggered under that
# concurrency group while a previous build is running it will be canceled.
# Repeated pushes to a PR will cancel all previous builds, while multiple
# merges to main will not cancel.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
typechecks:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: mypy
hook: mypy
setup-micromamba: false
os: ubuntu-latest
- name: ty
hook: ty
setup-micromamba: true
os: ubuntu-latest
steps:
# Initialization
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
if: matrix.setup-micromamba == false
with:
python-version: 3.14
- name: Install pre-commit (for mypy)
if: matrix.setup-micromamba == false
run: python -m pip install pre-commit
- name: List pip package versions
if: matrix.setup-micromamba == false
run: python -m pip freeze --local
- uses: mamba-org/setup-micromamba@add3a49764cedee8ee24e82dfde87f5bc2914462 # v2.0.7
if: matrix.setup-micromamba == true
with:
environment-file: environments/conda-lock.yml
environment-name: conda-lock-dev
init-shell: bash
cache-environment: true
create-args: >-
--category=main --category=dev
- name: RUN MYPY
if: matrix.hook == 'mypy'
run: |
pre-commit run --verbose --show-diff-on-failure --color=always --all-files --hook-stage=manual mypy
- name: RUN TY
if: matrix.hook == 'ty'
run: |
pre-commit run --verbose --show-diff-on-failure --color=always --all-files ty
# Upload logs
- name: Upload pre-commit log
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: pre-commit-${{ matrix.name }}.log
path: /home/runner/.cache/pre-commit/pre-commit.log