-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (144 loc) · 4.9 KB
/
Copy pathci.yml
File metadata and controls
165 lines (144 loc) · 4.9 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# Cross-Platform CI Pipeline
#
# Tests on all target platforms (Linux, Windows, macOS) to catch
# platform-specific bugs before they merge. ALL platforms must pass.
#
# Optimized: Reduced matrix (4 jobs vs 6), merged integration tests,
# coverage on Linux only, path filters to skip on docs-only changes.
name: CI
on:
push:
branches: [main, develop]
paths:
- 'apps/**'
- 'tests/**'
- 'package*.json'
- 'requirements*.txt'
- 'pyproject.toml'
- 'tsconfig*.json'
- 'biome.jsonc'
- '.github/workflows/ci.yml'
- '.github/actions/**'
pull_request:
branches: [main, develop]
paths:
- 'apps/**'
- 'tests/**'
- 'package*.json'
- 'requirements*.txt'
- 'pyproject.toml'
- 'tsconfig*.json'
- 'biome.jsonc'
- '.github/workflows/ci.yml'
- '.github/actions/**'
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
actions: read
jobs:
# --------------------------------------------------------------------------
# Python Backend Tests - Optimized Matrix (4 jobs instead of 6)
# --------------------------------------------------------------------------
test-python:
name: test-python (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# 3.12 on all OS for cross-platform coverage
# 3.13 on Linux only for compatibility check (saves 2 jobs)
include:
- os: ubuntu-latest
python-version: '3.12'
- os: ubuntu-latest
python-version: '3.13'
- os: windows-latest
python-version: '3.12'
- os: macos-latest
python-version: '3.12'
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Setup Python backend
uses: ./.github/actions/setup-python-backend
with:
python-version: ${{ matrix.python-version }}
install-test-deps: 'true'
- name: Run all tests (including platform-specific)
working-directory: apps/backend
shell: bash
env:
PYTHONPATH: ${{ github.workspace }}/apps/backend
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
source .venv/Scripts/activate
else
source .venv/bin/activate
fi
pytest ../../tests/ -v --tb=short -x
- name: Run coverage (Linux + Python 3.12 only)
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
working-directory: apps/backend
shell: bash
env:
PYTHONPATH: ${{ github.workspace }}/apps/backend
run: |
source .venv/bin/activate
pytest ../../tests/ -v --cov=. --cov-report=xml --cov-report=term-missing --cov-fail-under=10
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: codecov/codecov-action@v7
with:
file: ./apps/backend/coverage.xml
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# --------------------------------------------------------------------------
# Frontend Tests - All Platforms
# --------------------------------------------------------------------------
test-frontend:
name: test-frontend (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Setup Node.js frontend
uses: ./.github/actions/setup-node-frontend
with:
ignore-scripts: 'true'
- name: Run TypeScript type check
working-directory: apps/frontend
run: npm run typecheck
- name: Run unit tests
working-directory: apps/frontend
run: npm run test
- name: Build application
working-directory: apps/frontend
run: npm run build
# --------------------------------------------------------------------------
# Gate Job - Single check for branch protection
# --------------------------------------------------------------------------
ci-complete:
name: CI Complete
runs-on: ubuntu-latest
needs: [test-python, test-frontend]
if: always()
steps:
- name: Check all CI jobs passed
run: |
echo "CI Job Results:"
echo " test-python: ${{ needs.test-python.result }}"
echo " test-frontend: ${{ needs.test-frontend.result }}"
echo ""
if [[ "${{ needs.test-python.result }}" != "success" ]] || \
[[ "${{ needs.test-frontend.result }}" != "success" ]]; then
echo "❌ One or more CI jobs failed"
exit 1
fi
echo "✅ All CI checks passed"