Skip to content

feat(core): implement explicit service dependency injection and plugi… #120

feat(core): implement explicit service dependency injection and plugi…

feat(core): implement explicit service dependency injection and plugi… #120

Workflow file for this run

# LinaPro backend main CI workflow.
# Runs on every push and pull request branch.
name: Main CI
on:
push:
branches:
- '**'
workflow_dispatch:
inputs:
debug:
type: boolean
description: 'Enable tmate Debug'
required: false
default: false
# Cancel in-progress runs for the same branch/PR to save CI minutes.
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
env:
TZ: "Asia/Shanghai"
jobs:
openspec-changes-complete:
name: OpenSpec changes complete
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Setup Node
uses: actions/setup-node@v5
with:
node-version-file: "apps/lina-vben/.node-version"
- name: Verify active OpenSpec changes are complete
run: |
npx -y @fission-ai/openspec@1.3.1 list --json > /tmp/openspec-changes.json
node <<'NODE'
const fs = require('node:fs');
const data = JSON.parse(fs.readFileSync('/tmp/openspec-changes.json', 'utf8'));
const changes = Array.isArray(data.changes) ? data.changes : [];
const incomplete = changes.filter((change) => change.status !== 'complete');
if (incomplete.length === 0) {
console.log(`All ${changes.length} active OpenSpec change(s) are complete.`);
process.exit(0);
}
console.error('Incomplete OpenSpec change(s) found:');
for (const change of incomplete) {
const completed = Number.isInteger(change.completedTasks) ? change.completedTasks : 'unknown';
const total = Number.isInteger(change.totalTasks) ? change.totalTasks : 'unknown';
console.error(`- ${change.name}: status=${change.status}, tasks=${completed}/${total}`);
}
console.error('Complete these OpenSpec changes before merging.');
process.exit(1);
NODE
windows-command-smoke:
name: Windows command smoke
uses: ./.github/workflows/reusable-windows-command-smoke.yml
backend-unit-tests:
name: Go unit tests
uses: ./.github/workflows/reusable-backend-unit-tests.yml
redis-integration-tests:
name: Redis integration tests
runs-on: ubuntu-latest
timeout-minutes: 30
# Keep Redis coverage in a dedicated job. The reusable backend-unit-tests
# workflow owns its own service containers, so caller workflows cannot add
# Redis to that job without changing the reusable workflow contract.
services:
# Session Redis tests still write the PostgreSQL online-session projection,
# so this job needs the same initialized schema as the regular Go tests.
postgres:
image: postgres:14-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: linapro
TZ: Asia/Shanghai
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
# LINA_TEST_REDIS_ADDR below turns on otherwise-skipped real Redis
# integration tests for lock, KV, revision, event, and session hot state.
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Setup Timezone
run: |
sudo ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo Asia/Shanghai | sudo tee /etc/timezone
- name: Checkout Repository
uses: actions/checkout@v5
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: "1.25"
cache: false
- name: Initialize Database Schema
run: |
cp apps/lina-core/manifest/config/config.template.yaml apps/lina-core/manifest/config/config.yaml
make init confirm=init
- name: Run Redis Integration Tests
working-directory: apps/lina-core
env:
# These explicit test fixtures keep local/default runtime config from
# deciding which databases an integration test may connect to.
LINA_TEST_PGSQL_LINK: "pgsql:postgres:postgres@tcp(127.0.0.1:5432)/linapro?sslmode=disable"
LINA_TEST_REDIS_ADDR: "127.0.0.1:6379"
run: |
go test ./internal/service/coordination ./internal/service/cachecoord ./internal/service/kvcache ./internal/service/session -run Redis -count=1
frontend-unit-tests:
name: Frontend unit tests
uses: ./.github/workflows/reusable-frontend-unit-tests.yml
# SQLite Backend Smoke Tests
sqlite-smoke:
runs-on: ubuntu-latest
steps:
- name: Setup Timezone
run: |
sudo ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo Asia/Shanghai | sudo tee /etc/timezone
- name: Checkout Repository
uses: actions/checkout@v5
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: "1.25"
cache: false
- name: Run SQLite Backend Smoke
run: |
./hack/tests/scripts/run-sqlite-smoke.sh