Skip to content

Commit c680571

Browse files
Claude/veds handover assessment 01 y rg sb gg n pe zck gdp ch axo j (#3)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6b24e0d commit c680571

44 files changed

Lines changed: 6683 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 365 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,365 @@
1+
name: CI Pipeline
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
RUST_VERSION: "1.75"
12+
ELIXIR_VERSION: "1.16"
13+
OTP_VERSION: "26"
14+
JULIA_VERSION: "1.10"
15+
16+
jobs:
17+
# ===========================================================================
18+
# Rust Optimizer
19+
# ===========================================================================
20+
rust-build:
21+
name: Rust Build & Test
22+
runs-on: ubuntu-latest
23+
defaults:
24+
run:
25+
working-directory: src/rust-routing
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Install Rust
30+
uses: dtolnay/rust-action@stable
31+
with:
32+
toolchain: ${{ env.RUST_VERSION }}
33+
components: clippy, rustfmt
34+
35+
- name: Cache cargo
36+
uses: actions/cache@v4
37+
with:
38+
path: |
39+
~/.cargo/bin/
40+
~/.cargo/registry/index/
41+
~/.cargo/registry/cache/
42+
~/.cargo/git/db/
43+
src/rust-routing/target/
44+
key: ${{ runner.os }}-cargo-${{ hashFiles('src/rust-routing/Cargo.lock') }}
45+
46+
- name: Install protoc
47+
run: |
48+
sudo apt-get update
49+
sudo apt-get install -y protobuf-compiler
50+
51+
- name: Check formatting
52+
run: cargo fmt --all -- --check
53+
54+
- name: Clippy
55+
run: cargo clippy --all-targets --all-features -- -D warnings
56+
57+
- name: Build
58+
run: cargo build --release
59+
60+
- name: Test
61+
run: cargo test --all-features
62+
63+
- name: Upload artifact
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: rust-optimizer
67+
path: src/rust-routing/target/release/veds-optimizer
68+
69+
# ===========================================================================
70+
# Elixir API
71+
# ===========================================================================
72+
elixir-build:
73+
name: Elixir Build & Test
74+
runs-on: ubuntu-latest
75+
defaults:
76+
run:
77+
working-directory: src/elixir-api
78+
services:
79+
postgres:
80+
image: postgres:16
81+
env:
82+
POSTGRES_USER: postgres
83+
POSTGRES_PASSWORD: postgres
84+
POSTGRES_DB: veds_test
85+
ports:
86+
- 5432:5432
87+
options: >-
88+
--health-cmd pg_isready
89+
--health-interval 10s
90+
--health-timeout 5s
91+
--health-retries 5
92+
steps:
93+
- uses: actions/checkout@v4
94+
95+
- name: Setup Elixir
96+
uses: erlef/setup-beam@v1
97+
with:
98+
elixir-version: ${{ env.ELIXIR_VERSION }}
99+
otp-version: ${{ env.OTP_VERSION }}
100+
101+
- name: Cache deps
102+
uses: actions/cache@v4
103+
with:
104+
path: |
105+
src/elixir-api/deps
106+
src/elixir-api/_build
107+
key: ${{ runner.os }}-mix-${{ hashFiles('src/elixir-api/mix.lock') }}
108+
109+
- name: Install dependencies
110+
run: mix deps.get
111+
112+
- name: Check formatting
113+
run: mix format --check-formatted
114+
115+
- name: Compile (warnings as errors)
116+
run: mix compile --warnings-as-errors
117+
118+
- name: Run tests
119+
run: mix test
120+
env:
121+
DATABASE_URL: postgres://postgres:postgres@localhost:5432/veds_test
122+
MIX_ENV: test
123+
124+
# ===========================================================================
125+
# Clojure Constraints
126+
# ===========================================================================
127+
clojure-build:
128+
name: Clojure Build & Test
129+
runs-on: ubuntu-latest
130+
defaults:
131+
run:
132+
working-directory: src/clojure-constraints
133+
steps:
134+
- uses: actions/checkout@v4
135+
136+
- name: Setup Java
137+
uses: actions/setup-java@v4
138+
with:
139+
distribution: 'temurin'
140+
java-version: '21'
141+
142+
- name: Setup Clojure
143+
uses: DeLaGuardo/setup-clojure@12.5
144+
with:
145+
cli: 1.11.1.1435
146+
147+
- name: Cache deps
148+
uses: actions/cache@v4
149+
with:
150+
path: ~/.m2/repository
151+
key: ${{ runner.os }}-clj-${{ hashFiles('src/clojure-constraints/deps.edn') }}
152+
153+
- name: Run tests
154+
run: clojure -M:test
155+
156+
- name: Build uberjar
157+
run: clojure -T:build uber
158+
159+
# ===========================================================================
160+
# Julia Visualization
161+
# ===========================================================================
162+
julia-build:
163+
name: Julia Build & Test
164+
runs-on: ubuntu-latest
165+
defaults:
166+
run:
167+
working-directory: src/julia-viz
168+
steps:
169+
- uses: actions/checkout@v4
170+
171+
- name: Setup Julia
172+
uses: julia-actions/setup-julia@v1
173+
with:
174+
version: ${{ env.JULIA_VERSION }}
175+
176+
- name: Cache Julia packages
177+
uses: actions/cache@v4
178+
with:
179+
path: |
180+
~/.julia/artifacts
181+
~/.julia/packages
182+
key: ${{ runner.os }}-julia-${{ hashFiles('src/julia-viz/Project.toml') }}
183+
184+
- name: Install dependencies
185+
run: julia --project=. -e 'using Pkg; Pkg.instantiate()'
186+
187+
- name: Run tests
188+
run: julia --project=. -e 'using Pkg; Pkg.test()'
189+
190+
# ===========================================================================
191+
# Ada/SPARK Verification
192+
# ===========================================================================
193+
ada-verify:
194+
name: Ada/SPARK Verification
195+
runs-on: ubuntu-latest
196+
defaults:
197+
run:
198+
working-directory: src/ada-spark-verify
199+
steps:
200+
- uses: actions/checkout@v4
201+
202+
- name: Setup GNAT
203+
run: |
204+
sudo apt-get update
205+
sudo apt-get install -y gnat gprbuild
206+
207+
- name: Build
208+
run: gprbuild -P veds_verify.gpr -XMODE=release
209+
210+
- name: Run verification tests
211+
run: ./bin/veds_verify
212+
213+
# SPARK proof (optional, requires SPARK Pro or Community)
214+
# - name: Run SPARK proofs
215+
# run: gnatprove -P veds_verify.gpr --level=2
216+
217+
# ===========================================================================
218+
# Integration Tests
219+
# ===========================================================================
220+
integration-tests:
221+
name: Integration Tests
222+
runs-on: ubuntu-latest
223+
needs: [rust-build, elixir-build, clojure-build]
224+
steps:
225+
- uses: actions/checkout@v4
226+
227+
- name: Setup Python
228+
uses: actions/setup-python@v5
229+
with:
230+
python-version: '3.12'
231+
232+
- name: Install test dependencies
233+
run: pip install -r tests/integration/requirements.txt
234+
235+
- name: Run integration tests
236+
run: pytest tests/integration/ -v --tb=short
237+
env:
238+
HYPOTHESIS_PROFILE: ci
239+
240+
# ===========================================================================
241+
# Property Tests
242+
# ===========================================================================
243+
property-tests:
244+
name: Property-Based Tests
245+
runs-on: ubuntu-latest
246+
steps:
247+
- uses: actions/checkout@v4
248+
249+
- name: Setup Python
250+
uses: actions/setup-python@v5
251+
with:
252+
python-version: '3.12'
253+
254+
- name: Install test dependencies
255+
run: pip install -r tests/integration/requirements.txt
256+
257+
- name: Run property tests
258+
run: pytest tests/property/ -v --hypothesis-profile=ci
259+
260+
# ===========================================================================
261+
# Security Scanning
262+
# ===========================================================================
263+
security-scan:
264+
name: Security Scan
265+
runs-on: ubuntu-latest
266+
steps:
267+
- uses: actions/checkout@v4
268+
269+
- name: Run Trivy vulnerability scanner
270+
uses: aquasecurity/trivy-action@master
271+
with:
272+
scan-type: 'fs'
273+
scan-ref: '.'
274+
severity: 'CRITICAL,HIGH'
275+
exit-code: '1'
276+
277+
- name: Rust audit
278+
working-directory: src/rust-routing
279+
run: |
280+
cargo install cargo-audit
281+
cargo audit
282+
283+
# ===========================================================================
284+
# Build and Push Images
285+
# ===========================================================================
286+
build-images:
287+
name: Build Container Images
288+
runs-on: ubuntu-latest
289+
needs: [rust-build, elixir-build, clojure-build, julia-build, integration-tests]
290+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
291+
permissions:
292+
contents: read
293+
packages: write
294+
strategy:
295+
matrix:
296+
service:
297+
- name: rust-optimizer
298+
context: src/rust-routing
299+
- name: elixir-api
300+
context: src/elixir-api
301+
- name: clojure-constraints
302+
context: src/clojure-constraints
303+
- name: julia-viz
304+
context: src/julia-viz
305+
steps:
306+
- uses: actions/checkout@v4
307+
308+
- name: Set up Docker Buildx
309+
uses: docker/setup-buildx-action@v3
310+
311+
- name: Login to GHCR
312+
uses: docker/login-action@v3
313+
with:
314+
registry: ${{ env.REGISTRY }}
315+
username: ${{ github.actor }}
316+
password: ${{ secrets.GITHUB_TOKEN }}
317+
318+
- name: Extract metadata
319+
id: meta
320+
uses: docker/metadata-action@v5
321+
with:
322+
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/veds-${{ matrix.service.name }}
323+
tags: |
324+
type=sha,prefix=
325+
type=ref,event=branch
326+
type=semver,pattern={{version}}
327+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
328+
329+
- name: Build and push
330+
uses: docker/build-push-action@v5
331+
with:
332+
context: ${{ matrix.service.context }}
333+
push: true
334+
tags: ${{ steps.meta.outputs.tags }}
335+
labels: ${{ steps.meta.outputs.labels }}
336+
cache-from: type=gha
337+
cache-to: type=gha,mode=max
338+
339+
# ===========================================================================
340+
# Update ArgoCD
341+
# ===========================================================================
342+
update-argocd:
343+
name: Update ArgoCD Image Tags
344+
runs-on: ubuntu-latest
345+
needs: [build-images]
346+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
347+
steps:
348+
- uses: actions/checkout@v4
349+
350+
- name: Update image tags in kustomization
351+
run: |
352+
cd deploy/k3s/base
353+
kustomize edit set image \
354+
ghcr.io/veds/rust-optimizer=ghcr.io/${{ github.repository_owner }}/veds-rust-optimizer:${{ github.sha }} \
355+
ghcr.io/veds/elixir-api=ghcr.io/${{ github.repository_owner }}/veds-elixir-api:${{ github.sha }} \
356+
ghcr.io/veds/clojure-constraints=ghcr.io/${{ github.repository_owner }}/veds-clojure-constraints:${{ github.sha }} \
357+
ghcr.io/veds/julia-viz=ghcr.io/${{ github.repository_owner }}/veds-julia-viz:${{ github.sha }}
358+
359+
- name: Commit and push
360+
run: |
361+
git config user.name "GitHub Actions"
362+
git config user.email "actions@github.com"
363+
git add deploy/
364+
git commit -m "ci: update image tags to ${{ github.sha }}" || exit 0
365+
git push

0 commit comments

Comments
 (0)