Repository navigation
56 lines (50 loc) · 1.7 KB
/
Copy pathcode_quality.yml
File metadata and controls
56 lines (50 loc) · 1.7 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
name: Code Quality Checks
on:
workflow_dispatch:
inputs:
git_ref:
type: string
description: Git ref of the DuckDB python package
required: false
workflow_call:
inputs:
git_ref:
type: string
description: Git ref of the DuckDB python package
required: false
defaults:
run:
shell: bash
jobs:
run_checks:
name: Run linting, formatting and static type checker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
fetch-depth: 0
persist-credentials: false
- name: Install Astral UV
uses: astral-sh/setup-uv@v10.3.0
with:
version: "0.12.23"
# No setup-uv cache: it would save on pull request and feature branch refs and crowd out the ccaches.
enable-cache: false
python-version: "3.12"
- name: pre-commit (restore cache)
uses: actions/cache/restore@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: pre-commit (--all-files)
run: |
uvx --python 3.12 pre-commit run --show-diff-on-failure --color=always --all-files
# Only a protected branch writes the cache (cache_warm runs this workflow for that); pull request and
# merge queue refs restore it and do not each save their own 110 MB copy.
- name: pre-commit (save cache)
if: ${{ always() && github.ref_protected && github.event_name != 'merge_group' }}
uses: actions/cache/save@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}