-
Notifications
You must be signed in to change notification settings - Fork 65
185 lines (160 loc) · 5.56 KB
/
Copy pathci-database.yml
File metadata and controls
185 lines (160 loc) · 5.56 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Database CI
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: database-ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
name: Classify changes
runs-on: ubuntu-latest
outputs:
swift_database: ${{ steps.classify.outputs.swift_database }}
rust_database: ${{ steps.classify.outputs.rust_database }}
steps:
- name: Check out source
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Resolve comparison base
id: base
env:
EVENT_NAME: ${{ github.event_name }}
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PUSH_BASE_SHA: ${{ github.event.before }}
shell: bash
run: |
if [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then
echo "manual=true" >> "$GITHUB_OUTPUT"
exit 0
fi
base_sha="$PUSH_BASE_SHA"
if [[ "$EVENT_NAME" == "pull_request" ]]; then
base_sha="$PR_BASE_SHA"
fi
{
echo "manual=false"
echo "base_sha=$base_sha"
} >> "$GITHUB_OUTPUT"
- name: Classify changed paths
id: classify
env:
MANUAL: ${{ steps.base.outputs.manual }}
BASE_SHA: ${{ steps.base.outputs.base_sha }}
shell: bash
run: |
if [[ "$MANUAL" == "true" ]]; then
{
echo "swift_database=true"
echo "rust_database=true"
} >> "$GITHUB_OUTPUT"
exit 0
fi
./scripts/classify-ci-changes.sh "$BASE_SHA" "$GITHUB_SHA" >> "$GITHUB_OUTPUT"
- name: Summarize selected lanes
shell: bash
env:
SWIFT_DATABASE: ${{ steps.classify.outputs.swift_database }}
RUST_DATABASE: ${{ steps.classify.outputs.rust_database }}
run: |
{
echo "### Database CI lanes"
echo "| Lane | Run |"
echo "| --- | --- |"
echo "| Swift database tests | $SWIFT_DATABASE |"
echo "| Rust database tests | $RUST_DATABASE |"
} >> "$GITHUB_STEP_SUMMARY"
swift-database-tests:
name: Swift database tests
needs: changes
if: needs.changes.outputs.swift_database == 'true'
runs-on: macos-14
timeout-minutes: 20
steps:
- name: Check out source
uses: actions/checkout@v7
- name: Set up Swift
uses: swift-actions/setup-swift@v2
with:
swift-version: "6.2"
- name: Prepare verified SwiftPM cache
uses: ./.github/actions/prepare-macos-dependency-cache
with:
swiftpm: "true"
- name: Run database-focused Swift tests
timeout-minutes: 12
run: ./.agents/skills/write-stable-tests/scripts/test-stability-macos.sh --report .artifacts/test-stability/macos-database.json --suite-timeout-seconds 660 -- --filter '(LitheDatabaseModuleTests|LitheTests\.LitheCoreLogicTests/database)'
- name: Generate combined database test report
if: always()
run: node .agents/skills/write-stable-tests/scripts/generate-test-report.mjs
- name: Upload database test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-stability-database
path: .artifacts/test-stability/
if-no-files-found: ignore
retention-days: 14
rust-database-tests:
name: Rust database tests
needs: changes
if: needs.changes.outputs.rust_database == 'true'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out source
uses: actions/checkout@v7
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Restore Cargo dependencies
uses: actions/cache@v6
with:
path: |
~/.cargo/git
~/.cargo/registry
key: cargo-dependencies-${{ runner.os }}-${{ hashFiles('rust/Cargo.lock') }}
- name: Validate database container configuration
run: docker compose -f infra/docker/database-validation/compose.yaml config --quiet
- name: Check formatting and test database crates
run: |
cargo fmt --manifest-path rust/Cargo.toml -p lithe-db-sidecar -p lithe-db-mcp -- --check
cargo test --manifest-path rust/Cargo.toml -p lithe-db-sidecar
cargo test --manifest-path rust/Cargo.toml -p lithe-db-mcp
gate:
name: Database CI gate
needs:
- changes
- swift-database-tests
- rust-database-tests
if: always()
runs-on: ubuntu-latest
steps:
- name: Verify required jobs
env:
CHANGES_RESULT: ${{ needs.changes.result }}
SWIFT_DATABASE_SELECTED: ${{ needs.changes.outputs.swift_database }}
RUST_DATABASE_SELECTED: ${{ needs.changes.outputs.rust_database }}
SWIFT_DATABASE_RESULT: ${{ needs.swift-database-tests.result }}
RUST_DATABASE_RESULT: ${{ needs.rust-database-tests.result }}
shell: bash
run: |
[[ "$CHANGES_RESULT" == "success" ]]
require_selected_job() {
local selected="$1"
local result="$2"
if [[ "$selected" == "true" ]]; then
[[ "$result" == "success" ]]
else
[[ "$result" == "skipped" ]]
fi
}
require_selected_job "$SWIFT_DATABASE_SELECTED" "$SWIFT_DATABASE_RESULT"
require_selected_job "$RUST_DATABASE_SELECTED" "$RUST_DATABASE_RESULT"