Skip to content

Commit ba86441

Browse files
committed
Add code quality workflow
1 parent cdf0ee0 commit ba86441

File tree

4 files changed

+57
-7
lines changed

4 files changed

+57
-7
lines changed

.github/workflows/code_quality.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Code Quality Checks
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
git_ref:
6+
type: string
7+
description: Git ref of the DuckDB python package
8+
required: false
9+
workflow_call:
10+
inputs:
11+
git_ref:
12+
type: string
13+
description: Git ref of the DuckDB python package
14+
required: false
15+
16+
defaults:
17+
run:
18+
shell: bash
19+
20+
jobs:
21+
run_checks:
22+
name: Run linting and formatting
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
ref: ${{ inputs.git_ref }}
28+
fetch-depth: 0
29+
persist-credentials: false
30+
31+
- name: Install Astral UV
32+
uses: astral-sh/setup-uv@v6
33+
with:
34+
version: "0.7.14"
35+
python-version: 3.9
36+
37+
- name: pre-commit (cache)
38+
uses: actions/cache@v4
39+
with:
40+
path: ~/.cache/pre-commit
41+
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
42+
43+
- name: pre-commit (--all-files)
44+
run: |
45+
uvx pre-commit run --show-diff-on-failure --color=always --all-files

.github/workflows/coverage.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ jobs:
7575
enable-cache: true
7676
cache-suffix: -${{ github.workflow }}
7777

78-
- name: Run linting and formatting checks
79-
shell: bash
80-
run: |
81-
uvx pre-commit run --all-files
82-
8378
- name: Run tests with coverage
8479
shell: bash
8580
run: |

.github/workflows/on_pr.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ jobs:
2323
name: Make sure submodule is in a sane state
2424
uses: ./.github/workflows/submodule_sanity.yml
2525

26+
code_quality:
27+
name: Code-quality checks
28+
needs: submodule_sanity_guard
29+
uses: ./.github/workflows/code_quality.yml
30+
2631
packaging_test:
2732
name: Build a minimal set of packages and run all tests on them
28-
needs: submodule_sanity_guard
33+
needs: code_quality
2934
# Skip packaging tests for draft PRs
3035
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
3136
uses: ./.github/workflows/packaging.yml
@@ -36,7 +41,7 @@ jobs:
3641

3742
coverage_test:
3843
name: Run coverage tests
39-
needs: submodule_sanity_guard
44+
needs: code_quality
4045
# Only run coverage test for draft PRs
4146
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft == true }}
4247
uses: ./.github/workflows/coverage.yml

.github/workflows/on_push.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
jobs:
21+
code_quality:
22+
name: Code-quality checks
23+
uses: ./.github/workflows/code_quality.yml
24+
2125
test:
2226
name: Run coverage tests
27+
needs: code_quality
2328
uses: ./.github/workflows/coverage.yml
2429
with:
2530
git_ref: ${{ github.ref }}

0 commit comments

Comments
 (0)