Skip to content

Commit 32bde24

Browse files
committed
Add new github workflow checks
1 parent d5e9b27 commit 32bde24

6 files changed

Lines changed: 217 additions & 135 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: 'Setup Python Environment'
2+
description: 'Setup Python, uv, cache, and install dependencies'
3+
4+
inputs:
5+
python-version:
6+
description: 'Python version to setup'
7+
required: true
8+
default: '3.13'
9+
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- name: Set up Python ${{ inputs.python-version }}
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: ${{ inputs.python-version }}
17+
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v4
20+
with:
21+
version: "latest"
22+
23+
- name: Setup uv cache
24+
uses: actions/cache@v3
25+
with:
26+
path: |
27+
~/.cache/uv
28+
key: ${{ runner.os }}-uv-${{ inputs.python-version }}-${{ hashFiles('**/uv.lock') }}
29+
restore-keys: |
30+
${{ runner.os }}-uv-${{ inputs.python-version }}-
31+
${{ runner.os }}-uv-
32+
33+
- name: Install dependencies
34+
run: uv sync --group test --group extras
35+
shell: bash

.github/workflows/main.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/pr-checks.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Code Quality
2+
3+
env:
4+
COVERAGE_THRESHOLD: 50
5+
VULTURE_MIN_CONFIDENCE: 80
6+
MAIN_SCAN_PATHS: 'src calmlib tools tests'
7+
EXTRA_SCAN_PATHS: 'experiments'
8+
ALL_SCAN_PATHS: 'src calmlib tools experiments tests'
9+
COVERAGE_PATHS_FLAGS: '--cov=src --cov=calmlib --cov=tools'
10+
11+
on:
12+
pull_request:
13+
types: [ opened, synchronize, reopened ]
14+
15+
jobs:
16+
ruff-check:
17+
name: Ruff
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
python-version: [ "3.13" ]
22+
steps:
23+
- uses: actions/checkout@v3
24+
- uses: ./.github/actions/setup-python-env
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Run Ruff linter
29+
run: uv run ruff check --output-format=github ${{ env.MAIN_SCAN_PATHS }}
30+
31+
- name: Run Ruff formatter check
32+
run: uv run ruff format --check --diff ${{ env.MAIN_SCAN_PATHS }}
33+
34+
dead-code-check:
35+
name: Vulture
36+
runs-on: ubuntu-latest
37+
strategy:
38+
matrix:
39+
python-version: [ "3.13" ]
40+
steps:
41+
- uses: actions/checkout@v3
42+
- uses: ./.github/actions/setup-python-env
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
46+
- name: Run Vulture dead code detector
47+
run: uv run vulture --min-confidence ${{ env.VULTURE_MIN_CONFIDENCE }} ${{ env.MAIN_SCAN_PATHS }}
48+
49+
coverage:
50+
name: Coverage Report
51+
runs-on: ubuntu-latest
52+
strategy:
53+
matrix:
54+
python-version: [ "3.13" ]
55+
steps:
56+
- uses: actions/checkout@v3
57+
- uses: ./.github/actions/setup-python-env
58+
with:
59+
python-version: ${{ matrix.python-version }}
60+
61+
- name: Run coverage analysis
62+
run: |
63+
uv run pytest ${{ env.ALL_SCAN_PATHS }} \
64+
${{ env.COVERAGE_PATHS_FLAGS }} \
65+
--cov-report=xml \
66+
--cov-report=term \
67+
--cov-fail-under=${{ env.COVERAGE_THRESHOLD }}
68+
69+
# - name: Upload coverage to Codecov (optional)
70+
# uses: codecov/codecov-action@v3
71+
# if: always()
72+
# with:
73+
# file: ./coverage.xml
74+
# fail_ci_if_error: false
75+
76+
experiments-check:
77+
name: Experiments Report (Non-blocking)
78+
runs-on: ubuntu-latest
79+
continue-on-error: true # This makes the job non-blocking
80+
strategy:
81+
matrix:
82+
python-version: [ "3.13" ]
83+
steps:
84+
- uses: actions/checkout@v3
85+
- uses: ./.github/actions/setup-python-env
86+
with:
87+
python-version: ${{ matrix.python-version }}
88+
89+
- name: Run Ruff on experiments (non-blocking)
90+
run: |
91+
echo "🧪 Running quality checks on experiments (non-blocking)..."
92+
uv run ruff check --output-format=github ${{ env.EXTRA_SCAN_PATHS }} || echo "⚠️ Ruff found issues in experiments"
93+
94+
- name: Run Vulture on experiments (non-blocking)
95+
run: |
96+
uv run vulture --min-confidence 80 ${{ env.EXTRA_SCAN_PATHS }} || echo "⚠️ Vulture found dead code in experiments"
97+
98+
- name: Run basic tests on experiments (non-blocking)
99+
run: |
100+
if [ -d "${{ env.EXTRA_SCAN_PATHS }}" ]; then
101+
uv run pytest ${{ env.EXTRA_SCAN_PATHS }} --tb=short || echo "⚠️ Some experiment tests failed"
102+
else
103+
echo "📝 No experiments directory found"
104+
fi

.github/workflows/push-checks.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Code Quality
2+
3+
env:
4+
COVERAGE_THRESHOLD: 50
5+
VULTURE_MIN_CONFIDENCE: 80
6+
MAIN_SCAN_PATHS: 'src calmlib tools tests'
7+
EXTRA_SCAN_PATHS: 'experiments'
8+
ALL_SCAN_PATHS: 'src calmlib tools experiments tests'
9+
COVERAGE_PATHS_FLAGS: '--cov=src --cov=calmlib --cov=tools'
10+
11+
on: [ push ]
12+
13+
jobs:
14+
type-check:
15+
name: Pyright
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
python-version: [ "3.13" ]
20+
steps:
21+
- uses: actions/checkout@v3
22+
- uses: ./.github/actions/setup-python-env
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Run Pyright type checker
27+
run: uv run pyright
28+
29+
tests:
30+
name: Tests
31+
runs-on: ubuntu-latest
32+
strategy:
33+
matrix:
34+
python-version: [ "3.13" ]
35+
steps:
36+
- uses: actions/checkout@v3
37+
- uses: ./.github/actions/setup-python-env
38+
with:
39+
python-version: ${{ matrix.python-version }}
40+
41+
- name: Run tests
42+
run: uv run pytest

.github/workflows/release.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)