veza/.github/workflows/backend-ci.yml
senke d3245b2e4b fix(build): unify Go version to 1.24 across Dockerfile and CI
SEC-09: go.mod declares Go 1.24.0 but Dockerfile.production used 1.23
and backend-ci.yml used 1.23. Aligned both to 1.24.
2026-02-22 17:32:17 +01:00

102 lines
2.3 KiB
YAML

name: Backend API CI
on:
push:
paths:
- "veza-backend-api/**"
- ".github/workflows/backend-ci.yml"
pull_request:
paths:
- "veza-backend-api/**"
- ".github/workflows/backend-ci.yml"
jobs:
test-unit:
runs-on: ubuntu-latest
defaults:
run:
working-directory: veza-backend-api
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"
cache: true
- name: Download deps
run: go mod download
- name: Run govulncheck
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
- name: Run unit tests
run: go test ./internal/handlers/... ./internal/services/... -short -coverprofile=coverage.out -covermode=atomic -timeout 5m
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: go-coverage
path: veza-backend-api/coverage.out
test-integration:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: veza_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/veza_test?sslmode=disable
REDIS_URL: redis://localhost:6379
JWT_SECRET: test-jwt-secret-for-ci
APP_ENV: test
defaults:
run:
working-directory: veza-backend-api
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"
cache: true
- name: Download deps
run: go mod download
- name: Run migrations
run: go run cmd/migrate_tool/main.go
continue-on-error: true
- name: Run integration tests
run: go test -tags=integration ./internal/... -timeout 15m