-
Notifications
You must be signed in to change notification settings - Fork 0
151 lines (123 loc) · 4.77 KB
/
Copy pathci.yml
File metadata and controls
151 lines (123 loc) · 4.77 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
name: CI
on:
pull_request:
branches: [main, master]
push:
branches: [main, master]
workflow_call:
env:
CARGO_TERM_COLOR: always
DATABASE_URL: postgresql://rantai_billing:rantai_billing@localhost:5444/rantai_billing_test
jobs:
frontend-tests:
name: Next.js Frontend Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Lint
run: bun lint
- name: Type check
run: bun run build
- name: Run tests
run: bunx vitest run
rust-tests:
name: Rust Backend Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_USER: rantai_billing
POSTGRES_PASSWORD: rantai_billing
POSTGRES_DB: rantai_billing_test
ports:
- 5444:5432
options: >-
--health-cmd "pg_isready -U rantai_billing -d rantai_billing_test"
--health-interval 5s
--health-timeout 3s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: rustbill
- uses: Swatinem/rust-cache@v2
with:
workspaces: rustbill
- name: Check formatting
working-directory: rustbill
run: cargo fmt --all -- --check
- name: Clippy
working-directory: rustbill
run: cargo clippy --all-targets -- -D warnings 2>/dev/null || cargo clippy --all-targets
- name: Build
working-directory: rustbill
run: cargo build --tests
- name: Run tests
working-directory: rustbill
run: cargo test -- --test-threads=1
env:
DATABASE_URL: postgresql://rantai_billing:rantai_billing@localhost:5444/rantai_billing_test
- name: Sales ledger reconciliation gates
working-directory: rustbill
run: cargo test --test analytics analytics_sales_360_backfill_is_idempotent -- --test-threads=1 && cargo test --test analytics analytics_sales_360_reconcile_returns_drift_shape -- --test-threads=1 && cargo test --test analytics analytics_sales_360_summary_supports_currency_breakdown -- --test-threads=1 && cargo test --test analytics analytics_sales_events_partition_maintenance_creates_future_partition -- --test-threads=1 && cargo test --test analytics analytics_sales_events_partition_prunes_out_of_window_partition -- --test-threads=1 && cargo test --test invoices deleting_invoice_emits_reversal_with_metadata -- --test-threads=1 && cargo test --test deals updating_deal_emits_reversal_and_replacement_events -- --test-threads=1 && cargo test --test refunds deleting_completed_refund_emits_reversal_metadata -- --test-threads=1 && cargo test --test credit_notes deleting_credit_note_emits_reversal_with_metadata -- --test-threads=1
env:
DATABASE_URL: postgresql://rantai_billing:rantai_billing@localhost:5444/rantai_billing_test
e2e-core:
name: Frontend-to-Backend E2E Core
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine
env:
POSTGRES_USER: rantai_billing
POSTGRES_PASSWORD: rantai_billing
POSTGRES_DB: rantai_billing_test
ports:
- 5444:5432
options: >-
--health-cmd "pg_isready -U rantai_billing -d rantai_billing_test"
--health-interval 5s
--health-timeout 3s
--health-retries 5
env:
DATABASE_URL: postgresql://rantai_billing:rantai_billing@localhost:5444/rantai_billing_test
RUST_BACKEND_URL: http://127.0.0.1:8787
E2E_ADMIN_EMAIL: admin@rustbill.local
E2E_ADMIN_PASSWORD: admin123
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Install Playwright browser
run: bunx playwright install --with-deps chromium
- name: Prebuild Rust API for e2e web server
working-directory: rustbill
run: cargo build -p rustbill-server
- name: Run smoke E2E
run: bun run test:e2e:smoke
- name: Run core E2E
run: bun run test:e2e:full
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report-core
path: playwright-report/
- name: Upload Playwright traces
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-test-results-core
path: test-results/