-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
245 lines (216 loc) · 4.75 KB
/
.gitlab-ci.yml
File metadata and controls
245 lines (216 loc) · 4.75 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# GitLab CI/CD Configuration for Mobile AI Orchestrator
# RSR Bronze Compliant
stages:
- check
- test
- build
- deploy
# Global variables
variables:
CARGO_HOME: $CI_PROJECT_DIR/.cargo
RUST_VERSION: "1.75"
# Cache Cargo dependencies
cache:
paths:
- .cargo/
- target/
# Template for Rust jobs
.rust_template:
image: rust:${RUST_VERSION}
before_script:
- rustc --version
- cargo --version
- apt-get update && apt-get install -y just
# === CHECK STAGE ===
format:check:
extends: .rust_template
stage: check
script:
- cargo fmt --check
only:
- merge_requests
- main
clippy:lint:
extends: .rust_template
stage: check
script:
- cargo clippy --all-targets --all-features -- -D warnings
only:
- merge_requests
- main
security:audit:
extends: .rust_template
stage: check
script:
- cargo install cargo-audit
- cargo audit
allow_failure: true
only:
- merge_requests
- main
rsr:compliance:
extends: .rust_template
stage: check
script:
- just rsr-compliance
only:
- merge_requests
- main
# === TEST STAGE ===
test:unit:
extends: .rust_template
stage: test
script:
- cargo test --verbose
coverage: '/^\s*lines:\s*\d+\.\d+%/'
artifacts:
reports:
junit: target/test-results.xml
only:
- merge_requests
- main
test:coverage:
extends: .rust_template
stage: test
script:
- cargo install cargo-tarpaulin
- cargo tarpaulin --out Xml --output-dir target/coverage
artifacts:
paths:
- target/coverage/
reports:
coverage_report:
coverage_format: cobertura
path: target/coverage/cobertura.xml
coverage: '/^\d+\.\d+% coverage/'
only:
- main
# === BUILD STAGE ===
build:debug:
extends: .rust_template
stage: build
script:
- cargo build --verbose
artifacts:
paths:
- target/debug/mobile-ai
expire_in: 1 week
only:
- merge_requests
- main
build:release:
extends: .rust_template
stage: build
script:
- cargo build --release --verbose
artifacts:
paths:
- target/release/mobile-ai
expire_in: 1 month
only:
- main
- tags
build:network:
extends: .rust_template
stage: build
script:
- cargo build --release --features network --verbose
artifacts:
paths:
- target/release/mobile-ai
expire_in: 1 month
only:
- tags
# Cross-compilation for Android (ARM64)
build:android:
extends: .rust_template
stage: build
script:
- rustup target add aarch64-linux-android
- cargo build --target aarch64-linux-android --release
artifacts:
paths:
- target/aarch64-linux-android/release/mobile-ai
expire_in: 1 month
only:
- tags
allow_failure: true # May fail if NDK not configured
# === DEPLOY STAGE ===
pages:
extends: .rust_template
stage: deploy
script:
- cargo doc --no-deps
- mkdir -p public
- cp -r target/doc/* public/
- echo '<meta http-equiv="refresh" content="0; url=mobile_ai_orchestrator">' > public/index.html
artifacts:
paths:
- public
only:
- main
# Release artifacts (for tags)
release:artifacts:
extends: .rust_template
stage: deploy
script:
- cargo build --release
- mkdir -p release
- cp target/release/mobile-ai release/mobile-ai-${CI_COMMIT_TAG}
- tar -czf release/mobile-ai-${CI_COMMIT_TAG}.tar.gz -C target/release mobile-ai
- sha256sum release/mobile-ai-${CI_COMMIT_TAG}.tar.gz > release/mobile-ai-${CI_COMMIT_TAG}.tar.gz.sha256
artifacts:
paths:
- release/
expire_in: never
only:
- tags
# === SCHEDULED JOBS ===
# Nightly build (catch regressions)
nightly:build:
extends: .rust_template
stage: build
script:
- cargo build --release
- cargo test
only:
- schedules
allow_failure: true
# Dependency updates check
nightly:deps:
extends: .rust_template
stage: check
script:
- cargo install cargo-outdated
- cargo outdated
only:
- schedules
allow_failure: true
# === DOCKER BUILD (Future) ===
# Uncomment when Docker deployment is needed
# docker:build:
# stage: deploy
# image: docker:latest
# services:
# - docker:dind
# script:
# - docker build -t mobile-ai:${CI_COMMIT_TAG} .
# - docker push mobile-ai:${CI_COMMIT_TAG}
# only:
# - tags
# === RULES ===
# Only run on MRs and main branch by default
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_TAG
- if: $CI_PIPELINE_SOURCE == "schedule"
# === OPTIONAL: Notifications ===
# notify:slack:
# stage: .post
# script:
# - 'curl -X POST -H "Content-type: application/json" --data "{\"text\":\"Pipeline $CI_PIPELINE_ID finished with status: $CI_JOB_STATUS\"}" $SLACK_WEBHOOK_URL'
# when: on_failure
# only:
# - main