mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-06 16:06:08 +00:00
109 lines
2.5 KiB
YAML
109 lines
2.5 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '**'
|
|
pull_request:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
backend:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
postgres:
|
|
image: postgres:18-alpine
|
|
env:
|
|
POSTGRES_DB: codex_proxy
|
|
POSTGRES_USER: codex_proxy
|
|
POSTGRES_PASSWORD: codex_proxy
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U codex_proxy -d codex_proxy"
|
|
--health-interval 5s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
redis:
|
|
image: redis:8-alpine
|
|
ports:
|
|
- 6379:6379
|
|
options: >-
|
|
--health-cmd "redis-cli ping"
|
|
--health-interval 5s
|
|
--health-timeout 5s
|
|
--health-retries 10
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@1.95
|
|
with:
|
|
components: rustfmt,clippy
|
|
|
|
- name: Cache Rust
|
|
uses: Swatinem/rust-cache@v2.9.1
|
|
with:
|
|
workspaces: backend -> target
|
|
|
|
- name: Rust format
|
|
working-directory: backend
|
|
run: cargo fmt --check
|
|
|
|
- name: Rust clippy
|
|
working-directory: backend
|
|
run: cargo clippy --all-targets --all-features --locked -- -D warnings
|
|
|
|
- name: Architecture boundaries
|
|
run: backend/scripts/check_architecture.sh
|
|
|
|
- name: Rust tests
|
|
working-directory: backend
|
|
run: cargo test --test main --locked
|
|
|
|
frontend:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v6
|
|
with:
|
|
version: 11.7.0
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 24
|
|
cache: pnpm
|
|
cache-dependency-path: frontend/pnpm-lock.yaml
|
|
|
|
- name: Install frontend dependencies
|
|
run: pnpm --dir frontend install --frozen-lockfile
|
|
|
|
- name: Frontend format
|
|
run: pnpm --dir frontend format:check
|
|
|
|
- name: Frontend build
|
|
run: pnpm --dir frontend build
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Validate Docker Compose
|
|
run: docker compose -f deploy/docker-compose.yml config
|
|
|
|
- name: Build runtime image
|
|
run: docker build -f deploy/Dockerfile --target runtime -t codex-proxy-rs:ci .
|