-
Notifications
You must be signed in to change notification settings - Fork 17
162 lines (138 loc) · 4.96 KB
/
ci-quick.yml
File metadata and controls
162 lines (138 loc) · 4.96 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
name: CI - Quick Check
# Fast feedback loop for PRs and commits
# Runs only critical tests with maximum parallelization
# Full test suite runs on main branch or can be triggered manually
on:
push:
branches-ignore: [ main ]
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: '20.x'
PYTHON_VERSION: '3.10'
jobs:
# ============================================
# Quick validation (lint, type check, fast tests)
# ============================================
quick-check:
name: Quick Validation
runs-on: ubuntu-latest
timeout-minutes: 10
services:
redis:
image: redis:7-alpine
ports:
- 6379:6379
mongodb:
image: mongo:6
ports:
- 27017:27017
env:
MONGO_INITDB_ROOT_USERNAME: testuser
MONGO_INITDB_ROOT_PASSWORD: testpass
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: 'frontend/package-lock.json'
- name: Install Python dependencies
run: |
cd backend
pip install -r requirements.txt
pip install pytest-cov pytest-xdist pytest-timeout flake8 black PyNaCl base58
- name: Install Node dependencies
run: |
cd frontend
npm ci
- name: Python linting (flake8)
continue-on-error: true
run: |
cd backend
flake8 routes/ services/ middleware/ --max-line-length=120 --statistics || true
- name: Python formatting check (black)
continue-on-error: true
run: |
cd backend
black --check routes/ services/ middleware/ --line-length=120 || true
- name: Generate signing keys
id: gen_keys
run: |
cd backend
python gen_keys.py > keys_output.txt
PUBLIC_KEY=$(grep "PUBLIC KEY:" keys_output.txt | awk '{print $3}')
PRIVATE_KEY=$(grep "PRIVATE KEY:" keys_output.txt | awk '{print $3}')
echo "public_key=$PUBLIC_KEY" >> $GITHUB_OUTPUT
echo "private_key=$PRIVATE_KEY" >> $GITHUB_OUTPUT
rm keys_output.txt
- name: Create backend .env
run: |
cd backend
printf '%s\n' \
"MONGO_ATLAS_URI=mongodb://testuser:testpass@localhost:27017/?authSource=admin" \
"REDIS_HOST=localhost" \
"REDIS_PORT=6379" \
"SIGNER_PUBLIC_KEY=${{ steps.gen_keys.outputs.public_key }}" \
"SIGNER_PRIVATE_KEY=${{ steps.gen_keys.outputs.private_key }}" \
"RESILIENTDB_BASE_URI=https://crow.resilientdb.com" \
"RES_DB_BASE_URI=https://crow.resilientdb.com" \
"RESILIENTDB_GRAPHQL_URI=https://cloud.resilientdb.com/graphql" \
"JWT_SECRET=test-secret-key-do-not-use-in-production" > .env
- name: Run backend unit tests only (fast)
# wait for mongodb to be ready on localhost:27017
- name: Wait for MongoDB
run: |
for i in {1..30}; do
if nc -z localhost 27017; then
echo "MongoDB is ready"
break
fi
echo "Waiting for MongoDB... ($i)"
sleep 2
done
- name: Run backend unit tests only (fast)
run: |
cd backend
pytest tests/unit/ -n auto -v --tb=short \
--maxfail=5 \
--timeout=30 \
-q
- name: Run frontend unit tests (fast)
run: |
cd frontend
npm test -- --watchAll=false --maxWorkers=4 \
--testPathIgnorePatterns='Canvas.test.js|Dashboard.test.js|App.test.js' \
--coverage=false \
--ci
- name: Build check (frontend)
run: |
cd frontend
npm run build
- name: Comment PR with quick results
if: github.event_name == 'pull_request' && always()
uses: actions/github-script@v7
with:
script: |
const jobStatus = '${{ job.status }}';
const emoji = jobStatus === 'success' ? '✅' : '❌';
const summary = `${emoji} **Quick Check ${jobStatus}**
Fast validation completed for commit ${{ github.sha }}
This is a quick feedback run. Full test suite will run on merge to main.
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: summary
});