Add a golangci-lint config and fix its findings: the OIDC state cookie gets the Secure flag on https deployments, and pool sizes are clamped before the int32 conversion.
59 lines
1.5 KiB
YAML
59 lines
1.5 KiB
YAML
# CI for LMR. Every push and pull request runs the checks. A push to master
|
|
# then builds the image and pushes it to the author's registry; replace the
|
|
# registry settings and secrets with yours when you fork.
|
|
when:
|
|
- event: [push, pull_request, manual]
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_USER: gateway
|
|
POSTGRES_PASSWORD: gateway
|
|
POSTGRES_DB: gateway
|
|
|
|
steps:
|
|
test:
|
|
image: golang:1.27-alpine
|
|
environment:
|
|
CGO_ENABLED: "0"
|
|
GATEWAY_TEST_DB_URL: postgres://gateway:gateway@postgres:5432/gateway?sslmode=disable
|
|
commands:
|
|
- cd backend
|
|
- go vet ./...
|
|
- i=0; until nc -z postgres 5432 || [ $i -ge 60 ]; do i=$((i+1)); sleep 1; done
|
|
- GATEWAY_DB_URL=$GATEWAY_TEST_DB_URL go run ./cmd/migrate up
|
|
- go test -count=1 ./...
|
|
|
|
lint:
|
|
image: golangci/golangci-lint:v2.14.0
|
|
commands:
|
|
- cd backend
|
|
- golangci-lint run ./...
|
|
|
|
ui:
|
|
image: node:22-alpine
|
|
commands:
|
|
- cd backend/dashboard
|
|
- npm ci
|
|
- npx tsc --noEmit
|
|
- npm run build
|
|
|
|
build-and-push:
|
|
image: woodpeckerci/plugin-docker-buildx:6
|
|
privileged: true
|
|
when:
|
|
- event: [push, manual]
|
|
branch: master
|
|
settings:
|
|
registry: registry.govekar.net
|
|
repo: registry.govekar.net/lovrog05/localmodelroutex
|
|
dockerfile: Dockerfile
|
|
context: .
|
|
platforms: linux/amd64
|
|
tags: latest,${CI_COMMIT_SHA}
|
|
username:
|
|
from_secret: registry_username
|
|
password:
|
|
from_secret: registry_password
|