-
Notifications
You must be signed in to change notification settings - Fork 24
158 lines (132 loc) · 4.1 KB
/
ci.yml
File metadata and controls
158 lines (132 loc) · 4.1 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
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
# Fast smoke tests run first to fail fast
smoke:
name: Smoke Tests (typecheck, lint, unit)
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.10"
- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: |
node_modules
~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install frontend dependencies
run: bun install --frozen-lockfile
- name: Run smoke tests
run: bun run typecheck && bun run lint && bun run test:unit && bun run test:service
rust-check:
name: Rust Check
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev libssl-dev
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri -> src-tauri/target
- name: Run rust check
run: cargo check --manifest-path src-tauri/Cargo.toml --all-targets
# Parallel database integration tests
integration:
name: Integration Tests (${{ matrix.database }})
runs-on: ubuntu-22.04
needs: [smoke, rust-check]
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
database:
- mysql
- postgres
- mariadb
- clickhouse
- mssql
- sqlite
- duckdb
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.10"
- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: |
node_modules
~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install frontend dependencies
run: bun install --frozen-lockfile
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev libssl-dev
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri -> src-tauri/target
key: ${{ matrix.database }}
- name: Run ${{ matrix.database }} integration tests
run: IT_DB=${{ matrix.database }} bun run test:integration
- name: Docker diagnostics on failure
if: failure()
run: |
echo "==== docker ps -a ===="
docker ps -a || true
echo "==== Container logs ===="
docker ps -aq | xargs -I {} sh -c 'echo "--- Container {} ---" && docker logs {} 2>&1 | tail -50' || true
# Summary job to check all tests passed
ci-success:
name: CI Success
runs-on: ubuntu-22.04
needs: [smoke, rust-check, integration]
if: always()
steps:
- name: Check all jobs succeeded
run: |
if [ "${{ needs.smoke.result }}" != "success" ]; then
echo "Smoke tests failed"
exit 1
fi
if [ "${{ needs.rust-check.result }}" != "success" ]; then
echo "Rust check failed"
exit 1
fi
if [ "${{ needs.integration.result }}" != "success" ]; then
echo "Integration tests failed"
exit 1
fi
echo "All CI checks passed!"