Files
ystp/.gitea/workflows/ci.yml
237899745 1e0c1ab539
Some checks failed
CI / verify (push) Failing after 1m33s
ci: avoid unavailable Gitea cache backend
2026-07-26 07:05:04 +08:00

90 lines
2.5 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
jobs:
verify:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_PASSWORD: codex_test
POSTGRES_DB: imageforge_test
options: >-
--health-cmd "pg_isready -U postgres -d imageforge_test"
--health-interval 5s
--health-timeout 3s
--health-retries 20
redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 20
env:
DATABASE_URL: postgres://postgres:codex_test@postgres:5432/imageforge_test
REDIS_URL: redis://redis:6379/
IMAGEFORGE_TEST_DATABASE_URL: postgres://postgres:codex_test@postgres:5432/imageforge_test
IMAGEFORGE_TEST_REDIS_URL: redis://redis:6379/
JWT_SECRET: imageforge-ci-jwt-secret
API_KEY_PEPPER: imageforge-ci-api-key-pepper
EXPECTED_EXTERNAL_TESTS: '10'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Verify migration line endings
run: |
python3 - <<'PY'
from pathlib import Path
invalid = []
for path in sorted(Path("migrations").glob("*.sql")):
data = path.read_bytes()
if b"\n" in data.replace(b"\r\n", b""):
invalid.append(str(path))
if invalid:
raise SystemExit("migrations must use CRLF: " + ", ".join(invalid))
PY
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: '1.92'
components: rustfmt, clippy
- name: Check Rust formatting
run: cargo fmt --all -- --check
- name: Run Clippy
run: cargo clippy --all-targets --all-features --locked -- -D warnings
- name: Run Rust tests
run: cargo test --all-targets --locked
- name: Run external-state tests
run: bash scripts/run_external_state_tests.sh
- name: Install cargo-audit
run: cargo install cargo-audit --locked --version 0.22.2
- name: Audit Rust dependencies
run: cargo audit
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Build frontend
working-directory: frontend
run: npm ci && npm run build