-
Notifications
You must be signed in to change notification settings - Fork 14
146 lines (117 loc) 路 4.04 KB
/
Copy pathquality.yml
File metadata and controls
146 lines (117 loc) 路 4.04 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Flock Quality Gates CI/CD
# Runs comprehensive quality checks on all pull requests and pushes
# Matches pre-commit hooks with additional test coverage requirements
name: Quality Gates
on:
push:
branches:
- main # Replace with your default branch
- 0.5.0b
pull_request:
branches:
- main # Replace with your default branch
- 0.5.0b
jobs:
# Backend quality checks
backend-quality:
name: Backend Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install dependencies
run: |
export PATH="$HOME/.cargo/bin:$PATH"
uv sync --dev --all-groups --all-extras
- name: Lint with Ruff
run: |
export PATH="$HOME/.cargo/bin:$PATH"
uv run ruff check src/flock/ --fix --exit-zero
- name: Format check with Ruff
run: |
export PATH="$HOME/.cargo/bin:$PATH"
uv run ruff format --check src/flock/
- name: Run tests with coverage
run: |
export PATH="$HOME/.cargo/bin:$PATH"
uv run pytest --cov=src/flock --cov-branch --cov-report=xml --cov-report=term --cov-fail-under=75
- name: Extract test metrics
id: test-metrics
run: |
export PATH="$HOME/.cargo/bin:$PATH"
# Count total tests
TEST_COUNT=$(uv run pytest --collect-only -q | tail -n 1 | awk '{print $1}')
echo "test_count=$TEST_COUNT" >> $GITHUB_OUTPUT
echo "馃搳 Total tests: $TEST_COUNT"
# Extract coverage percentage from XML
COVERAGE=$(python -c "import xml.etree.ElementTree as ET; tree = ET.parse('coverage.xml'); root = tree.getroot(); print(f\"{float(root.attrib['line-rate']) * 100:.0f}\")")
echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT
echo "馃搱 Coverage: $COVERAGE%"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: backend
name: backend-coverage
fail_ci_if_error: false
- name: Backend build check
run: |
export PATH="$HOME/.cargo/bin:$PATH"
uv build
# Frontend quality checks
frontend-quality:
name: Frontend Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: src/flock/frontend/package-lock.json
- name: Install dependencies
working-directory: src/flock/frontend
run: npm ci
- name: Type check
working-directory: src/flock/frontend
run: npm run type-check
- name: Run tests
working-directory: src/flock/frontend
run: npm test
# Coverage disabled until vitest.config.ts is properly configured
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# file: ./frontend/coverage/coverage-final.json
# flags: frontend
# name: frontend-coverage
- name: Frontend build check
working-directory: src/flock/frontend
run: npm run build
# Security scanning
security-scan:
name: Security Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install dependencies
run: |
export PATH="$HOME/.cargo/bin:$PATH"
uv sync --dev --all-groups --all-extras
- name: Run Bandit security scan
run: |
export PATH="$HOME/.cargo/bin:$PATH"
uv run bandit -c pyproject.toml -r src/flock/ -ll