83 lines
1.9 KiB
YAML
83 lines
1.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_PASSWORD: test
|
|
POSTGRES_DB: llm_intelligence_test
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
ports:
|
|
- 5432:5432
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.22'
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Go Coverage
|
|
run: |
|
|
go test -coverprofile=coverage.out ./internal/...
|
|
go tool cover -func=coverage.out | tee coverage-summary.txt
|
|
awk '/total:/ { gsub("%","",$3); if (($3 + 0) < 80) exit 1 }' coverage-summary.txt
|
|
env:
|
|
DATABASE_URL: postgres://postgres:test@localhost:5432/llm_intelligence_test?sslmode=disable
|
|
|
|
- name: Script Tests
|
|
run: bash scripts/test.sh
|
|
|
|
- name: Frontend Build
|
|
run: |
|
|
cd frontend
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Build Go Scripts
|
|
run: |
|
|
go build -o /dev/null ./scripts/fetch_openrouter.go
|
|
go build -o /dev/null ./scripts/generate_daily_report.go
|
|
|
|
- name: Docker Build
|
|
run: docker build -t llm-hub:test .
|
|
|
|
- name: Lint Go
|
|
uses: golangci/golangci-lint-action@v6
|
|
with:
|
|
version: latest
|
|
args: --timeout=5m
|
|
|
|
- name: Upload Coverage Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: go-coverage
|
|
path: |
|
|
coverage.out
|
|
coverage-summary.txt
|
|
|
|
- name: Upload Frontend Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: frontend-dist
|
|
path: frontend/dist
|